1.修复支付成功后,不点“Activy”按钮,杀掉APP,重新进入,无法重新进入激活流程且无法重新绑定bug
2.增加dfu过程中不会自动熄屏
This commit is contained in:
@@ -28,9 +28,9 @@ android {
|
|||||||
applicationId "com.abbidot.tracker"
|
applicationId "com.abbidot.tracker"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 2104
|
versionCode 2105
|
||||||
// versionName "2.1.4"
|
// versionName "2.1.5"
|
||||||
versionName "2.1.4-Beta1"
|
versionName "2.1.5-Beta1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -66,13 +66,6 @@ class PaymentSuccessActivity :
|
|||||||
// if (it.rechargeType == ConstantInt.Type0) {
|
// if (it.rechargeType == ConstantInt.Type0) {
|
||||||
// btnPaymentSuccessContinue.setText(R.string.txt_continue)
|
// btnPaymentSuccessContinue.setText(R.string.txt_continue)
|
||||||
// }
|
// }
|
||||||
if (it.rechargeType == ConstantInt.Type0 || it.rechargeType == ConstantInt.Type1) {
|
|
||||||
btnPaymentSuccessContinue.isEnabled = false
|
|
||||||
//刷新设备绑定
|
|
||||||
mAddTrackerViewModel.updatePayDeviceState(
|
|
||||||
this@PaymentSuccessActivity, it.deviceId
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
tvPaymentSuccessDeviceId.text = it.deviceOutId
|
tvPaymentSuccessDeviceId.text = it.deviceOutId
|
||||||
tvPaymentSuccessExpiresOnDate.text = Utils.stringToDate(
|
tvPaymentSuccessExpiresOnDate.text = Utils.stringToDate(
|
||||||
@@ -157,9 +150,16 @@ class PaymentSuccessActivity :
|
|||||||
mAddTrackerViewModel.mUpdatePayDeviceStateLiveData.observe(this) {
|
mAddTrackerViewModel.mUpdatePayDeviceStateLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
mViewBinding.btnPaymentSuccessContinue.isEnabled = true
|
|
||||||
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
|
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
|
||||||
XEventBus.post(EventName.RefreshDevice)
|
XEventBus.post(EventName.RefreshDevice)
|
||||||
|
if (TextUtils.isEmpty(mMac)) {
|
||||||
|
XEventBus.post(EventName.PayBack)
|
||||||
|
finish()
|
||||||
|
} else SRBleUtil.instance.getConnectMacDevice(mMac)?.let { ble ->
|
||||||
|
SRBleUtil.instance.writeData(
|
||||||
|
ble.bleDevice, SRBleCmdUtil.instance.setWorkingStatus()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
@@ -285,6 +285,22 @@ class PaymentSuccessActivity :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun payContinue() {
|
||||||
|
mPayResult?.apply {
|
||||||
|
if (rechargeType == ConstantInt.Type0 || rechargeType == ConstantInt.Type1) {
|
||||||
|
mViewBinding.btnPaymentSuccessContinue.isEnabled = false
|
||||||
|
//刷新设备绑定
|
||||||
|
mAddTrackerViewModel.updatePayDeviceState(this@PaymentSuccessActivity, deviceId)
|
||||||
|
} else if (TextUtils.isEmpty(mMac)) {
|
||||||
|
XEventBus.post(EventName.PayBack)
|
||||||
|
finish()
|
||||||
|
} else SRBleUtil.instance.getConnectMacDevice(mMac)?.let {
|
||||||
|
setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type0)
|
||||||
|
SRBleUtil.instance.writeData(it.bleDevice, SRBleCmdUtil.instance.setWorkingStatus())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
@@ -292,19 +308,7 @@ class PaymentSuccessActivity :
|
|||||||
ilPaymentSuccessBluetoothTips.trbBleConnectState.text.toString()
|
ilPaymentSuccessBluetoothTips.trbBleConnectState.text.toString()
|
||||||
)
|
)
|
||||||
|
|
||||||
btnPaymentSuccessContinue -> {
|
btnPaymentSuccessContinue -> payContinue()
|
||||||
if (TextUtils.isEmpty(mMac)) {
|
|
||||||
XEventBus.post(EventName.PayBack)
|
|
||||||
finish()
|
|
||||||
} else SRBleUtil.instance.getConnectMacDevice(mMac)?.let {
|
|
||||||
setButtonEnabled(
|
|
||||||
mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type0
|
|
||||||
)
|
|
||||||
SRBleUtil.instance.writeData(
|
|
||||||
it.bleDevice, SRBleCmdUtil.instance.setWorkingStatus()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.content.Intent
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.WindowManager
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import com.abbidot.baselibrary.constant.ConState
|
import com.abbidot.baselibrary.constant.ConState
|
||||||
import com.abbidot.baselibrary.constant.EventName
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
@@ -342,8 +343,10 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
} else if (progress == mDeviceDFUViewModel.mDFUFailCode) {
|
} else if (progress == mDeviceDFUViewModel.mDFUFailCode) {
|
||||||
// mTrackerDFUStateDialog?.dismiss()
|
// mTrackerDFUStateDialog?.dismiss()
|
||||||
|
dfuEnd()
|
||||||
mDFUNewDialogDialog?.setDFUFail {
|
mDFUNewDialogDialog?.setDFUFail {
|
||||||
mFirmwareBean?.apply {
|
mFirmwareBean?.apply {
|
||||||
|
dfuStart()
|
||||||
mDownLoadFileViewModel.downLoadFile(
|
mDownLoadFileViewModel.downLoadFile(
|
||||||
mContext!!, fileName, firmwareUrl
|
mContext!!, fileName, firmwareUrl
|
||||||
)
|
)
|
||||||
@@ -738,6 +741,7 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
if (trackBleDevice.conState == ConState.CONNECTED) {
|
if (trackBleDevice.conState == ConState.CONNECTED) {
|
||||||
if (isDFUCallback) {
|
if (isDFUCallback) {
|
||||||
|
dfuEnd()
|
||||||
showToast(R.string.txt_upgrade_success)
|
showToast(R.string.txt_upgrade_success)
|
||||||
}
|
}
|
||||||
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
mHomePetTrackStateAdapter.notifyItemChanged(4)
|
||||||
@@ -876,6 +880,7 @@ class HomeTrackFragment :
|
|||||||
fun firmwareCheckUpdate() {
|
fun firmwareCheckUpdate() {
|
||||||
getBleTrackDeviceBean()?.let {
|
getBleTrackDeviceBean()?.let {
|
||||||
if (BleManager.getInstance().isConnected(it.bleDevice)) {
|
if (BleManager.getInstance().isConnected(it.bleDevice)) {
|
||||||
|
dfuStart()
|
||||||
setFirmwareData(mFirmwareBean)
|
setFirmwareData(mFirmwareBean)
|
||||||
} else {
|
} else {
|
||||||
showToast(R.string.tracker_manage_set_ble_unconnect)
|
showToast(R.string.tracker_manage_set_ble_unconnect)
|
||||||
@@ -883,6 +888,26 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun dfuStart() {
|
||||||
|
getHomeV2Activity()?.apply {
|
||||||
|
//保持屏幕常亮
|
||||||
|
window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
DfuServiceListenerHelper.registerProgressListener(
|
||||||
|
mContext, mDeviceDFUViewModel.mDfuProgressListener
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun dfuEnd() {
|
||||||
|
getHomeV2Activity()?.apply {
|
||||||
|
//清除屏幕常亮
|
||||||
|
window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
DfuServiceListenerHelper.unregisterProgressListener(
|
||||||
|
mContext, mDeviceDFUViewModel.mDfuProgressListener
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手动连接/断开设备
|
* 手动连接/断开设备
|
||||||
*/
|
*/
|
||||||
@@ -986,25 +1011,6 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
|
||||||
super.onResume()
|
|
||||||
getHomeV2Activity()?.apply {
|
|
||||||
DfuServiceListenerHelper.registerProgressListener(
|
|
||||||
mContext, mDeviceDFUViewModel.mDfuProgressListener
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onPause() {
|
|
||||||
super.onPause()
|
|
||||||
getHomeV2Activity()?.apply {
|
|
||||||
DfuServiceListenerHelper.unregisterProgressListener(
|
|
||||||
mContext, mDeviceDFUViewModel.mDfuProgressListener
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
|
|||||||
Reference in New Issue
Block a user