1.修复防篡改误报的问题并优化没有网络和服务器挂了的体验
2.支付管理编辑信用卡页面增加删除支付信息 3.优化添加信用卡页面点击空白处可隐藏键盘
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -338,13 +338,15 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
/**
|
||||
* 按钮开启/禁用点击
|
||||
*/
|
||||
fun setButtonEnabled(v: View, enabled: Int = ConstantInt.SpecialType) {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置title标题 resIdTitle
|
||||
@@ -422,7 +424,10 @@ abstract class BaseActivity<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(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<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
||||
/**
|
||||
* 监听软键盘隐藏
|
||||
*/
|
||||
open fun listenHideKeyboard() {}
|
||||
// open fun listenHideKeyboard() {}
|
||||
|
||||
/******************************点击屏幕页面隐藏软键盘start**************************************/
|
||||
// override fun dispatchTouchEvent(ev: MotionEvent): Boolean {
|
||||
|
||||
@@ -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>(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>(ActivityHomeV2Binding
|
||||
|
||||
checkPermissions()
|
||||
|
||||
//首次启动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>(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>(ActivityHomeV2Binding
|
||||
}
|
||||
mAppSetViewModel.mCheckPackageStatusLiveData.observe(this) {
|
||||
if (null == it) {
|
||||
showToast(R.string.txt_no_legal_app, true)
|
||||
} else {
|
||||
if (null == it.getOrNull()) {
|
||||
showToast(R.string.txt_no_legal_app, true, Gravity.CENTER)
|
||||
showToast(R.string.txt_no_legal_app, false, 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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>(InputFilter.AllCaps()))
|
||||
it.etInputView2Content.filters = arrayOf<InputFilter>(InputFilter.AllCaps())
|
||||
it.etInputView2Content.onFocusChangeListener = this@AddCreditCardPaymentActivity
|
||||
showEditViewContent(it.etInputView2Content, mCreditCard!!.cardName)
|
||||
}
|
||||
@@ -127,13 +134,14 @@ class AddCreditCardPaymentActivity :
|
||||
ilAddCardNameOnCard.root,
|
||||
ilAddCardNumber.root,
|
||||
llAddCardCvcLayout,
|
||||
llAddCardMmDdLayout
|
||||
llAddCardMmDdLayout, tvAddCardExperienceBtn
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun liveDataObserve() {
|
||||
mSubscriptionPayViewModel.mSavePaymentMethodIDLiveData.observe(this) {
|
||||
mSubscriptionPayViewModel.apply {
|
||||
mSavePaymentMethodIDLiveData.observe(this@AddCreditCardPaymentActivity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
setResult(ResultCode.ResultCode_1, null)
|
||||
@@ -143,7 +151,35 @@ class AddCreditCardPaymentActivity :
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
setButtonEnabled(mViewBinding.btnSaveNewCreditCard, ConstantInt.Type1)
|
||||
}
|
||||
}, isShowNetCodeMsg = true)
|
||||
}, 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() {
|
||||
/**
|
||||
* 显示删除支付方式弹窗
|
||||
* @param haveAutoRenewal 是否有自动续费 1为有 0为无
|
||||
*/
|
||||
private fun showRemoveDialog(haveAutoRenewal: Int) {
|
||||
if (haveAutoRenewal == ConstantInt.Type1) {
|
||||
ViewUtil.instance.showDialog(
|
||||
mContext, R.string.txt_sure_delete_card, object : BaseDialog.OnDialogOkListener {
|
||||
this@AddCreditCardPaymentActivity,
|
||||
R.string.txt_remove_pay_method_tips2,
|
||||
object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
mCreditCard?.apply {
|
||||
// MyDatabase.creditCardDao().delete(this)
|
||||
}
|
||||
}
|
||||
dialog.dismiss()
|
||||
setResult(ResultCode.ResultCode_1, null)
|
||||
showToast(R.string.txt_delete_succe, isFinish = true)
|
||||
mSubscriptionPayViewModel.removePaymentMethodID(1)
|
||||
}
|
||||
}, 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ class CreditCardPaymentFragment : BaseFragment<FragmentCreditCardPaymentBinding>
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
// }
|
||||
//没有卡,显示无卡提示 不用去添加卡
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
//卡管理 不需要点击效果
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加卡
|
||||
*/
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
//卡管理 不需要点击效果
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
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<FragmentCreditCardPaymentBinding>
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
<androidx.core.widget.NestedScrollView
|
||||
style="@style/my_ScrollView_style"
|
||||
android:layout_weight="1"
|
||||
android:fillViewport="true"
|
||||
android:padding="@dimen/dp_16">
|
||||
|
||||
<RelativeLayout
|
||||
@@ -179,6 +180,13 @@
|
||||
android:textSize="@dimen/textSize14"
|
||||
android:visibility="gone"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tv_add_card_experience_btn"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/ll_add_card_accepted_cards"
|
||||
android:layout_alignParentBottom="true" />
|
||||
</RelativeLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
|
||||
@@ -899,11 +899,11 @@
|
||||
<string name="txt_subscription_terms_conditions_html">subscription_terms_conditions_de.html</string>
|
||||
<string name="system_txt_copyright">Copyright © %d ABBIDOT. Alle Rechte vorbehalten</string>
|
||||
<string name="txt_login_info_invalid">Sitzung abgelaufen. Bitte erneut anmelden</string>
|
||||
|
||||
<string name="txt_remove_pay_method">Zahlungsmethode entfernen</string>
|
||||
<string name="txt_remove_pay_method_tips1">Möchten Sie diese Zahlungsmethode wirklich entfernen?</string>
|
||||
<string name="txt_remove_pay_method_tips2">Bitte deaktivieren Sie die automatische Verlängerung, bevor Sie Ihre Zahlungsmethode entfernen.</string>
|
||||
<string name="txt_auto_renewal_on">Automatische Verlängerung ist aktiviert</string>
|
||||
<string name="txt_remove">Entfernen</string>
|
||||
<string name="txt_turn_off_remove">Deaktivieren & entfernen</string>
|
||||
<string name="txt_no_legal_app">Nicht autorisierte App. Von offizieller Quelle laden</string>
|
||||
</resources>
|
||||
@@ -906,4 +906,5 @@
|
||||
<string name="txt_auto_renewal_on">Renouvellement automatique activé</string>
|
||||
<string name="txt_remove">Supprimer</string>
|
||||
<string name="txt_turn_off_remove">Désactiver et supprimer</string>
|
||||
<string name="txt_no_legal_app">App non autorisée. Téléchargez depuis une source officielle</string>
|
||||
</resources>
|
||||
@@ -895,4 +895,5 @@
|
||||
<string name="txt_renewal_years">Rinnovo: $%s/%s anni su %s</string>
|
||||
<string name="txt_renewal_months">Rinnovo: $%s/%s mesi su %s</string>
|
||||
<string name="txt_login_info_invalid">La sessione di accesso è scaduta. Accedi di nuovo</string>
|
||||
<string name="txt_no_legal_app">App non autorizzata. Scarica da una fonte ufficiale</string>
|
||||
</resources>
|
||||
@@ -999,5 +999,5 @@
|
||||
<string name="txt_auto_renewal_on">Auto-Renewal Is On</string>
|
||||
<string name="txt_remove">Remove</string>
|
||||
<string name="txt_turn_off_remove">Turn Off & Remove</string>
|
||||
<string name="txt_no_legal_app">非法APP,请从正规渠道下载安装</string>
|
||||
<string name="txt_no_legal_app">Unauthorized app. Download from official sources</string>
|
||||
</resources>
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user