修复支付弹窗问题

This commit is contained in:
hch 2023-12-01 13:33:49 +08:00
parent b8264997f4
commit b35d5d242e
3 changed files with 56 additions and 11 deletions

View File

@ -204,7 +204,7 @@ public class IMLoginModel extends BaseModel {
@SerializedName("votes") @SerializedName("votes")
private String votes; private String votes;
@SerializedName("yuanbao") @SerializedName("yuanbao")
private long yuanbao; private double yuanbao;
@SerializedName("list") @SerializedName("list")
private List<List<ListModel>> list; private List<List<ListModel>> list;
@SerializedName("slide") @SerializedName("slide")
@ -825,7 +825,7 @@ public class IMLoginModel extends BaseModel {
return this; return this;
} }
public long getYuanbao() { public double getYuanbao() {
return yuanbao; return yuanbao;
} }

View File

@ -17,9 +17,11 @@ public class LoadingDialog extends AbsDialogFragment {
private TextView hint; private TextView hint;
private String showText = ""; private String showText = "";
public boolean isShow;
public void setShowText(String showText) { public void setShowText(String showText) {
this.showText = showText; this.showText = showText;
isShow = true;
} }
@Override @Override
@ -44,19 +46,21 @@ public class LoadingDialog extends AbsDialogFragment {
hint = (TextView) findViewById(R.id.hint); hint = (TextView) findViewById(R.id.hint);
dots.start(); dots.start();
hint.setText(showText); hint.setText(showText);
isShow = true;
} }
public void setHintText(String text) { public void setHintText(String text) {
if (hint != null) { if (hint != null) {
hint.setText(text); hint.setText(text);
} }
isShow = true;
} }
@Override @Override
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
dots.stop(); dots.stop();
isShow = false;
} }
@Override @Override

View File

@ -27,6 +27,7 @@ import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.pay.hw.HwBuilder; import com.yunbao.common.pay.hw.HwBuilder;
import com.yunbao.common.utils.GoogleUtils; import com.yunbao.common.utils.GoogleUtils;
import com.yunbao.common.utils.L;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.main.R; import com.yunbao.main.R;
@ -62,6 +63,8 @@ public class MyWalletActivity extends AbsActivity {
HwBuilder hwBuilder; HwBuilder hwBuilder;
GoogleUtils googleUtils; GoogleUtils googleUtils;
LoadingDialog loadingDialog;
@Override @Override
protected int getLayoutId() { protected int getLayoutId() {
return R.layout.activity_my_wallet; return R.layout.activity_my_wallet;
@ -88,7 +91,7 @@ public class MyWalletActivity extends AbsActivity {
RouteUtil.forwardRedPacketList(); RouteUtil.forwardRedPacketList();
}); });
rView.setOnClickListener(v -> { rView.setOnClickListener(v -> {
LoadingDialog loadingDialog = new LoadingDialog(); loadingDialog = new LoadingDialog();
loadingDialog.show(getSupportFragmentManager(), "LoadingDialog"); loadingDialog.show(getSupportFragmentManager(), "LoadingDialog");
loadingDialog.setShowText(getString(R.string.order_query)); loadingDialog.setShowText(getString(R.string.order_query));
@ -99,8 +102,8 @@ public class MyWalletActivity extends AbsActivity {
try { try {
int code = obj.getInt("querySize"); int code = obj.getInt("querySize");
if (code == 0) { if (code == 0) {
payHandler.post(() -> loadingDialog.setHintText(getString(R.string.order_query_success))); payHandler.post(runnable1);
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000); payHandler.postDelayed(runnable2, 1000);
} else { } else {
JSONArray tokenList = obj.getJSONArray("tokenList"); JSONArray tokenList = obj.getJSONArray("tokenList");
JSONArray orderList = obj.getJSONArray("orderList"); JSONArray orderList = obj.getJSONArray("orderList");
@ -139,11 +142,11 @@ public class MyWalletActivity extends AbsActivity {
googleUtils.queryPurchasesAsync(); googleUtils.queryPurchasesAsync();
} else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) { } else if (CommonAppConfig.IS_GOOGLE_PLAY == 2) {
hwBuilder.consume(); hwBuilder.consume();
payHandler.postDelayed(() -> loadingDialog.setHintText(getString(R.string.order_query_success)), 1000); payHandler.postDelayed(runnable1, 1000);
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000); payHandler.postDelayed(runnable2, 1000);
} else { } else {
loadingDialog.setShowText(getString(R.string.order_query_success)); payHandler.post(runnable1);
payHandler.postDelayed(() -> loadingDialog.dismiss(), 2000); payHandler.postDelayed(runnable2, 1000);
} }
}); });
@ -347,6 +350,44 @@ public class MyWalletActivity extends AbsActivity {
} }
} }
private Runnable runnable1 = new Runnable() {
@Override
public void run() {
loadingDialog.setHintText(getString(R.string.order_query_success));
}
};
private Runnable runnable2 = new Runnable() {
@Override
public void run() {
if (loadingDialog != null) {
if (loadingDialog.isShow) {
loadingDialog.dismiss();
}
}
}
};
@Override
protected void onPause() {
super.onPause();
CommonHttpUtil.cancel("Charge.Google_sec_pay");
if (payHandler != null) {
payHandler.removeCallbacks(runnable1);
payHandler.removeCallbacks(runnable2);
}
}
@Override
protected void onDestroy() {
super.onDestroy();
CommonHttpUtil.cancel("Charge.Google_sec_pay");
if (payHandler != null) {
payHandler.removeCallbacks(runnable1);
payHandler.removeCallbacks(runnable2);
}
}
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);