From eab2bbdc93dc2bf95699d215fd788174a378fe28 Mon Sep 17 00:00:00 2001 From: yezhiqiu <123456@qq.com> Date: Tue, 15 Sep 2026 15:47:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E9=98=B2=E7=AF=A1=E6=94=B9?= =?UTF-8?q?=E8=AF=AF=E6=8A=A5=E7=9A=84=E9=97=AE=E9=A2=98=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E6=B2=A1=E6=9C=89=E7=BD=91=E7=BB=9C=E5=92=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E6=8C=82=E4=BA=86=E7=9A=84=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=202.=E6=94=AF=E4=BB=98=E7=AE=A1=E7=90=86=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E4=BF=A1=E7=94=A8=E5=8D=A1=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=94=AF=E4=BB=98=E4=BF=A1=E6=81=AF=203.?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B7=BB=E5=8A=A0=E4=BF=A1=E7=94=A8=E5=8D=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=82=B9=E5=87=BB=E7=A9=BA=E7=99=BD=E5=A4=84?= =?UTF-8?q?=E5=8F=AF=E9=9A=90=E8=97=8F=E9=94=AE=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 8 +- .../com/abbidot/tracker/base/BaseActivity.kt | 66 ++++++--- .../tracker/ui/activity/HomeV2Activity.kt | 36 +++-- .../tracker/ui/activity/SplashActivity.kt | 30 +++- .../subscribe/AddCreditCardPaymentActivity.kt | 140 +++++++++++++----- .../subscribe/CreditCardPaymentFragment.kt | 26 +++- .../com/abbidot/tracker/vm/AppSetViewModel.kt | 1 + .../activity_add_credit_card_payment.xml | 8 + app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values-fr/strings.xml | 1 + app/src/main/res/values-it/strings.xml | 1 + app/src/main/res/values/strings.xml | 2 +- .../network/exception/ErrorCode.kt | 7 + 13 files changed, 239 insertions(+), 89 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ca469b7..be248ca 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -28,10 +28,10 @@ android { applicationId "com.abbidot.tracker" minSdkVersion 24 targetSdkVersion 35 - versionCode 2501 -// versionName "2.5.1" - versionName "2.5.1-Beta1" - + versionCode 2502 +// versionName "2.5.2" + versionName "2.5.2-Beta1" +4 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { diff --git a/app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt b/app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt index bf6e14f..31ac034 100644 --- a/app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt +++ b/app/src/main/java/com/abbidot/tracker/base/BaseActivity.kt @@ -338,11 +338,13 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl /** * 按钮开启/禁用点击 */ - fun setButtonEnabled(v: View, enabled: Int = ConstantInt.SpecialType) { - when (enabled) { - ConstantInt.SpecialType -> v.isEnabled = !v.isEnabled - ConstantInt.Type0 -> v.isEnabled = false - ConstantInt.Type1 -> v.isEnabled = true + fun setButtonEnabled(v: View?, enabled: Int = ConstantInt.SpecialType) { + v?.let { + when (enabled) { + ConstantInt.SpecialType -> v.isEnabled = !v.isEnabled + ConstantInt.Type0 -> v.isEnabled = false + ConstantInt.Type1 -> v.isEnabled = true + } } } @@ -422,7 +424,10 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl else { mTopBar!!.setTitle(title) val tf = - ViewUtil.instance.setTypeface(mContext, getString(R.string.roboto_bold_font)) + ViewUtil.instance.setTypeface( + mContext, + getString(R.string.roboto_bold_font) + ) mTopBar!!.titleView!!.setTypeface(tf) } mTopBar!!.addLeftBackImageButton().setOnClickListener { leftBackOnClick() } @@ -460,7 +465,10 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl // } } - fun showNoCancelableLoading(show: Boolean, message: String = getString(R.string.txt_loading)) { + fun showNoCancelableLoading( + show: Boolean, + message: String = getString(R.string.txt_loading) + ) { if (!isFrontRunning && show) { return } @@ -472,7 +480,8 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl // if (TextUtils.isEmpty(tip)) { // } mLoadingDialog = - QMUITipDialog.Builder(mContext).setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) + QMUITipDialog.Builder(mContext) + .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING) .setTipWord(message).create(false).apply { setCanceledOnTouchOutside(false) show() @@ -585,7 +594,7 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl isShowNoDataTip: Boolean = true,//是否显示无数据提示 isShowRequestErrorTip: Boolean = true,//是否显示请求错误提示 isShowCodeError: Boolean = true,//是否显示错误码提示 - isShowNetCodeMsg: Boolean = false,//是否显示服务器返回message提示 + isShowNetErrorMsg: Boolean = false,//是否显示服务器返回message提示 errorTip: String = getString(R.string.txt_net_error) ) { try { @@ -625,7 +634,7 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl val data = it.getOrNull() if (null == data) { - if (isShowNetCodeMsg && exceptionCode == ErrorCode.ERROR.toString()) { + if (isShowNetErrorMsg && exceptionCode == ErrorCode.ERROR.toString()) { showToast(exceptionMessage ?: errorTip) } else if (isShowRequestErrorTip) { if (NetworkUtil.isNetworkAvailable(mContext)) { @@ -658,7 +667,10 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl /** * 网络请求错误code提示 */ - private fun netErrorCodeTips(exceptionCode: String, isShowCodeError: Boolean = true): Boolean { + private fun netErrorCodeTips( + exceptionCode: String, + isShowCodeError: Boolean = true + ): Boolean { //设备已过期,请续费 when (exceptionCode) { ErrorCode.DEVICE_RENEWAL.toString() -> { @@ -693,12 +705,18 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl } //注册失败 ErrorCode.REGISTER_FAIL.toString() -> { - if (isShowCodeError) showToast(R.string.txt_register_fail, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_register_fail, + gravity = Gravity.CENTER + ) return true } //用户不存在 ErrorCode.USER_NO_EXIST.toString() -> { - if (isShowCodeError) showToast(R.string.txt_user_no_exist, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_user_no_exist, + gravity = Gravity.CENTER + ) return true } //用户已存在 @@ -737,17 +755,26 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl } //系统异常 "1001" -> { - if (isShowCodeError) showToast(R.string.txt_system_error, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_system_error, + gravity = Gravity.CENTER + ) return true } "1002" -> { - if (isShowCodeError) showToast(R.string.txt_missing_param, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_missing_param, + gravity = Gravity.CENTER + ) return true } "1003" -> { - if (isShowCodeError) showToast(R.string.txt_tracker_busy, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_tracker_busy, + gravity = Gravity.CENTER + ) return true } @@ -759,7 +786,10 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl } "1005" -> { - if (isShowCodeError) showToast(R.string.txt_tracker_live, gravity = Gravity.CENTER) + if (isShowCodeError) showToast( + R.string.txt_tracker_live, + gravity = Gravity.CENTER + ) return true } @@ -782,7 +812,7 @@ abstract class BaseActivity(val inflater: (inflater: LayoutInfl /** * 监听软键盘隐藏 */ - open fun listenHideKeyboard() {} +// open fun listenHideKeyboard() {} /******************************点击屏幕页面隐藏软键盘start**************************************/ // override fun dispatchTouchEvent(ev: MotionEvent): Boolean { diff --git a/app/src/main/java/com/abbidot/tracker/ui/activity/HomeV2Activity.kt b/app/src/main/java/com/abbidot/tracker/ui/activity/HomeV2Activity.kt index 9314c74..c73faf6 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/activity/HomeV2Activity.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/activity/HomeV2Activity.kt @@ -21,6 +21,7 @@ import com.abbidot.baselibrary.constant.ConState import com.abbidot.baselibrary.constant.EventName import com.abbidot.baselibrary.constant.MMKVKey import com.abbidot.baselibrary.eventbus.XEventBus +import com.abbidot.baselibrary.network.exception.ErrorCode import com.abbidot.baselibrary.util.AppUtils import com.abbidot.baselibrary.util.LogUtil import com.abbidot.baselibrary.util.MMKVUtil @@ -58,6 +59,7 @@ import com.abbidot.tracker.vm.CountDownTimerViewModel import com.abbidot.tracker.vm.DataViewModel import com.abbidot.tracker.vm.FamilyViewModel import com.abbidot.tracker.vm.LogBleReportViewModel +import com.baidu.platform.comapi.util.NetworkUtil import com.clj.fastble.BleManager import com.google.android.material.navigation.NavigationBarView import dagger.hilt.android.AndroidEntryPoint @@ -169,8 +171,7 @@ class HomeV2Activity : BaseActivity(ActivityHomeV2Binding setLineShow(2) //判断是否登录失效 - if (loginInfoInvalid()) - return + if (loginInfoInvalid()) return //出现闪退,5秒退出APP val isCrash = MMKVUtil.getBoolean(MMKVKey.isCrash, false) @@ -216,7 +217,12 @@ class HomeV2Activity : BaseActivity(ActivityHomeV2Binding checkPermissions() - mDataViewModel.getHomeBindPetList(this@HomeV2Activity) + //首次启动APP,没有网络去检验APP合法性,就在网络可用时去检验 + if (MMKVUtil.getInt(MMKVKey.isCheckLegalApp) == ConstantInt.Type2) { + mAppSetViewModel.checkPackageStatus(applicationContext) + } else { + mDataViewModel.getHomeBindPetList(this@HomeV2Activity) + } //设置bugly的用户id // CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email)) @@ -249,8 +255,7 @@ class HomeV2Activity : BaseActivity(ActivityHomeV2Binding override fun onResume() { super.onResume() - if (loginInfoInvalid()) - return + if (loginInfoInvalid()) return if (isCountdownAutoConnBle && mCountdownType == ConstantInt.Type1) { LogUtil.e("onResume,自动连接设备20秒计时开始") mCountDownTimerViewModel.startCountDown(20) @@ -303,17 +308,26 @@ class HomeV2Activity : BaseActivity(ActivityHomeV2Binding } mAppSetViewModel.mCheckPackageStatusLiveData.observe(this) { if (null == it) { - showToast(R.string.txt_no_legal_app, true) + showToast(R.string.txt_no_legal_app, false, Gravity.CENTER) } else { - if (null == it.getOrNull()) { - showToast(R.string.txt_no_legal_app, true, Gravity.CENTER) - } else { + if (it.isSuccess) { MMKVUtil.putInt(MMKVKey.isCheckLegalApp, ConstantInt.Type1) - if (mNetworkRequestsFailRetryCount == mNetworkRequestsFailMaxCount && mPetList.isEmpty()) { + if (mPetList.isEmpty()) { mNetworkRequestsFailRetryCount = 0 - isFirst = false mDataViewModel.getHomeBindPetList(this@HomeV2Activity) } + } else { + if (null == it.exceptionOrNull()) { + showToast(R.string.txt_no_legal_app, false, Gravity.CENTER) + } else { + //服务器返回错误code + val exceptionCode = it.exceptionOrNull().toString() + if (exceptionCode == ErrorCode.ILLEGAL_APP_PACKAGE.toString()) { + showToast(R.string.txt_no_legal_app, true, Gravity.CENTER) + } else if (NetworkUtil.isNetworkAvailable(mContext)) { + showToast(R.string.txt_system_error, false, Gravity.CENTER) + } + } } } } diff --git a/app/src/main/java/com/abbidot/tracker/ui/activity/SplashActivity.kt b/app/src/main/java/com/abbidot/tracker/ui/activity/SplashActivity.kt index 2323a28..9e77fd8 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/activity/SplashActivity.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/activity/SplashActivity.kt @@ -18,6 +18,7 @@ import androidx.core.view.ViewCompat import androidx.core.view.WindowInsetsCompat import cn.jpush.android.api.JPushInterface import com.abbidot.baselibrary.constant.MMKVKey +import com.abbidot.baselibrary.network.exception.ErrorCode import com.abbidot.baselibrary.util.AppUtils import com.abbidot.baselibrary.util.LogUtil import com.abbidot.baselibrary.util.MMKVUtil @@ -122,24 +123,33 @@ class SplashActivity : QMUIActivity() { mAppSetViewModel.apply { mCheckPackageStatusLiveData.observe(this@SplashActivity) { if (null == it) { - showToastAndFinish() + checkLegal(ConstantInt.Type2) } else { - if (null == it.getOrNull()) { - showToastAndFinish() + if (it.isSuccess) { + checkLegal(ConstantInt.Type1) } else { - MMKVUtil.putInt(MMKVKey.isCheckLegalApp, ConstantInt.Type1) - legalApp() + if (null == it.exceptionOrNull()) { + checkLegal(ConstantInt.Type2) + } else { + //服务器返回错误code + val exceptionCode = it.exceptionOrNull().toString() + if (exceptionCode == ErrorCode.ILLEGAL_APP_PACKAGE.toString()) { + showToastAndFinish() + } else checkLegal(ConstantInt.Type2) + } } } } } mAppSetViewModel.checkPackageStatus(applicationContext) } else { - MMKVUtil.putInt(MMKVKey.isCheckLegalApp, ConstantInt.Type2) - legalApp() + checkLegal(ConstantInt.Type2) } } + /** + * 显示非法APP包提示窗并finish + */ private fun showToastAndFinish() { Toaster.show(getString(R.string.txt_no_legal_app)) mViewBinding.root.postDelayed({ @@ -147,6 +157,12 @@ class SplashActivity : QMUIActivity() { }, 2000) } + private fun checkLegal(checkType: Int) { + MMKVUtil.putInt(MMKVKey.isCheckLegalApp, checkType) + legalApp() + } + + private fun legalApp() { mCountDownTimerViewModel.mCountDownEndLiveData.observe(this) { mViewBinding.splashLottieAnimationView.cancelAnimation() diff --git a/app/src/main/java/com/abbidot/tracker/ui/activity/subscribe/AddCreditCardPaymentActivity.kt b/app/src/main/java/com/abbidot/tracker/ui/activity/subscribe/AddCreditCardPaymentActivity.kt index b835949..8aef757 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/activity/subscribe/AddCreditCardPaymentActivity.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/activity/subscribe/AddCreditCardPaymentActivity.kt @@ -5,6 +5,7 @@ import android.text.InputFilter import android.text.InputFilter.LengthFilter import android.text.InputType import android.text.TextUtils +import android.view.Gravity import android.view.View import android.view.View.OnFocusChangeListener import androidx.activity.viewModels @@ -44,6 +45,9 @@ class AddCreditCardPaymentActivity : private var mOldCard: CreditCardBean? = null private var isEdit = false + //是否显示删除按钮 + private var isShowDeleteBtn = false + //是否存在PaymentMethodID private var isHavePaymentMethodID = false @@ -56,6 +60,7 @@ class AddCreditCardPaymentActivity : intent, ConstantString.Card, CreditCardBean::class.java ) isEdit = getBoolean(ConstantString.Edit) + isShowDeleteBtn = getBoolean(ConstantString.PartnerCode) isHavePaymentMethodID = getBoolean(ConstantString.isCheck) } if (null == mCreditCard) mCreditCard = CreditCardBean() @@ -63,7 +68,9 @@ class AddCreditCardPaymentActivity : if (isEdit) { mOldCard = mCreditCard setTopBarTitle(R.string.txt_edit_pay_method) -// mRightImageButton = addRightImageButton(R.drawable.icon_delete_svg) + if (isShowDeleteBtn) { + mRightImageButton = addRightImageButton(R.drawable.icon_delete_svg) + } } else { setTopBarTitle(R.string.txt_add_payment) } @@ -73,7 +80,7 @@ class AddCreditCardPaymentActivity : ilAddCardNameOnCard.let { it.tvInputView2NameTitle.setText(R.string.txt_name_card) - it.etInputView2Content.setFilters(arrayOf(InputFilter.AllCaps())) + it.etInputView2Content.filters = arrayOf(InputFilter.AllCaps()) it.etInputView2Content.onFocusChangeListener = this@AddCreditCardPaymentActivity showEditViewContent(it.etInputView2Content, mCreditCard!!.cardName) } @@ -127,23 +134,52 @@ class AddCreditCardPaymentActivity : ilAddCardNameOnCard.root, ilAddCardNumber.root, llAddCardCvcLayout, - llAddCardMmDdLayout + llAddCardMmDdLayout, tvAddCardExperienceBtn ) } } override fun liveDataObserve() { - mSubscriptionPayViewModel.mSavePaymentMethodIDLiveData.observe(this) { - dealRequestResult(it, object : GetResultCallback { - override fun onResult(any: Any) { - setResult(ResultCode.ResultCode_1, null) - showToast(R.string.txt_save_successful, isFinish = true) - } + mSubscriptionPayViewModel.apply { + mSavePaymentMethodIDLiveData.observe(this@AddCreditCardPaymentActivity) { + dealRequestResult(it, object : GetResultCallback { + override fun onResult(any: Any) { + setResult(ResultCode.ResultCode_1, null) + showToast(R.string.txt_save_successful, isFinish = true) + } - override fun onRequestError(exceptionCode: String?) { - setButtonEnabled(mViewBinding.btnSaveNewCreditCard, ConstantInt.Type1) - } - }, isShowNetCodeMsg = true) + override fun onRequestError(exceptionCode: String?) { + setButtonEnabled(mViewBinding.btnSaveNewCreditCard, ConstantInt.Type1) + } + }, isShowNetErrorMsg = true) + } + mOrderAutoRenewalStatusLiveData.observe(this@AddCreditCardPaymentActivity) { + dealRequestResult(it, object : GetResultCallback { + override fun onResult(any: Any) { + it.getOrNull()?.let { d -> + showRemoveDialog(d.isNeedCancel) + } + } + + override fun onRequestError(exceptionCode: String?) { + setButtonEnabled(mRightImageButton, ConstantInt.Type1) + setButtonEnabled(mViewBinding.btnSaveNewCreditCard, ConstantInt.Type1) + } + }) + } + mRemovePaymentMethodLiveData.observe(this@AddCreditCardPaymentActivity) { + dealRequestResult(it, object : GetResultCallback { + override fun onResult(any: Any) { + setResult(ResultCode.ResultCode_1, null) + showToast(R.string.txt_delete_succe, true, Gravity.CENTER) + } + + override fun onRequestError(exceptionCode: String?) { + setButtonEnabled(mRightImageButton, ConstantInt.Type1) + setButtonEnabled(mViewBinding.btnSaveNewCreditCard, ConstantInt.Type1) + } + }) + } } } @@ -201,7 +237,7 @@ class AddCreditCardPaymentActivity : } } - override fun listenHideKeyboard() { + private fun setHideKeyboard() { mViewBinding.apply { setEditViewNoFocusHide(etAddCardCvcContent, false) setEditViewNoFocusHide(etAddCardMmDdContent, false) @@ -211,7 +247,6 @@ class AddCreditCardPaymentActivity : } - private fun confirmSaveCardV2() { mViewBinding.apply { val cardNumber = ilAddCardNumber.etInputView2Content.text.toString().replace(" ", "") @@ -295,32 +330,59 @@ class AddCreditCardPaymentActivity : } } - private fun deleteCard() { - ViewUtil.instance.showDialog( - mContext, R.string.txt_sure_delete_card, object : BaseDialog.OnDialogOkListener { - override fun onOkClick(dialog: BaseDialog<*>) { - lifecycleScope.launch(Dispatchers.IO) { - mCreditCard?.apply { -// MyDatabase.creditCardDao().delete(this) - } + /** + * 显示删除支付方式弹窗 + * @param haveAutoRenewal 是否有自动续费 1为有 0为无 + */ + private fun showRemoveDialog(haveAutoRenewal: Int) { + if (haveAutoRenewal == ConstantInt.Type1) { + ViewUtil.instance.showDialog( + this@AddCreditCardPaymentActivity, + R.string.txt_remove_pay_method_tips2, + object : BaseDialog.OnDialogOkListener { + override fun onOkClick(dialog: BaseDialog<*>) { + dialog.dismiss() + mSubscriptionPayViewModel.removePaymentMethodID(1) } - dialog.dismiss() - setResult(ResultCode.ResultCode_1, null) - showToast(R.string.txt_delete_succe, isFinish = true) - } - }, okTextResId = R.string.start_txt_yes - ) + }, + getString(R.string.txt_auto_renewal_on), + R.string.txt_turn_off_remove, R.string.txt_cancel + ) + } else { + ViewUtil.instance.showDialog( + this@AddCreditCardPaymentActivity, + R.string.txt_remove_pay_method_tips1, + object : BaseDialog.OnDialogOkListener { + override fun onOkClick(dialog: BaseDialog<*>) { + dialog.dismiss() + mSubscriptionPayViewModel.removePaymentMethodID(1) + } + }, + getString(R.string.txt_remove_pay_method) + if (AppUtils.isChina()) "?" else "?", + R.string.txt_remove, R.string.txt_cancel + ) + } } override fun onClick(v: View?) { mViewBinding.apply { + if (v != tvAddCardExperienceBtn && isLimitClick()) return when (v!!) { + tvAddCardExperienceBtn -> { + setHideKeyboard() + hideInputMethod(v) + } + btnSaveNewCreditCard -> confirmSaveCardV2() llAddCardMmDdLayout -> setClickEditViewVisible(etAddCardMmDdContent) llAddCardCvcLayout -> setClickEditViewVisible(etAddCardCvcContent) ilAddCardNameOnCard.root -> setClickEditViewVisible(ilAddCardNameOnCard.etInputView2Content) ilAddCardNumber.root -> setClickEditViewVisible(ilAddCardNumber.etInputView2Content) - mRightImageButton -> deleteCard() + mRightImageButton -> { + setButtonEnabled(btnSaveNewCreditCard, ConstantInt.Type0) + setButtonEnabled(mRightImageButton, ConstantInt.Type0) + mSubscriptionPayViewModel.getOrderAutoRenewalStatus() + } } } } @@ -328,21 +390,17 @@ class AddCreditCardPaymentActivity : override fun onFocusChange(v: View?, hasFocus: Boolean) { mViewBinding.apply { when (v!!) { - ilAddCardNameOnCard.etInputView2Content -> { + ilAddCardNameOnCard.etInputView2Content -> setEditViewNoFocusHide(ilAddCardNameOnCard.etInputView2Content, hasFocus) - } - ilAddCardNumber.etInputView2Content -> { - setEditViewNoFocusHide(ilAddCardNumber.etInputView2Content, hasFocus) - } + ilAddCardNumber.etInputView2Content -> setEditViewNoFocusHide( + ilAddCardNumber.etInputView2Content, + hasFocus + ) - etAddCardMmDdContent -> { - setEditViewNoFocusHide(etAddCardMmDdContent, hasFocus) - } + etAddCardMmDdContent -> setEditViewNoFocusHide(etAddCardMmDdContent, hasFocus) - etAddCardCvcContent -> { - setEditViewNoFocusHide(etAddCardCvcContent, hasFocus) - } + etAddCardCvcContent -> setEditViewNoFocusHide(etAddCardCvcContent, hasFocus) } } } diff --git a/app/src/main/java/com/abbidot/tracker/ui/fragment/subscribe/CreditCardPaymentFragment.kt b/app/src/main/java/com/abbidot/tracker/ui/fragment/subscribe/CreditCardPaymentFragment.kt index e52b47b..d447894 100644 --- a/app/src/main/java/com/abbidot/tracker/ui/fragment/subscribe/CreditCardPaymentFragment.kt +++ b/app/src/main/java/com/abbidot/tracker/ui/fragment/subscribe/CreditCardPaymentFragment.kt @@ -41,6 +41,9 @@ class CreditCardPaymentFragment : BaseFragment private val mSubscriptionPayViewModel: SubscriptionPayViewModel by viewModels() private lateinit var mCreditCardAdapter: CreditCardAdapter + //是否显示编辑里删除按钮 + private var isShowDeleteBtn = false + companion object { @JvmStatic fun newInstance(context: Context) = CreditCardPaymentFragment().apply { @@ -54,8 +57,7 @@ class CreditCardPaymentFragment : BaseFragment mCreditCardAdapter = CreditCardAdapter(mContext!!, null).apply { setOnAgainClickListener(object : BaseRecyclerAdapter.OnAgainClickListener { override fun onAgainListener() { - val intent = Intent(mContext, AddCreditCardPaymentActivity::class.java) - launchActivity(mActivity!!, mActivityResultLauncher, intent) + goAddCard() } }) @@ -110,6 +112,8 @@ class CreditCardPaymentFragment : BaseFragment // } //没有卡,显示无卡提示 不用去添加卡 mViewBinding.apply { + btnCreditCardPaymentRemove.visibility = View.GONE + isShowDeleteBtn = false if (null == getHostActivity(PaymentMethodActivity::class.java)?.mOrderBean) { ilCreditCardPaymentNoData.root.visibility = View.VISIBLE rvCreditCardPaymentList.visibility = View.GONE @@ -132,10 +136,12 @@ class CreditCardPaymentFragment : BaseFragment //卡管理 不需要点击效果 if (null == getHostActivity(PaymentMethodActivity::class.java)?.mOrderBean) { btnCreditCardPaymentRemove.visibility = View.VISIBLE + isShowDeleteBtn = true btnMakePaymentCreditCard.visibility = View.GONE } else { stripeMethodInfo.checked = true btnCreditCardPaymentRemove.visibility = View.GONE + isShowDeleteBtn = false btnMakePaymentCreditCard.visibility = View.VISIBLE } } @@ -152,6 +158,7 @@ class CreditCardPaymentFragment : BaseFragment Intent(mContext, AddCreditCardPaymentActivity::class.java).let { it.putExtra(ConstantString.Card, cardBean) it.putExtra(ConstantString.Edit, true) + it.putExtra(ConstantString.PartnerCode, isShowDeleteBtn) //是否存在PaymentMethodID var isHavePaymentMethodID = false getHostActivity(PaymentMethodActivity::class.java)?.let { h -> @@ -163,6 +170,14 @@ class CreditCardPaymentFragment : BaseFragment } } + /** + * 添加卡 + */ + private fun goAddCard() { + val intent = Intent(mContext, AddCreditCardPaymentActivity::class.java) + launchActivity(mActivity!!, mActivityResultLauncher, intent) + } + override fun liveDataObserve() { mSubscriptionPayViewModel.apply { mSubscriptionCustomerLiveData.observe(viewLifecycleOwner) { @@ -215,6 +230,7 @@ class CreditCardPaymentFragment : BaseFragment //卡管理 不需要点击效果 if (null == getHostActivity(PaymentMethodActivity::class.java)?.mOrderBean) { mViewBinding.btnCreditCardPaymentRemove.visibility = View.VISIBLE + isShowDeleteBtn = true mViewBinding.btnMakePaymentCreditCard.visibility = View.GONE } else { var haveCheck = false @@ -228,6 +244,7 @@ class CreditCardPaymentFragment : BaseFragment list[0].checked = true } mViewBinding.btnCreditCardPaymentRemove.visibility = View.GONE + isShowDeleteBtn = false mViewBinding.btnMakePaymentCreditCard.visibility = View.VISIBLE } mViewBinding.apply { @@ -341,10 +358,7 @@ class CreditCardPaymentFragment : BaseFragment mViewBinding.apply { when (v!!) { - btnCreditCardPaymentAdd -> { - val intent = Intent(mContext, AddCreditCardPaymentActivity::class.java) - launchActivity(mActivity!!, mActivityResultLauncher, intent) - } + btnCreditCardPaymentAdd -> goAddCard() btnCreditCardPaymentRemove -> getHostActivity(PaymentMethodActivity::class.java)?.removePaymentMethodID( ConstantInt.Type1 diff --git a/app/src/main/java/com/abbidot/tracker/vm/AppSetViewModel.kt b/app/src/main/java/com/abbidot/tracker/vm/AppSetViewModel.kt index d73da58..4390574 100644 --- a/app/src/main/java/com/abbidot/tracker/vm/AppSetViewModel.kt +++ b/app/src/main/java/com/abbidot/tracker/vm/AppSetViewModel.kt @@ -9,6 +9,7 @@ import com.abbidot.baselibrary.util.AppUtils import com.abbidot.baselibrary.util.MMKVUtil import com.abbidot.tracker.bean.NotificationBean import com.abbidot.tracker.retrofit2.NetworkApi +import com.hjq.toast.Toaster import kotlinx.coroutines.launch import java.util.UUID diff --git a/app/src/main/res/layout/activity_add_credit_card_payment.xml b/app/src/main/res/layout/activity_add_credit_card_payment.xml index 95b7793..16d8b8b 100644 --- a/app/src/main/res/layout/activity_add_credit_card_payment.xml +++ b/app/src/main/res/layout/activity_add_credit_card_payment.xml @@ -14,6 +14,7 @@ + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 90e02f5..341d523 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -899,11 +899,11 @@ subscription_terms_conditions_de.html Copyright © %d ABBIDOT. Alle Rechte vorbehalten Sitzung abgelaufen. Bitte erneut anmelden - Zahlungsmethode entfernen Möchten Sie diese Zahlungsmethode wirklich entfernen? Bitte deaktivieren Sie die automatische Verlängerung, bevor Sie Ihre Zahlungsmethode entfernen. Automatische Verlängerung ist aktiviert Entfernen Deaktivieren & entfernen + Nicht autorisierte App. Von offizieller Quelle laden \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 4c6fcb8..d96ec00 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -906,4 +906,5 @@ Renouvellement automatique activé Supprimer Désactiver et supprimer + App non autorisée. Téléchargez depuis une source officielle \ No newline at end of file diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index a23da32..3a99836 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -895,4 +895,5 @@ Rinnovo: $%s/%s anni su %s Rinnovo: $%s/%s mesi su %s La sessione di accesso è scaduta. Accedi di nuovo + App non autorizzata. Scarica da una fonte ufficiale \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2403931..98ce66f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -999,5 +999,5 @@ Auto-Renewal Is On Remove Turn Off & Remove - 非法APP,请从正规渠道下载安装 + Unauthorized app. Download from official sources \ No newline at end of file diff --git a/baselibrary/src/main/java/com/abbidot/baselibrary/network/exception/ErrorCode.kt b/baselibrary/src/main/java/com/abbidot/baselibrary/network/exception/ErrorCode.kt index b2a05b5..30d74d9 100644 --- a/baselibrary/src/main/java/com/abbidot/baselibrary/network/exception/ErrorCode.kt +++ b/baselibrary/src/main/java/com/abbidot/baselibrary/network/exception/ErrorCode.kt @@ -19,6 +19,7 @@ import androidx.annotation.IntDef ErrorCode.NO_SHARE_MYSELF, ErrorCode.DEVICE_HAS_BOUND, ErrorCode.WX_NO_EXIST, + ErrorCode.ILLEGAL_APP_PACKAGE, ErrorCode.PHONE_NO_REGISTER, ErrorCode.PHONE_HAS_BIND, ErrorCode.DEVICE_HAS_BIND, @@ -72,13 +73,19 @@ annotation class ErrorCode { //515 设备未存在 const val DEVICE_NOT_EXIST = 515 + //519 手机号未注册 const val PHONE_NO_REGISTER = 519 + //520 手机号已绑定 const val PHONE_HAS_BIND = 520 + //微信绑定不存在 const val WX_NO_EXIST = 521 + //非法APP包,检验签名失败 + const val ILLEGAL_APP_PACKAGE = 524 + //信用卡支付成功 const val CREDIT_CARD_PAY_SUCCESS = 1