1.修复位置滞后时间与上报时间重叠问题

2.宠物名称限制字数-限制为16个字符长度(中文为8个字)
3.优化添加和编辑wifi,按钮操作过程中禁止点击其他按钮
4.优化运动超过运动目标后,显示指定的百分比,取消最大值为100%
5.优化宠物和手机位置直线虚线默认显示改为默认不显示
6.修复打开邀请家人页面,切换到其它应用再切换回来,左上角返回按钮错位问题
This commit is contained in:
yezhiqiu
2026-05-11 09:53:49 +08:00
parent 5be446af72
commit 0654ec87bc
12 changed files with 83 additions and 15 deletions

View File

@@ -28,9 +28,9 @@ android {
applicationId "com.abbidot.tracker"
minSdkVersion 23
targetSdkVersion 35
versionCode 2204
// versionName "2.2.4"
versionName "2.2.4-Beta1"
versionCode 2205
// versionName "2.2.5"
versionName "2.2.5-Beta1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -61,7 +61,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
private var mLoadingDialog: QMUITipDialog? = null
//默认删除去掉titleTopBar底部间隔下划线
var mDeleteBottomDivider: Boolean = true
private var mDeleteBottomDivider: Boolean = true
//Activity是否在前台显示运行
var isFrontRunning = false
@@ -168,6 +168,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
override fun onPause() {
super.onPause()
isFrontRunning = false
//键盘隐藏恢复默认状态
mTranslateView?.apply {
scrollTo(0, 0)

View File

@@ -36,7 +36,7 @@ class SelectMapTypeDialog(
)
cbDialogMapFencesSwitch.isChecked = Util.getShowFenceSp()
cbDialogMapDashedLineSwitch.isChecked =
MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, true)
MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, false)
cbDialogMapFencesSwitch.setOnCheckedChangeListener(mFenceCheckedChangeListener)
cbDialogMapDashedLineSwitch.setOnCheckedChangeListener(mDashedCheckedChangeListener)
}

View File

