1.修复添加wifi zone提示页,提示靠近设备的弹窗,有时会弹出了两次bug

2.限制用户名空格和14个字母,7个中文输入
3.限制围栏名和wifi名空格和14个字母,7个中文输入
This commit is contained in:
yezhiqiu
2026-05-29 11:13:58 +08:00
parent fde637793e
commit c0ab984a83
10 changed files with 63 additions and 15 deletions

View File

@@ -4,10 +4,10 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2026-04-20T07:03:55.586316Z"> <DropdownSelection timestamp="2026-05-28T06:43:50.390331300Z">
<Target type="DEFAULT_BOOT"> <Target type="DEFAULT_BOOT">
<handle> <handle>
<DeviceId pluginId="PhysicalDevice" identifier="serial=R5CT80BHT3Y" /> <DeviceId pluginId="PhysicalDevice" identifier="serial=GBG5T19625003301" />
</handle> </handle>
</Target> </Target>
</DropdownSelection> </DropdownSelection>

View File

@@ -330,8 +330,13 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
} }
//刷新下邀请家人数据 //刷新下邀请家人数据
XEventBus.observe(this, EventName.RefreshHomeList) { XEventBus.observe(this, EventName.RefreshHomeList) {
getPet(false)?.let {
//套餐没有过期
if (it.availableOrder == ConstantInt.Type1) {
mDataViewModel.getHomeBindPetList(this) mDataViewModel.getHomeBindPetList(this)
} }
}
}
//删除宠物 //删除宠物
XEventBus.observe(this, EventName.DeletePet) { XEventBus.observe(this, EventName.DeletePet) {
mSelectPetPosition = 0 mSelectPetPosition = 0

View File

@@ -3,6 +3,7 @@ package com.abbidot.tracker.ui.activity.account
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.widget.doAfterTextChanged
import com.abbidot.baselibrary.constant.EventName import com.abbidot.baselibrary.constant.EventName
import com.abbidot.baselibrary.constant.MMKVKey import com.abbidot.baselibrary.constant.MMKVKey
import com.abbidot.baselibrary.eventbus.XEventBus import com.abbidot.baselibrary.eventbus.XEventBus
@@ -11,6 +12,7 @@ import com.abbidot.tracker.R
import com.abbidot.tracker.base.BaseActivity import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.constant.GetResultCallback import com.abbidot.tracker.constant.GetResultCallback
import com.abbidot.tracker.databinding.ActivityChangeNameBinding import com.abbidot.tracker.databinding.ActivityChangeNameBinding
import com.abbidot.tracker.util.Util.Companion.limitLetterChinese
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.vm.UserProfileViewModel import com.abbidot.tracker.vm.UserProfileViewModel
@@ -27,12 +29,20 @@ class ChangeNameActivity :
val username = MMKVUtil.getString(MMKVKey.UserName) val username = MMKVUtil.getString(MMKVKey.UserName)
mViewBinding.apply { mViewBinding.apply {
ilChangeNameNameLayout.let { ilChangeNameNameLayout.let { edit ->
it.etInputContent.setText(username) edit.etInputContent.setText(username)
it.tvInputNameTitle.text = getString(R.string.register_txt_name) edit.tvInputNameTitle.text = getString(R.string.register_txt_name)
ViewUtil.instance.setInputViewErrorHideClick( ViewUtil.instance.setInputViewErrorHideClick(
mContext, it.rlEtInputLayout, tvChangeNameNameErrorTip, it.etInputContent mContext, edit.rlEtInputLayout, tvChangeNameNameErrorTip, edit.etInputContent
) )
edit.etInputContent.doAfterTextChanged {
it?.let { s ->
val text = s.toString().limitLetterChinese(14)
if (text != s.toString()) {
s.replace(0, s.length, text)
}
}
}
} }
setOnClickListenerViews(btnChangeNameSave) setOnClickListenerViews(btnChangeNameSave)

View File

@@ -7,6 +7,7 @@ import android.view.MotionEvent
import android.view.View import android.view.View
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.commit import androidx.fragment.app.commit
import com.abbidot.baselibrary.constant.EventName import com.abbidot.baselibrary.constant.EventName
@@ -31,6 +32,7 @@ import com.abbidot.tracker.constant.GetResultCallback
import com.abbidot.tracker.databinding.ActivityAddEditFencesZoneBinding import com.abbidot.tracker.databinding.ActivityAddEditFencesZoneBinding
import com.abbidot.tracker.ui.common.map.FencesAddEditMapCommon import com.abbidot.tracker.ui.common.map.FencesAddEditMapCommon
import com.abbidot.tracker.util.Util import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.Util.Companion.limitLetterChinese
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
import com.abbidot.tracker.util.bluetooth.SRBleUtil import com.abbidot.tracker.util.bluetooth.SRBleUtil
@@ -113,6 +115,14 @@ open class AddAndEditFencesZoneBaseActivity :
ivFencesZoneRefreshBtn, mShowCenterLocationType ivFencesZoneRefreshBtn, mShowCenterLocationType
) )
ilFencesZoneNameInput.tvInputNameTitle.text = getString(R.string.txt_fence_name) ilFencesZoneNameInput.tvInputNameTitle.text = getString(R.string.txt_fence_name)
ilFencesZoneNameInput.etInputContent.doAfterTextChanged {
it?.let { s ->
val text = s.toString().limitLetterChinese(16)
if (text != s.toString()) {
s.replace(0, s.length, text)
}
}
}
fencesZoneCircleView.setOnCircleViewScaleClickListener(this@AddAndEditFencesZoneBaseActivity) fencesZoneCircleView.setOnCircleViewScaleClickListener(this@AddAndEditFencesZoneBaseActivity)
fencesZoneRectView.setOnRectViewRotateScaleClickListener(this@AddAndEditFencesZoneBaseActivity) fencesZoneRectView.setOnRectViewRotateScaleClickListener(this@AddAndEditFencesZoneBaseActivity)
fencesZonePolygonView.setOnPolygonViewPointPullClickListener(this@AddAndEditFencesZoneBaseActivity) fencesZonePolygonView.setOnPolygonViewPointPullClickListener(this@AddAndEditFencesZoneBaseActivity)

View File

@@ -7,6 +7,7 @@ import android.view.Gravity
import android.view.View import android.view.View
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.widget.doAfterTextChanged
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.commit import androidx.fragment.app.commit
import com.abbidot.baselibrary.constant.ConState import com.abbidot.baselibrary.constant.ConState
@@ -33,6 +34,7 @@ import com.abbidot.tracker.databinding.ActivityEditPowerZoneBinding
import com.abbidot.tracker.ui.activity.HomeV2Activity import com.abbidot.tracker.ui.activity.HomeV2Activity
import com.abbidot.tracker.ui.common.map.EditWifiZoneMapCommon import com.abbidot.tracker.ui.common.map.EditWifiZoneMapCommon
import com.abbidot.tracker.util.Util import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.Util.Companion.limitLetterChinese
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
import com.abbidot.tracker.util.bluetooth.SRBleUtil import com.abbidot.tracker.util.bluetooth.SRBleUtil
@@ -96,6 +98,14 @@ class EditWifiPowerZoneActivity :
mViewBinding.apply { mViewBinding.apply {
ilWifiNameInputLayout.tvInputNameTitle.text = getString(R.string.txt_zone_name) ilWifiNameInputLayout.tvInputNameTitle.text = getString(R.string.txt_zone_name)
ilWifiNameInputLayout.etInputContent.doAfterTextChanged {
it?.let { s ->
val text = s.toString().limitLetterChinese(16)
if (text != s.toString()) {
s.replace(0, s.length, text)
}
}
}
// ViewUtil.instance.setMapSwitchLocationButtonImage( // ViewUtil.instance.setMapSwitchLocationButtonImage(
// ivEditWifiZoneRefreshBtn, mShowCenterLocationType // ivEditWifiZoneRefreshBtn, mShowCenterLocationType
// ) // )
@@ -205,6 +215,7 @@ class EditWifiPowerZoneActivity :
XEventBus.post(EventName.RefreshWiFiZone) XEventBus.post(EventName.RefreshWiFiZone)
showToast(R.string.txt_change_successful, true, gravity = Gravity.CENTER) showToast(R.string.txt_change_successful, true, gravity = Gravity.CENTER)
} }
override fun onRequestError(exceptionCode: String?) { override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode) super.onRequestError(exceptionCode)
isBlockedClick = false isBlockedClick = false
@@ -218,6 +229,7 @@ class EditWifiPowerZoneActivity :
XEventBus.post(EventName.DeleteWiFiZone) XEventBus.post(EventName.DeleteWiFiZone)
showToast(R.string.txt_delete_success, true, gravity = Gravity.CENTER) showToast(R.string.txt_delete_success, true, gravity = Gravity.CENTER)
} }
override fun onRequestError(exceptionCode: String?) { override fun onRequestError(exceptionCode: String?) {
super.onRequestError(exceptionCode) super.onRequestError(exceptionCode)
isBlockedClick = false isBlockedClick = false

View File

@@ -845,14 +845,14 @@ abstract class BaseGoogleMapFragment :
// 1. 降噪 // 1. 降噪
val filterPoints = filterNoisePoint(newLatLngList) val filterPoints = filterNoisePoint(newLatLngList)
// 2. RDP平滑抽稀 // 2. RDP平滑抽稀
val smoothPoints = rdpSmooth(filterPoints, epsilon = 1.0) val smoothPoints = rdpSmooth(filterPoints, epsilon = 0.5)
// 3. 插值加密线条 // 3. 插值加密线条
val finalPoints = latLngInterpolate(smoothPoints, step = 2) val finalPoints = latLngInterpolate(smoothPoints, step = 2)
//先黄黑线 //先黄黑线
getPolylineOptions(8f, R.color.line_stroke_color).let { getPolylineOptions(8f, R.color.line_stroke_color).let {
it.geodesic(true) it.geodesic(true)
it.addAll(newLatLngList) it.addAll(finalPoints)
googleMap.addPolyline(it).apply { googleMap.addPolyline(it).apply {
startCap = RoundCap() startCap = RoundCap()
endCap = RoundCap() endCap = RoundCap()

View File

@@ -873,8 +873,8 @@ class Util {
/** /**
* 限制16个字母或8个中文,限制空格输入 * 限制limitLetterLength个字母或limitLetterLength/2个中文,限制空格输入
* 截断到最大16单位 * 截断到最大limitLetterLength单位
* @param limitLetterLength 限制字母的个数 * @param limitLetterLength 限制字母的个数
*/ */
fun String.limitLetterChinese(limitLetterLength: Int): String { fun String.limitLetterChinese(limitLetterLength: Int): String {

View File

@@ -387,7 +387,7 @@ class ViewUtil private constructor() {
) { ) {
viewGroup.apply { viewGroup.apply {
editText.addTextChangedListener { editText.addTextChangedListener {
if (errorView.visibility == View.VISIBLE) { if (errorView.isVisible) {
background = ContextCompat.getDrawable( background = ContextCompat.getDrawable(
context, R.drawable.shape8_gray_border_white_bg context, R.drawable.shape8_gray_border_white_bg
) )
@@ -658,7 +658,10 @@ class ViewUtil private constructor() {
super.onError(request, throwable) super.onError(request, throwable)
LogUtil.e("${fileName}:imageLoadUrl onError:${throwable.message}") LogUtil.e("${fileName}:imageLoadUrl onError:${throwable.message}")
file?.let { file?.let {
if (it.exists()) it.delete() if (it.exists()) {
it.delete()
imageLoadUrl(context, imageView, url, errorImageResId)
}
} }
} }
@@ -948,7 +951,11 @@ class ViewUtil private constructor() {
}) })
} }
return SelectMapTypeDialog( return SelectMapTypeDialog(
context, mapTypeAdapter, fenceCheckedListener, dashedCheckedListener,showAllPetCheckedListener context,
mapTypeAdapter,
fenceCheckedListener,
dashedCheckedListener,
showAllPetCheckedListener
) )
} }

View File

@@ -504,7 +504,7 @@ class SRBleUtil private constructor() {
if (BleManager.getInstance().scanSate == BleScanState.STATE_SCANNING) { if (BleManager.getInstance().scanSate == BleScanState.STATE_SCANNING) {
isScanInterrupt = true isScanInterrupt = true
XEventBus.post( XEventBus.post(
EventName.ActionConDeviceState, ConState.DEVICE_NOT_FOUND EventName.ActionConDeviceState, ConState.CANCEL_SCAN_DEVICE
) )
if (TextUtils.isEmpty(log)) LogUtil.e("正在扫描设备,取消蓝牙扫描") if (TextUtils.isEmpty(log)) LogUtil.e("正在扫描设备,取消蓝牙扫描")
else LogUtil.e(log) else LogUtil.e(log)

View File

@@ -15,6 +15,7 @@ import androidx.annotation.IntDef
ConState.CONNECTION_FAIL, ConState.CONNECTION_FAIL,
ConState.BLUETOOTH_ON, ConState.BLUETOOTH_ON,
ConState.BLUETOOTH_OFF, ConState.BLUETOOTH_OFF,
ConState.CANCEL_SCAN_DEVICE,
ConState.DEVICE_NOT_FOUND ConState.DEVICE_NOT_FOUND
) )
@Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE)
@@ -35,6 +36,9 @@ annotation class ConState {
//没有找到设备 //没有找到设备
const val DEVICE_NOT_FOUND = 4 const val DEVICE_NOT_FOUND = 4
//取消扫描蓝牙设备
const val CANCEL_SCAN_DEVICE = 8
//未连接,连接失败 //未连接,连接失败
const val CONNECTION_FAIL = 5 const val CONNECTION_FAIL = 5