修复支付弹窗问题

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

View File

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

View File

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