|
|
@@ -1,5 +1,6 @@
|
|
|
package com.sheep.gamegroup.view.activity;
|
|
|
|
|
|
+import android.content.Intent;
|
|
|
import android.view.View;
|
|
|
import android.widget.AdapterView;
|
|
|
import android.widget.EditText;
|
|
|
@@ -41,6 +42,8 @@ public class RechargeAct extends BaseActivity {
|
|
|
int mPayType = -1;//选择支付方式的id
|
|
|
String mAmount = null;//支付的金额
|
|
|
|
|
|
+ private boolean forResult = false;
|
|
|
+
|
|
|
@BindView(R.id.rechargeprice_greidview)
|
|
|
MyGridview rechargeprice_greidview;
|
|
|
@BindView(R.id.recharge_greidview)
|
|
|
@@ -62,6 +65,9 @@ public class RechargeAct extends BaseActivity {
|
|
|
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
+ if (getIntent().hasExtra("forResult")) {
|
|
|
+ forResult = true;
|
|
|
+ }
|
|
|
TitleBarUtils.getInstance()
|
|
|
.setShowOrHide(this, true)
|
|
|
.setTitle(this, "充值")
|
|
|
@@ -86,7 +92,7 @@ public class RechargeAct extends BaseActivity {
|
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
select = position;
|
|
|
rechargePriceAdapter.setInPut(false);
|
|
|
- RechargePriceEntity rechargePriceEntity = (RechargePriceEntity) parent.getItemAtPosition(position);
|
|
|
+ RechargePriceEntity rechargePriceEntity = (RechargePriceEntity) parent.getItemAtPosition(position);
|
|
|
etRechargePrice.setText("" + rechargePriceEntity.getPrice());
|
|
|
for (int i = 0; i < mPriceEntityList.size(); i++) {
|
|
|
if (position == i) {
|
|
|
@@ -161,12 +167,12 @@ public class RechargeAct extends BaseActivity {
|
|
|
public void onNext(BaseMessage baseMessage) {
|
|
|
hideProgress();
|
|
|
List<RechargeEntity> list = baseMessage.getDatas(RechargeEntity.class);
|
|
|
- if(list != null && list.size() > 0){
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
mPayType = list.get(0).getId();
|
|
|
rechargeAdapter.setSelect(0);
|
|
|
}
|
|
|
rechargeAdapter.addAll(list);
|
|
|
- if(!list.isEmpty()) {
|
|
|
+ if (!list.isEmpty()) {
|
|
|
mPayType = list.get(0).getId();
|
|
|
rechargeAdapter.setSelect(0);
|
|
|
rechargeAdapter.notifyDataSetChanged();
|
|
|
@@ -215,7 +221,7 @@ public class RechargeAct extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
mAmount = etRechargePrice.getText().toString().trim();
|
|
|
- if(android.text.TextUtils.isEmpty(mAmount)){
|
|
|
+ if (android.text.TextUtils.isEmpty(mAmount)) {
|
|
|
G.showToast("请选择充值金额");
|
|
|
return;
|
|
|
}
|
|
|
@@ -251,7 +257,13 @@ public class RechargeAct extends BaseActivity {
|
|
|
// String resultInfo = payResult.getResult();// 同步返回需要验证的信息
|
|
|
|
|
|
String resultStatus = payResult.getResultStatus();
|
|
|
- Jump2View.getInstance().goRechargeResultAct(RechargeAct.this, resultStatus);
|
|
|
+ if (forResult && "9000".equals(resultStatus)) {
|
|
|
+ Intent intent = new Intent();
|
|
|
+ intent.putExtra("amount", Integer.parseInt(mAmount));
|
|
|
+ setResult(777, intent);
|
|
|
+ } else {
|
|
|
+ Jump2View.getInstance().goRechargeResultAct(RechargeAct.this, resultStatus);
|
|
|
+ }
|
|
|
finish();
|
|
|
}
|
|
|
});
|
|
|
@@ -264,12 +276,12 @@ public class RechargeAct extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private void addDatas() {
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"10元", 10));
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"20元", 20));
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"50元", 50));
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"100元", 100));
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"200元", 200));
|
|
|
- mPriceEntityList.add(new RechargePriceEntity(false,"500元", 500));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "10元", 10));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "20元", 20));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "50元", 50));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "100元", 100));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "200元", 200));
|
|
|
+ mPriceEntityList.add(new RechargePriceEntity(false, "500元", 500));
|
|
|
}
|
|
|
|
|
|
}
|