|
@@ -8,6 +8,7 @@ import android.view.View;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.j256.ormlite.stmt.query.In;
|
|
|
import com.jixin.RetrofitUtil.RetrofitUtils;
|
|
|
import com.jixin.im.MyApplication;
|
|
|
import com.jixin.im.R;
|
|
@@ -17,9 +18,12 @@ import com.jixin.im.helper.LoginSecureHelper;
|
|
|
import com.jixin.im.ui.base.BaseActivity;
|
|
|
import com.jixin.im.ui.me.TiXianActivityNew;
|
|
|
import com.jixin.im.ui.tool.ButtonColorChange;
|
|
|
+import com.jixin.im.util.Constants;
|
|
|
import com.jixin.im.util.EventBusHelper;
|
|
|
+import com.jixin.im.util.PreferenceUtils;
|
|
|
import com.jixin.im.util.SkinUtils;
|
|
|
import com.jixin.im.util.ToastUtil;
|
|
|
+import com.jixin.im.view.SkinTextView;
|
|
|
import com.xuan.xuanhttplibrary.okhttp.HttpUtils;
|
|
|
import com.xuan.xuanhttplibrary.okhttp.callback.BaseCallback;
|
|
|
import com.xuan.xuanhttplibrary.okhttp.result.ObjectResult;
|
|
@@ -39,7 +43,12 @@ import okhttp3.ResponseBody;
|
|
|
import retrofit2.Callback;
|
|
|
import retrofit2.Response;
|
|
|
|
|
|
-public class WxPayBlance extends BaseActivity {
|
|
|
+
|
|
|
+/**
|
|
|
+ * 俊友钱包
|
|
|
+ * Modify by Harvey on 2020/09/23
|
|
|
+ */
|
|
|
+public class JunYouWalletActivity extends BaseActivity {
|
|
|
|
|
|
public static final String RSA_PRIVATE = "";
|
|
|
private static final int SDK_PAY_FLAG = 1;
|
|
@@ -47,11 +56,13 @@ public class WxPayBlance extends BaseActivity {
|
|
|
private TextView mBalanceTv;
|
|
|
private TextView mRechargeTv;
|
|
|
private TextView mWithdrawTv;
|
|
|
+ private TextView tvBindAlipay;
|
|
|
+ private TextView tvSetPayPwd;
|
|
|
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
- setContentView(R.layout.activity_wx_pay_blance);
|
|
|
+ setContentView(R.layout.activity_junyou_wallet);
|
|
|
initActionBar();
|
|
|
initView();
|
|
|
EventBusHelper.register(this);
|
|
@@ -66,59 +77,69 @@ public class WxPayBlance extends BaseActivity {
|
|
|
|
|
|
private void initActionBar() {
|
|
|
getSupportActionBar().hide();
|
|
|
- findViewById(R.id.iv_title_left).setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- finish();
|
|
|
- }
|
|
|
+ findViewById(R.id.iv_title_left).setOnClickListener(v -> {
|
|
|
+ finish();
|
|
|
});
|
|
|
- TextView mTvTitle = (TextView) findViewById(R.id.tv_title_center);
|
|
|
- mTvTitle.setText(getString(R.string.my_purse));
|
|
|
- ImageView mImageView = findViewById(R.id.iv_title_right);
|
|
|
- mImageView.setImageDrawable(getResources().getDrawable(R.mipmap.navigation));
|
|
|
- mImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- // 访问接口 获取记录
|
|
|
- Intent intent = new Intent(WxPayBlance.this, PaymentCenterActivity.class);
|
|
|
- startActivity(intent);
|
|
|
- }
|
|
|
+ SkinTextView tvTitleRight = findViewById(R.id.tv_title_right);
|
|
|
+ tvTitleRight.setVisibility(View.VISIBLE);
|
|
|
+ tvTitleRight.setText(R.string.bill);
|
|
|
+ tvTitleRight.setOnClickListener(v -> {
|
|
|
+ //账单
|
|
|
+ startActivity(new Intent(this, MyConsumeRecord.class));
|
|
|
});
|
|
|
+ TextView mTvTitle = findViewById(R.id.tv_title_center);
|
|
|
+ mTvTitle.setText(getString(R.string.my_purse));
|
|
|
+// ImageView mImageView = findViewById(R.id.iv_title_right);
|
|
|
+// mImageView.setImageDrawable(getResources().getDrawable(R.mipmap.navigation));
|
|
|
+// mImageView.setOnClickListener(new View.OnClickListener() {
|
|
|
+// @Override
|
|
|
+// public void onClick(View v) {
|
|
|
+// // 访问接口 获取记录
|
|
|
+// Intent intent = new Intent(JunYouWalletActivity.this, PaymentCenterActivity.class);
|
|
|
+// startActivity(intent);
|
|
|
+// }
|
|
|
+// });
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
- mBalanceTv = (TextView) findViewById(R.id.myblance);
|
|
|
- mRechargeTv = (TextView) findViewById(R.id.chongzhi);
|
|
|
- mWithdrawTv = (TextView) findViewById(R.id.quxian);
|
|
|
- ButtonColorChange.rechargeChange(this, mWithdrawTv, R.drawable.recharge_icon);
|
|
|
- ButtonColorChange.rechargeChange(this, mRechargeTv, R.drawable.chongzhi_icon);
|
|
|
- mWithdrawTv.setTextColor(SkinUtils.getSkin(this).getAccentColor());
|
|
|
-
|
|
|
- mRechargeTv.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- Intent intent = new Intent(WxPayBlance.this, WxPayAdd.class);
|
|
|
+ mBalanceTv = findViewById(R.id.tv_wallet_balance);
|
|
|
+ mRechargeTv = findViewById(R.id.tv_recharge);
|
|
|
+ mWithdrawTv = findViewById(R.id.tv_wallet_withdraw);
|
|
|
+ tvBindAlipay = findViewById(R.id.tv_bind_alipay);
|
|
|
+
|
|
|
+ tvSetPayPwd = findViewById(R.id.tv_set_pay_pwd);
|
|
|
+ if (hasPayPassword()){
|
|
|
+ tvSetPayPwd.setText(R.string.have_set);
|
|
|
+ }else{
|
|
|
+ tvSetPayPwd.setText(R.string.not_set);
|
|
|
+ }
|
|
|
+ tvSetPayPwd.setOnClickListener(v -> {
|
|
|
+ //设置支付密码
|
|
|
+ if (!hasPayPassword()){
|
|
|
+ Intent intent = new Intent(JunYouWalletActivity.this, ChangePayPasswordActivity.class);
|
|
|
startActivity(intent);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- mWithdrawTv.setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View view) {
|
|
|
- // 提款
|
|
|
- startActivity(new Intent(WxPayBlance.this, TiXianActivityNew.class));
|
|
|
-// Intent intent = new Intent(WxPayBlance.this, QuXianActivity.class);
|
|
|
-// startActivity(intent);
|
|
|
- }
|
|
|
+ mRechargeTv.setOnClickListener(v -> {
|
|
|
+ //充值
|
|
|
+ Intent intent = new Intent(JunYouWalletActivity.this, WxPayAdd.class);
|
|
|
+ startActivity(intent);
|
|
|
});
|
|
|
|
|
|
- findViewById(R.id.tvPayPassword).setOnClickListener(new View.OnClickListener() {
|
|
|
- @Override
|
|
|
- public void onClick(View v) {
|
|
|
- Intent intent = new Intent(WxPayBlance.this, ChangePayPasswordActivity.class);
|
|
|
- startActivity(intent);
|
|
|
- }
|
|
|
+ mWithdrawTv.setOnClickListener(v -> {
|
|
|
+ //提现
|
|
|
+ startActivity(new Intent(JunYouWalletActivity.this, TiXianActivityNew.class));
|
|
|
+ });
|
|
|
+
|
|
|
+ tvBindAlipay = findViewById(R.id.tv_bind_alipay);
|
|
|
+ tvBindAlipay.setOnClickListener(v -> {
|
|
|
+ //todo 需要对支付宝的判断
|
|
|
+
|
|
|
+
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void initData() {
|
|
@@ -137,14 +158,16 @@ public class WxPayBlance extends BaseActivity {
|
|
|
Balance balance = result.getData();
|
|
|
coreManager.getSelf().setBalance(Double.parseDouble(decimalFormat.format(balance.getBalance())));
|
|
|
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
- ToastUtil.showErrorData(WxPayBlance.this);
|
|
|
+ ToastUtil.showErrorData(JunYouWalletActivity.this);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onError(Call call, Exception e) {
|
|
|
- ToastUtil.showNetError(WxPayBlance.this);
|
|
|
+ ToastUtil.showNetError(JunYouWalletActivity.this);
|
|
|
}
|
|
|
});
|
|
|
getCoinInfo();
|
|
@@ -157,6 +180,11 @@ public class WxPayBlance extends BaseActivity {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private boolean hasPayPassword(){
|
|
|
+ boolean hasPayPassword = PreferenceUtils.getBoolean(this, Constants.IS_PAY_PASSWORD_SET + coreManager.getSelf().getUserId(), false);
|
|
|
+ return hasPayPassword;
|
|
|
+ }
|
|
|
+
|
|
|
private void getCoinInfo() {
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
String language = Locale.getDefault().getLanguage();
|