@@ -174,9 +174,7 @@ class MoreActivityActivity :
tvMoreActivityGoal.text =
String.format(getString(R.string.txt_min_unit_lower), "$activeMin/$goal")
var goalPercent = activeMin / goal.toFloat()
if (goalPercent > 1) {
goalPercent = 1f
}
goalPercent = Utils.formatDecimal(goalPercent, 2).toFloat()
goalPercent *= 100
ViewUtil.instance.viewNumberValueAnimator(
tvMoreActivityGoalPercent,

View File

@@ -69,6 +69,9 @@ class EditWifiPowerZoneActivity :
//禁用模式,无法点击的情况
private var isDisabledMode = false
//冻结点击
private var isBlockedClick = false
override fun getTopBar() = mViewBinding.editPowerZoneTopBar.titleTopBar
@SuppressLint("ClickableViewAccessibility")
@@ -129,6 +132,11 @@ class EditWifiPowerZoneActivity :
}
}
override fun leftBackOnClick() {
if (isBlockedClick) return
super.leftBackOnClick()
}
override fun liveDataObserve() {
//接收蓝牙返回数据
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
@@ -183,6 +191,11 @@ class EditWifiPowerZoneActivity :
showToast(R.string.txt_add_successful, true, gravity = Gravity.CENTER)
}
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
isBlockedClick = false
}
})
}
@@ -192,6 +205,10 @@ class EditWifiPowerZoneActivity :
XEventBus.post(EventName.RefreshWiFiZone)
showToast(R.string.txt_change_successful, true, gravity = Gravity.CENTER)
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
isBlockedClick = false
}
})
}
@@ -201,6 +218,10 @@ class EditWifiPowerZoneActivity :
XEventBus.post(EventName.DeleteWiFiZone)
showToast(R.string.txt_delete_success, true, gravity = Gravity.CENTER)
}
override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode)
isBlockedClick = false
}
})
}
}
@@ -336,10 +357,12 @@ class EditWifiPowerZoneActivity :
}
private fun saveWiFiZone() {
if (isBlockedClick) return
val name = mViewBinding.ilWifiNameInputLayout.etInputContent.text.toString()
if (!TextUtils.isEmpty(name)) {
mWiFiZoneBean.wifiZoneName = name
}
isBlockedClick = true
if (isEdit) {
mWiFiZoneViewModel.updateWifiZone(this, mWiFiZoneBean)
} else {
@@ -348,6 +371,7 @@ class EditWifiPowerZoneActivity :
}
private fun deleteWifiZone() {
if (isBlockedClick) return
if (isDisabledMode) return
if (null == mBleTrackDeviceBean) {
showToast(R.string.tracker_manage_set_ble_unconnect, gravity = Gravity.CENTER)
@@ -357,6 +381,7 @@ class EditWifiPowerZoneActivity :
mContext, R.string.txt_delete_tips, object : BaseDialog.OnDialogOkListener {
override fun onOkClick(dialog: BaseDialog<*>) {
dialog.dismiss()
isBlockedClick = true
sendDeleteWiFiZoneCmd()
}
}, okTextResId = R.string.txt_sure
@@ -390,11 +415,13 @@ class EditWifiPowerZoneActivity :
showLoading(false)
mRightImageButton?.isEnabled = true
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
isBlockedClick = false
showToast(R.string.txt_duplicate_wifi_not, gravity = Gravity.CENTER)
} else {
mRightImageButton?.isEnabled = true
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
showLoading(false)
isBlockedClick = false
showToast("Fail", gravity = Gravity.CENTER)
LogUtil.e("设备wifi指令失败")
}
@@ -498,6 +525,7 @@ class EditWifiPowerZoneActivity :
btnSaveWifiZone -> saveWiFiZone()
mRightImageButton -> deleteWifiZone()
btnCancelWifiZone -> {
if (isBlockedClick) return
if (isFirstBind) {
finish()
} else {

View File

@@ -141,7 +141,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
}
isShowFence = Util.getShowFenceSp()
isShowDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, true)
isShowDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, false)
mViewBinding.apply {
ViewUtil.instance.viewRotationAnimator(

View File

@@ -18,6 +18,7 @@ import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.bean.DataBean
import com.abbidot.tracker.bean.FamilyBean
import com.abbidot.tracker.bean.PetBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.constant.ConstantString
import com.abbidot.tracker.constant.GetResultCallback
import com.abbidot.tracker.databinding.ActivityInviteFamilyBinding
@@ -87,7 +88,7 @@ class InviteFamilyActivity :
setOnClickListenerViews(btnInviteFamilyInvite)
}
setListenKeyboardChange(210)
setListenKeyboardChange(210,methodType = ConstantInt.Type1)
}
override fun liveDataObserve() {

View File

@@ -6,6 +6,7 @@ import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.widget.doAfterTextChanged
import coil.load
import com.abbidot.baselibrary.constant.EventName
import com.abbidot.baselibrary.constant.ResultCode
@@ -30,6 +31,7 @@ import com.abbidot.tracker.dialog.SelectPetLabelDialog
import com.abbidot.tracker.dialog.SetPetWeightDialog
import com.abbidot.tracker.dialog.ShowCalenderDialog
import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.Util.Companion.limitLetterChinese
import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.vm.PetInfoViewModel
import com.abbidot.tracker.vm.TakePhotoAndCompressViewModel
@@ -86,6 +88,14 @@ class PetProfileActivity :
mViewBinding.apply {
root.setBackgroundResource(R.color.white)
ilPetProfileNameLayout.etInputContent.doAfterTextChanged {
it?.let { s ->
val text = s.toString().limitLetterChinese(16)
if (text != s.toString()) {
s.replace(0, s.length, text)
}
}
}
ilPetProfileType.let {
it.tvInputNameTitle.text = getString(R.string.txt_type)
ViewUtil.instance.setEditTextDropSelectState(it.etInputContent)

View File

@@ -224,9 +224,7 @@ class ActivityV2Fragment :
tvHomeActivityV2Goal.text =
String.format(getString(R.string.txt_min_unit_lower), "$activeMin/$goal")
var goalPercent = activeMin / goal.toFloat()
if (goalPercent > 1) {
goalPercent = 1f
}
goalPercent = Utils.formatDecimal(goalPercent, 2).toFloat()
goalPercent *= 100
ViewUtil.instance.viewNumberValueAnimator(
tvHomeActivityV2GoalPercent,

View File

@@ -126,7 +126,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
}
isShowFence = Util.getShowFenceSp()
isShowDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, true)
isShowDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, false)
mViewBinding.apply {
getHomeV2Activity()?.edgeToEdgeAdapterBars(
@@ -215,7 +215,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
}
val showFence = Util.getShowFenceSp()
val showDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, true)
val showDashed = MMKVUtil.getBoolean(MMKVKey.ShowDashedLine, false)
//检测直播页面有没有修改围栏显示
if (isShowFence != showFence) {
if (null == mSelectMapTypeDialog) {

View File

@@ -870,6 +870,36 @@ class Util {
clipboard.setPrimaryClip(clip)
}
/**
* 限制16个字母或8个中文
* 截断到最大16单位
* @param limitLetterLength 限制字母的个数
*/
fun String.limitLetterChinese(limitLetterLength: Int): String {
val sb = StringBuilder()
for (c in this) {
val temp = sb.toString() + c
if (temp.calcLengthUnit() > limitLetterLength) break
sb.append(c)
}
return sb.toString()
}
private fun CharSequence.calcLengthUnit(): Int {
var count = 0
for (c in this) {
count += if (c.isChinese()) 2 else 1
}
return count
}
// 判断是否是中文
private fun Char.isChinese(): Boolean {
return this.code in 0x4E00..0x9FA5
}
}
/**

View File

@@ -34,6 +34,8 @@
android:id="@+id/tv_pet_location_update_time_format"
style="@style/my_TextView_style_v2"
android:layout_alignBaseline="@id/tv_pet_location_update_time"
android:layout_marginStart="@dimen/dp_4"
android:layout_toEndOf="@id/tv_pet_location_update_time"
android:gravity="start"
android:textColor="@color/orange_color5"
android:textSize="@dimen/textSize10"