1.修复消息全部已读页面不更新bug

2.优化直播雷达开灯加载动画变大问题
3.led设置页面重新编写逻辑
4.蓝牙绑定指令增加上位机类型和绑定密钥
5.map页新增睡眠显示
6.信用卡页面,输入名字默认全大写
7.Wifi zone 内,地址显示为“Home · xxxxx”
8.优化雷达直播LED灯按钮禁用状态
This commit is contained in:
yezhiqiu
2026-03-30 10:48:32 +08:00
parent 00ae7df9c1
commit 00e4a33e19
22 changed files with 249 additions and 234 deletions

View File

@@ -28,9 +28,9 @@ android {
applicationId "com.abbidot.tracker" applicationId "com.abbidot.tracker"
minSdkVersion 23 minSdkVersion 23
targetSdkVersion 35 targetSdkVersion 35
versionCode 2111 versionCode 2112
// versionName "2.1.11" // versionName "2.1.12"
versionName "2.1.11-Beta1" versionName "2.1.12-Beta1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

View File

@@ -38,9 +38,11 @@ class NotificationV2Activity :
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener { setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
override fun onItemClick(itemView: View?, pos: Int) { override fun onItemClick(itemView: View?, pos: Int) {
val message = getItem(pos) val message = getItem(pos)
if (message.isRead == ConstantInt.Type0) {
mReadMessageId = message.messageId mReadMessageId = message.messageId
mNotificationsViewModel.setMessageIsRead(mReadMessageId) mNotificationsViewModel.setMessageIsRead(mReadMessageId)
} }
}
}) })
} }
mViewBinding.apply { mViewBinding.apply {
@@ -125,7 +127,7 @@ class NotificationV2Activity :
isRefresh = true isRefresh = true
} }
} }
if (isRefresh) mMessageAdapter.notifyItemChanged(0, list.size) if (isRefresh) mMessageAdapter.notifyItemRangeChanged(0, list.size)
} }
}) })
} }

View File

@@ -1,7 +1,5 @@
package com.abbidot.tracker.ui.activity.device.set package com.abbidot.tracker.ui.activity.device.set
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.Gravity import android.view.Gravity
import android.view.View import android.view.View
import androidx.activity.viewModels import androidx.activity.viewModels
@@ -10,12 +8,8 @@ import androidx.core.view.isGone
import com.abbidot.baselibrary.constant.ConState import com.abbidot.baselibrary.constant.ConState
import com.abbidot.baselibrary.constant.EventName import com.abbidot.baselibrary.constant.EventName
import com.abbidot.baselibrary.eventbus.XEventBus import com.abbidot.baselibrary.eventbus.XEventBus
import com.abbidot.baselibrary.list.BaseRecyclerAdapter
import com.abbidot.baselibrary.util.AppUtils
import com.abbidot.tracker.R import com.abbidot.tracker.R
import com.abbidot.tracker.adapter.LedLightColorAdapter
import com.abbidot.tracker.base.BaseActivity import com.abbidot.tracker.base.BaseActivity
import com.abbidot.tracker.base.BaseDialog
import com.abbidot.tracker.bean.BleTrackDeviceBean import com.abbidot.tracker.bean.BleTrackDeviceBean
import com.abbidot.tracker.bean.MapDeviceBean import com.abbidot.tracker.bean.MapDeviceBean
import com.abbidot.tracker.bean.PetBean import com.abbidot.tracker.bean.PetBean
@@ -48,16 +42,14 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
private var mPetBean: PetBean? = null private var mPetBean: PetBean? = null
private var mMapDeviceBean: MapDeviceBean? = null private var mMapDeviceBean: MapDeviceBean? = null
private var mOldMapDeviceBean: MapDeviceBean? = null
private var mBleTrackDeviceBean: BleTrackDeviceBean? = null
private lateinit var mLedLightColorAdapter: LedLightColorAdapter
private lateinit var mLedModeList: MutableList<String> private lateinit var mLedModeList: MutableList<String>
//防止多次按返回键执行
private var isFinishSave = false
//禁用模式 //禁用模式
private var isDisabledMode = true private var isDisabledMode = true
private var mLedControlType = ConstantInt.Type0
private var mLedSwitch = ConstantInt.Type1
private var mLedMode = ConstantInt.Type1
private var mLedTempMode = ConstantInt.Type1
override fun getTopBar() = mViewBinding.ilLedLightBar.titleTopBar override fun getTopBar() = mViewBinding.ilLedLightBar.titleTopBar
@@ -65,7 +57,6 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
super.initData() super.initData()
setTopBarTitle(R.string.tracker_manage_set_led) setTopBarTitle(R.string.tracker_manage_set_led)
setLeftBackImage(R.drawable.icon_white_back_svg) setLeftBackImage(R.drawable.icon_white_back_svg)
// initStatus()
mPetBean = Util.getParcelableAdaptive(intent, ConstantString.Pet, PetBean::class.java) mPetBean = Util.getParcelableAdaptive(intent, ConstantString.Pet, PetBean::class.java)
@@ -86,14 +77,10 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
val builder = ViewUtil.instance.showBottomSheetList(mContext, { dialog, _, position, _ -> val builder = ViewUtil.instance.showBottomSheetList(mContext, { dialog, _, position, _ ->
mMapDeviceBean?.apply { mMapDeviceBean?.apply {
dialog.dismiss() dialog.dismiss()
ledMode = position + 1 mLedSwitch = ledSwitch
mViewBinding.ledLightMode.detailText = mLedModeList[position] mLedMode = ledMode
mViewBinding.ledLightOpenAndClose.switch.let { mLedTempMode = position + 1
if (!it.isChecked) { setBleLedMode(mLedTempMode)
it.isChecked = true
}
setBleLedMode(ledMode)
}
} }
}) })
for (i in 0 until mLedModeList.size) builder.addItem(mLedModeList[i]) for (i in 0 until mLedModeList.size) builder.addItem(mLedModeList[i])
@@ -102,39 +89,8 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
ViewUtil.instance.showQMUICommonListItemView(mContext, this, { ViewUtil.instance.showQMUICommonListItemView(mContext, this, {
if (!isDisabledMode) builder.build().show() if (!isDisabledMode) builder.build().show()
}, getString(R.string.txt_light_mode)) }, getString(R.string.txt_light_mode))
// mMapDeviceBean?.apply {
// detailText = when {
// ledMode - 1 >= mLedModeList.size -> {
// mLedModeList[mLedModeList.size - 1]
// }
//
// ledMode == 0 -> {
// mLedModeList[0]
// }
//
// else -> mLedModeList[ledMode - 1]
// }
// }
} }
val colorListResId = mutableListOf(
R.color.white,
R.color.colormenu,
R.color.corner_color,
R.color.blue_light,
R.color.deep_blue,
R.color.red_blue,
R.color.yellow_color,
R.color.yellow_red_color
)
mLedLightColorAdapter = LedLightColorAdapter(mContext, colorListResId)
mLedLightColorAdapter.setOnItemClickListener(object :
BaseRecyclerAdapter.OnItemClickListener {
override fun onItemClick(itemView: View?, pos: Int) {
setLedLightColor(ContextCompat.getColor(mContext, colorListResId[pos]))
}
})
mViewBinding.apply { mViewBinding.apply {
ViewUtil.instance.viewRotationAnimator(ilLedLightBtnState.ivLedBtnState, true) ViewUtil.instance.viewRotationAnimator(ilLedLightBtnState.ivLedBtnState, true)
@@ -146,19 +102,6 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
it.tvIssueTwoSmallTwoTitle.setText(R.string.txt_network_setup) it.tvIssueTwoSmallTwoTitle.setText(R.string.txt_network_setup)
it.tvIssueTwoSmallTitleTwoContent.setText(R.string.txt_network_setup_dec) it.tvIssueTwoSmallTitleTwoContent.setText(R.string.txt_network_setup_dec)
} }
ViewUtil.instance.setRecyclerViewGridLayout(
mContext,
colorSelectRecyclerView,
mLedLightColorAdapter,
spanCount = 2,
bottom = AppUtils.dpToPx(9),
itemWidth = AppUtils.dpToPx(30),
offset = AppUtils.dpToPx(290)
)
selectColorPaintView.setOnColorSelectListener {
setLedLightColor(it)
}
setOnClickListenerViews( setOnClickListenerViews(
ledLightBluetoothTips.trbBleConnectState, ledLightBluetoothTips.trbBleConnectState,
@@ -186,24 +129,60 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
val data = it.getOrNull() val data = it.getOrNull()
data?.apply { data?.apply {
mMapDeviceBean = data mMapDeviceBean = data
mOldMapDeviceBean = data.copy()
setDeviceData(data) setDeviceData(data)
} }
} }
}) })
} }
mLedLightViewModel.mSetLedLightLiveData.observe(this) { mLedLightViewModel.apply {
mLedSwitchLiveData.observe(this@LedLightActivity) {
dealRequestResult(it, object : GetResultCallback { dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) { override fun onResult(any: Any) {
showToast(R.string.txt_change_successful, isFinish = true) mPetBean?.apply {
if (!SRBleUtil.instance.isMacConnect(macID)) {
mViewBinding.ledLightOpenAndClose.switch.isChecked =
!mViewBinding.ledLightOpenAndClose.switch.isChecked
mMapDeviceBean?.let { m ->
val ledSwitch = if (m.ledSwitch == ConstantInt.Open) {
ConstantInt.Close
} else {
ConstantInt.Open
}
m.ledSwitch = ledSwitch
}
}
}
setLedControlState()
} }
override fun onRequestError(exceptionCode: String?) { override fun onRequestError(exceptionCode: String?) {
isFinishSave = false setLedControlState()
mViewBinding.btnLedLightSetSave.isEnabled = true }
override fun onErrorCode() {
setLedControlState()
} }
}) })
} }
mSetLedLightLiveData.observe(this@LedLightActivity) {
dealRequestResult(it, object : GetResultCallback {
override fun onResult(any: Any) {
mLedMode = mLedTempMode
mLedSwitch = ConstantInt.Type1
mViewBinding.ledLightOpenAndClose.switch.isChecked = true
setLedModeControlState()
}
override fun onRequestError(exceptionCode: String?) {
setLedModeControlState()
}
override fun onErrorCode() {
setLedModeControlState()
}
})
}
}
//接收开蓝牙操作,然后搜索连接设备 //接收开蓝牙操作,然后搜索连接设备
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int -> XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
@@ -234,6 +213,29 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
} }
} }
/**
* 设置LED可以点击状态
*/
private fun setLedControlState() {
mPetBean?.apply {
if (!SRBleUtil.instance.isMacConnect(macID)) {
setBtnState(true)
}
}
}
private fun setLedModeControlState() {
mPetBean?.apply {
if (!SRBleUtil.instance.isMacConnect(macID)) {
setBtnState(true)
mMapDeviceBean?.let {
it.ledSwitch = mLedSwitch
it.ledMode = mLedMode
}
}
}
}
private fun parseData(data: ByteArray?) { private fun parseData(data: ByteArray?) {
if (null != data && data.isNotEmpty()) { if (null != data && data.isNotEmpty()) {
val data0 = SRBleCmdUtil.instance.byteToInt(data[0]) val data0 = SRBleCmdUtil.instance.byteToInt(data[0])
@@ -242,26 +244,34 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
if (data0 == 3 && data1 == 1) { if (data0 == 3 && data1 == 1) {
val data3 = SRBleCmdUtil.instance.byteToInt(data[3]) val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
val ledSwitch = if (data3 > 0) { val ledSwitch = if (data3 > 0) {
mLedMode = data3
mViewBinding.ledLightOpenAndClose.switch.isChecked = true mViewBinding.ledLightOpenAndClose.switch.isChecked = true
ConstantInt.Open ConstantInt.Open
} else { } else {
mViewBinding.ledLightOpenAndClose.switch.isChecked = false mViewBinding.ledLightOpenAndClose.switch.isChecked = false
ConstantInt.Close ConstantInt.Close
} }
mMapDeviceBean?.ledSwitch = ledSwitch
val modeType = if (data2 == 0) { val modeType = if (data2 == 0) {
ConstantInt.Type1 ConstantInt.Type1
} else { } else {
ConstantInt.Type3 ConstantInt.Type3
} }
mMapDeviceBean?.let { mMapDeviceBean?.let {
mViewBinding.ledLightOpenAndClose.accessoryType = it.ledSwitch = ledSwitch
QMUICommonListItemView.ACCESSORY_TYPE_SWITCH setBtnState(true)
mViewBinding.ilLedLightBtnState.root.visibility = View.GONE //控制开关
if (mLedControlType == ConstantInt.Type0) {
//远程控制 //远程控制
mLedLightViewModel.setLedSwitch( mLedLightViewModel.setLedSwitch(
null, it.deviceServerId, ledSwitch, modeType null, it.deviceServerId, ledSwitch, modeType
) )
} else {
//控制模式
it.ledMode = data3
//远程控制
mLedLightViewModel.setLedLight(this@LedLightActivity, it, modeType)
}
} }
} }
} }
@@ -269,12 +279,11 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
private fun setDeviceData(mapDeviceBean: MapDeviceBean) { private fun setDeviceData(mapDeviceBean: MapDeviceBean) {
mapDeviceBean.apply { mapDeviceBean.apply {
mLedMode=ledMode
mLedSwitch=ledSwitch
mViewBinding.let { mViewBinding.let {
it.ledLightOpenAndClose.switch.isChecked = ledSwitch == ConstantInt.Open it.ledLightOpenAndClose.switch.isChecked = ledSwitch == ConstantInt.Open
setLedLightColor(
Color.rgb(ledRedValue, ledGreenValue, ledBlueValue), true
)
if (ledMode == 0 || ledMode > mLedModeList.size) ledMode = 1 if (ledMode == 0 || ledMode > mLedModeList.size) ledMode = 1
it.ledLightMode.detailText = mLedModeList[ledMode - 1] it.ledLightMode.detailText = mLedModeList[ledMode - 1]
@@ -285,7 +294,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
private fun updateDisabledState(mapDeviceBean: MapDeviceBean) { private fun updateDisabledState(mapDeviceBean: MapDeviceBean) {
mapDeviceBean.apply { mapDeviceBean.apply {
setDisabledState(!Util.getLedControlState(deviceMacId,mapDeviceBean)) setDisabledState(!Util.getLedControlState(deviceMacId, mapDeviceBean))
} }
} }
@@ -297,7 +306,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
ledLightBluetoothTips.root.visibility = View.GONE ledLightBluetoothTips.root.visibility = View.GONE
R.color.grey_color R.color.grey_color
} else { } else {
btnLedLightSetSave.visibility = View.VISIBLE btnLedLightSetSave.visibility = View.GONE
ledLightBluetoothTips.root.visibility = View.VISIBLE ledLightBluetoothTips.root.visibility = View.VISIBLE
R.color.qmui_config_color_gray_1 R.color.qmui_config_color_gray_1
} }
@@ -309,8 +318,9 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
/** /**
* 更新设备连接状态 * 更新设备连接状态
*/ */
private fun updateConState(trackBleDevice: BleTrackDeviceBean, isShowToast: Boolean = true) { private fun updateConState(
mBleTrackDeviceBean = trackBleDevice trackBleDevice: BleTrackDeviceBean, isShowToast: Boolean = true
) {
mViewBinding.ledLightBluetoothTips.trbBleConnectState.let { view -> mViewBinding.ledLightBluetoothTips.trbBleConnectState.let { view ->
val bgColor = if (trackBleDevice.conState == ConState.CONNECTED) { val bgColor = if (trackBleDevice.conState == ConState.CONNECTED) {
view.text = getString(R.string.tracker_manage_set_ble_connect) view.text = getString(R.string.tracker_manage_set_ble_connect)
@@ -327,103 +337,21 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
} }
private fun setBleLedMode(mode: Int) { private fun setBleLedMode(mode: Int) {
mBleTrackDeviceBean?.apply {
SRBleUtil.instance.setBleLedSwitch(mContext, bleDevice, mode)
}
}
override fun leftBackOnClick() {
if (null == mMapDeviceBean || null == mOldMapDeviceBean) {
super.leftBackOnClick()
return
}
if (isFinishSave) return
//是否是蓝牙连接了,修改设备数据返回,同步服务器
if (null != mBleTrackDeviceBean) {
mMapDeviceBean?.apply { mMapDeviceBean?.apply {
mOldMapDeviceBean?.let { mLedControlType = ConstantInt.Type1
if (it == mMapDeviceBean) { setBtnState(false)
super.leftBackOnClick() if (BleManager.getInstance().isConnected(deviceMacId)) {
} else { //蓝牙控制
//判断是否有蓝牙连接 SRBleUtil.instance.getConnectMacDevice(deviceMacId)?.let {
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) { SRBleUtil.instance.setBleLedSwitch(mContext, it.bleDevice, mode)
finishAndSave(ConstantInt.Type1)
} else {
super.leftBackOnClick()
}
}
}
} }
} else { } else {
super.leftBackOnClick() //远程控制
ledMode = mode
ledSwitch = ConstantInt.Open
mLedLightViewModel.setLedLight(this@LedLightActivity, this, ConstantInt.Type2)
} }
} }
/**
* 保存设置数据
*/
private fun finishAndSave(modeType: Int) {
if (null == mMapDeviceBean) {
finish()
return
}
mMapDeviceBean?.apply {
isFinishSave = true
mLedLightViewModel.setLedLight(this@LedLightActivity, this, modeType)
}
}
/**
* @param show 只显示,不作为命令处理
*/
private fun setLedLightColor(color: Int, show: Boolean = false) {
val drawableColor = ColorDrawable(color)
mViewBinding.currentSelectColor.appHeadImage.setImageDrawable(drawableColor)
// mViewBinding.ledLightBarColorImage.setBackgroundColor(color)
val red = color and 0xff0000 shr 16
val green = color and 0x00ff00 shr 8
val blue = color and 0x0000ff
mMapDeviceBean?.apply {
ledRedValue = red
ledGreenValue = green
ledBlueValue = blue
}
// mViewBinding.tvLedLightCurrentRgb.text = String.format("#%06X", -0x1 and color)
mViewBinding.tvLedLightCurrentRgb.text = String.format("#%06X", 0xffffff and color)
if (!show) {
mBleTrackDeviceBean?.let {
//判断是否有蓝牙连接
if (BleManager.getInstance().isConnected(it.bleDevice)) {
SRBleUtil.instance.writeData(
it.bleDevice, SRBleCmdUtil.instance.ledColor(
SRBleCmdUtil.CMD_WRITE, red, green, blue
)
)
}
}
}
}
/**
* 断开连接设备
*/
private fun operateDeviceTips(messageID: Int, type: Int = 0) {
ViewUtil.instance.showDialog(mContext, messageID, object : BaseDialog.OnDialogOkListener {
override fun onOkClick(dialog: BaseDialog<*>) {
dialog.dismiss()
when (type) {
0 -> {
mBleTrackDeviceBean?.let {
mConnectionDeviceViewModel.disconnect(it.bleDevice)
}
}
}
}
}, okTextResId = R.string.start_txt_yes)
} }
/** /**
@@ -454,45 +382,61 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
} }
} }
private fun setBtnState(setEnabled: Boolean) {
mViewBinding.apply {
if (setEnabled) {
ledLightMode.detailText = mLedModeList[mLedMode - 1]
ledLightMode.isEnabled = true
lvLedLightModeLoading.visibility = View.GONE
ledLightOpenAndClose.accessoryType = QMUICommonListItemView.ACCESSORY_TYPE_SWITCH
ilLedLightBtnState.root.visibility = View.GONE
} else {
ledLightMode.detailText = ""
ledLightMode.isEnabled = false
lvLedLightModeLoading.visibility = View.VISIBLE
ledLightOpenAndClose.accessoryType = QMUICommonListItemView.ACCESSORY_TYPE_NONE
ilLedLightBtnState.root.visibility = View.VISIBLE
}
}
}
private fun setLedSwitch() { private fun setLedSwitch() {
mViewBinding.ledLightOpenAndClose.switch.apply { mMapDeviceBean?.apply {
mMapDeviceBean?.let { mLedControlType = ConstantInt.Type0
mViewBinding.ledLightOpenAndClose.accessoryType = mViewBinding.ledLightOpenAndClose.switch.isChecked =
QMUICommonListItemView.ACCESSORY_TYPE_NONE !mViewBinding.ledLightOpenAndClose.switch.isChecked
mViewBinding.ilLedLightBtnState.root.visibility = View.VISIBLE setBtnState(false)
val ledSwitch = if (it.ledSwitch == ConstantInt.Open) { val ledSwitch = if (ledSwitch == ConstantInt.Open) {
ConstantInt.Close ConstantInt.Close
} else { } else {
ConstantInt.Open ConstantInt.Open
} }
if (BleManager.getInstance().isConnected(it.deviceMacId)) { if (BleManager.getInstance().isConnected(deviceMacId)) {
//蓝牙控制 //蓝牙控制
mBleTrackDeviceBean?.apply { SRBleUtil.instance.getConnectMacDevice(deviceMacId)?.let {
SRBleUtil.instance.setBleLedSwitch(mContext, bleDevice, ledSwitch) SRBleUtil.instance.setBleLedSwitch(mContext, it.bleDevice, ledSwitch)
} }
} else { } else {
//远程控制 //远程控制
mLedLightViewModel.setLedSwitch( mLedLightViewModel.setLedSwitch(
null, it.deviceServerId, ledSwitch, ConstantInt.Type2 null, deviceServerId, ledSwitch, ConstantInt.Type2
) )
} }
} }
} }
}
// val modeType = if (null != mBleTrackDeviceBean && BleManager.getInstance()
// .isConnected(mBleTrackDeviceBean!!.bleDevice)
// ) ConstantInt.Type1
// else ConstantInt.Type2
// btnLedLightSetSave.isEnabled = false
// finishAndSave(modeType)
override fun onClick(v: View?) { override fun onClick(v: View?) {
mViewBinding.apply { mViewBinding.apply {
when (v) { when (v) {
//手动连接设备 //手动连接设备
ledLightBluetoothTips.trbBleConnectState -> connectionBtn(ledLightBluetoothTips.trbBleConnectState.text.toString()) ledLightBluetoothTips.trbBleConnectState -> connectionBtn(ledLightBluetoothTips.trbBleConnectState.text.toString())
btnLedLightSetSave -> {
val modeType = if (null != mBleTrackDeviceBean && BleManager.getInstance()
.isConnected(mBleTrackDeviceBean!!.bleDevice)
) ConstantInt.Type1
else ConstantInt.Type2
btnLedLightSetSave.isEnabled = false
finishAndSave(modeType)
}
btnLedLightIssue -> showLedIssue() btnLedLightIssue -> showLedIssue()
ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue() ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue()

View File

@@ -1,11 +1,14 @@
package com.abbidot.tracker.ui.activity.map package com.abbidot.tracker.ui.activity.map
import android.content.Intent import android.content.Intent
import android.graphics.PorterDuff
import android.graphics.Typeface import android.graphics.Typeface
import android.view.KeyEvent import android.view.KeyEvent
import android.view.View import android.view.View
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.activity.viewModels import androidx.activity.viewModels
import androidx.core.content.ContextCompat
import androidx.core.graphics.drawable.DrawableCompat
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
@@ -292,7 +295,6 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
override fun onResult(any: Any) { override fun onResult(any: Any) {
val data = it.getOrNull() val data = it.getOrNull()
data?.let { d -> data?.let { d ->
LogUtil.e("xxxxxxxxxxxxxxxxxxxxx,${d.latitude},${d.longitude}")
d.isCloseBattery = isCloseBattery d.isCloseBattery = isCloseBattery
d.isCloseMsg = isCloseMsg d.isCloseMsg = isCloseMsg
mMapDeviceBean = d mMapDeviceBean = d
@@ -400,6 +402,17 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
} }
mMapDeviceBean?.apply { mMapDeviceBean?.apply {
if (trackBle.mac == deviceMacId) { if (trackBle.mac == deviceMacId) {
//蓝牙连接断开更快更新状态
mMapViewModel.setDeviceStateAndWarningData(
mContext,
mPetBean,
this,
mViewBinding.ilLiveV3MapDeviceMsg.root,
mViewBinding.ilLiveV3MapDeviceMsg.tvDeviceMsgContent,
mViewBinding.ilLiveV3MapDeviceMsg.ivDeviceMsgCloseBtn,
mDeviceStateList,
mDeviceStateAdapter
)
updateConState(trackBle) updateConState(trackBle)
//分享设备不可以控制灯 //分享设备不可以控制灯
if (p.shared == ConstantInt.NoShare) { if (p.shared == ConstantInt.NoShare) {
@@ -848,6 +861,23 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
private fun setLedBtnEnabled(btnEnabled: Boolean) { private fun setLedBtnEnabled(btnEnabled: Boolean) {
mViewBinding.apply { mViewBinding.apply {
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.let {
val tColor = if (btnEnabled) {
R.color.data_black_color
} else {
R.color.grey_color
}
val cColor = ContextCompat.getColor(mContext, tColor)
// 假设只给左侧图标 tint
val drawables = ContextCompat.getDrawable(mContext, R.drawable.icon_light_svg)
drawables?.let { d ->
val wrappedDrawable = DrawableCompat.wrap(d)
DrawableCompat.setTint(wrappedDrawable, cColor)
DrawableCompat.setTintMode(wrappedDrawable, PorterDuff.Mode.SRC_IN)
it.setCompoundDrawablesWithIntrinsicBounds(d, null, null, null)
}
it.setTextColor(cColor)
}
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isEnabled = btnEnabled ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isEnabled = btnEnabled
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.root.isEnabled = btnEnabled ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.root.isEnabled = btnEnabled
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.root.isEnabled = btnEnabled ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.root.isEnabled = btnEnabled

View File

@@ -57,6 +57,7 @@ class AddCreditCardPaymentActivity :
ilAddCardNameOnCard.let { ilAddCardNameOnCard.let {
it.tvInputView2NameTitle.setText(R.string.txt_name_card) it.tvInputView2NameTitle.setText(R.string.txt_name_card)
it.etInputView2Content.setFilters(arrayOf<InputFilter>(InputFilter.AllCaps()))
it.etInputView2Content.onFocusChangeListener = this@AddCreditCardPaymentActivity it.etInputView2Content.onFocusChangeListener = this@AddCreditCardPaymentActivity
showEditViewContent(it.etInputView2Content, mCreditCard!!.cardName) showEditViewContent(it.etInputView2Content, mCreditCard!!.cardName)
} }

View File

@@ -386,8 +386,7 @@ class HomeTrackFragment :
} }
mLedLightViewModel.mLedSwitchLiveData.observe(viewLifecycleOwner) { mLedLightViewModel.mLedSwitchLiveData.observe(viewLifecycleOwner) {
dealRequestResult( dealRequestResult(
it, it, object : GetResultCallback {
object : GetResultCallback {
override fun onResult(any: Any) { override fun onResult(any: Any) {
getHomeV2Activity()?.let { h -> getHomeV2Activity()?.let { h ->
h.getPet(false)?.let { p -> h.getPet(false)?.let { p ->
@@ -415,13 +414,21 @@ class HomeTrackFragment :
override fun onRequestError(exceptionCode: String?) { override fun onRequestError(exceptionCode: String?) {
setLedErrorState() setLedErrorState()
} }
}, }, isRequestErrorTip = getShowError(), isShowCodeError = getShowError()
isRequestErrorTip = mLedMac == getHomeV2Activity()!!.getPet(false)!!.macID,
isShowCodeError = mLedMac == getHomeV2Activity()!!.getPet(false)!!.macID
) )
} }
} }
private fun getShowError(): Boolean {
var showCodeError = false
getHomeV2Activity()?.apply {
getPet(false)?.let {
showCodeError = mLedMac == it.macID
}
}
return showCodeError
}
private fun setLedErrorState() { private fun setLedErrorState() {
getHomeV2Activity()?.apply { getHomeV2Activity()?.apply {
getPet(false)?.let { getPet(false)?.let {

View File

@@ -830,6 +830,9 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
getPet()?.let { pet -> getPet()?.let { pet ->
if (SRBleUtil.instance.isMacConnect(pet.macID)) { if (SRBleUtil.instance.isMacConnect(pet.macID)) {
showToast(R.string.txt_pet_close, gravity = Gravity.CENTER) showToast(R.string.txt_pet_close, gravity = Gravity.CENTER)
} else if (null != mMapDeviceBean && mMapDeviceBean!!.powerSwitch == ConstantInt.Type2) {
val string = String.format(getString(R.string.txt_move_wake), pet.petName)
showToast(string, gravity = Gravity.CENTER)
} else if (!isCanLive) { } else if (!isCanLive) {
showToast(R.string.txt_locate_works, gravity = Gravity.CENTER) showToast(R.string.txt_locate_works, gravity = Gravity.CENTER)
} else if (!isNotifyRefreshLocation) { } else if (!isNotifyRefreshLocation) {

View File

@@ -13,6 +13,7 @@ import com.abbidot.baselibrary.util.Utils
import com.abbidot.tracker.R import com.abbidot.tracker.R
import com.abbidot.tracker.bean.HistoryDataBean import com.abbidot.tracker.bean.HistoryDataBean
import com.abbidot.tracker.bean.MapDeviceBean import com.abbidot.tracker.bean.MapDeviceBean
import com.abbidot.tracker.constant.ConstantInt
import com.abbidot.tracker.databinding.LayoutPetLocationInfoBinding import com.abbidot.tracker.databinding.LayoutPetLocationInfoBinding
import com.abbidot.tracker.util.Util import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
@@ -99,7 +100,11 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
// mMarker?.tag = history // mMarker?.tag = history
// showMarkerInfoWindow(history) // showMarkerInfoWindow(history)
val address = String.format(mContext!!.getString(R.string.txt_near), it) val address = if (inWifiZone == ConstantInt.Type1) {
mContext!!.getString(R.string.txt_home) + " · $it"
} else {
String.format(mContext!!.getString(R.string.txt_near), it)
}
ViewUtil.instance.viewShow(mPetLocationLayoutBinding.root) ViewUtil.instance.viewShow(mPetLocationLayoutBinding.root)
mPetLocationLayoutBinding.let { layout -> mPetLocationLayoutBinding.let { layout ->
layout.tvPetLocationReverseGeocode.text = address layout.tvPetLocationReverseGeocode.text = address

View File

@@ -146,7 +146,7 @@ class SRBleCmdUtil private constructor() {
* 绑定设备 * 绑定设备
*/ */
fun bindDevice(): ByteArray { fun bindDevice(): ByteArray {
val byteArray = byteArrayOf(0x01, CMD_WRITE.toByte()) val byteArray = byteArrayOf(0x01, CMD_WRITE.toByte(),0x02,0,0)
return getCrc8Cmd(byteArray) return getCrc8Cmd(byteArray)
} }

View File

@@ -25,6 +25,7 @@ import com.abbidot.tracker.widget.TypefaceButton
import com.abbidot.tracker.widget.TypefaceTextView import com.abbidot.tracker.widget.TypefaceTextView
import com.clj.fastble.BleManager import com.clj.fastble.BleManager
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.util.concurrent.TimeUnit
class MapViewModel : ViewModel() { class MapViewModel : ViewModel() {
@@ -447,7 +448,16 @@ class MapViewModel : ViewModel() {
batteryText.let { batteryText.let {
canShowBattery = true canShowBattery = true
rootView.visibility = View.VISIBLE rootView.visibility = View.VISIBLE
if (powerSwitch == ConstantInt.Type0) { if (powerSwitch == ConstantInt.Type2) {
//R.drawable.icon_weak_gps_image
it.setCompoundDrawablesWithIntrinsicBounds(
R.drawable.icon_device_sleep_image, 0, 0, 0
)
it.text = String.format(
context.getString(R.string.txt_fully_asleep), forTime(updateTime)
)
ViewUtil.instance.viewShow(closeBtn)
} else if (powerSwitch == ConstantInt.Type0) {
//连接蓝牙就不显示关机 //连接蓝牙就不显示关机
if (SRBleUtil.instance.isMacConnect(deviceMacId)) { if (SRBleUtil.instance.isMacConnect(deviceMacId)) {
rootView.visibility = View.INVISIBLE rootView.visibility = View.INVISIBLE
@@ -485,6 +495,16 @@ class MapViewModel : ViewModel() {
} }
} }
private fun forTime(timestamp: Long): String {
val durationMillis =
if (timestamp < 1000000000000) System.currentTimeMillis() - timestamp * 1000
else System.currentTimeMillis() - timestamp
val hours = TimeUnit.MILLISECONDS.toHours(durationMillis)
val minutes =
TimeUnit.MILLISECONDS.toMinutes(durationMillis) - TimeUnit.HOURS.toMinutes(hours)
val timeStr = if (hours > 0) "${hours}h ${minutes}m" else "${minutes}m"
return timeStr
}
fun setPetLocationReverseGeocode( fun setPetLocationReverseGeocode(
context: Context, context: Context,

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 599 B

View File

@@ -3,6 +3,7 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/gray_ico_switch_on" android:state_checked="true" /> <item android:drawable="@drawable/gray_ico_switch_on" android:state_checked="true" />
<item android:drawable="@drawable/gray_ico_switch_disable" android:state_enabled="false" />
<item android:drawable="@drawable/ico_switch_off" /> <item android:drawable="@drawable/ico_switch_off" />
</selector> </selector>

View File

@@ -9,7 +9,7 @@
</item> </item>
<item android:state_enabled="false"> <item android:state_enabled="false">
<shape android:shape="rectangle"> <shape android:shape="rectangle">
<solid android:color="@color/grey_color" /> <solid android:color="@color/transparent" />
<stroke android:width="@dimen/dp_1" android:color="@color/white_gray_color1" /> <stroke android:width="@dimen/dp_1" android:color="@color/white_gray_color1" />
<corners android:radius="@dimen/dp_44" /> <corners android:radius="@dimen/dp_44" />
</shape> </shape>

View File

@@ -23,6 +23,7 @@
android:paddingHorizontal="@dimen/dp_14" android:paddingHorizontal="@dimen/dp_14"
android:paddingVertical="@dimen/dp_6" android:paddingVertical="@dimen/dp_6"
android:text="@string/acccount_btn_save" android:text="@string/acccount_btn_save"
android:visibility="gone"
android:textColor="@color/btn_color" android:textColor="@color/btn_color"
android:textSize="@dimen/textSize12" android:textSize="@dimen/textSize12"
app:qmui_radius="@dimen/dp_100" app:qmui_radius="@dimen/dp_100"

View File

@@ -63,7 +63,7 @@
style="@style/my_TextView_style_v2" style="@style/my_TextView_style_v2"
android:layout_marginHorizontal="@dimen/dp_6" android:layout_marginHorizontal="@dimen/dp_6"
android:layout_marginTop="@dimen/dp_12" android:layout_marginTop="@dimen/dp_12"
android:text="@string/txt_office" android:text="@string/txt_home"
android:textSize="@dimen/textSize14" android:textSize="@dimen/textSize14"
app:typeface="@string/roboto_bold_font" /> app:typeface="@string/roboto_bold_font" />

View File

@@ -3,8 +3,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/shape32_grey_color_bg" android:background="@drawable/shape32_grey_color_bg"
android:paddingHorizontal="@dimen/dp_16" android:paddingHorizontal="@dimen/dp_12"
android:paddingVertical="@dimen/dp_4"> android:paddingVertical="@dimen/dp_2">
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_led_btn_state" android:id="@+id/iv_led_btn_state"

View File

@@ -1072,7 +1072,8 @@
<string name="txt_pet_close">Pet is close, try Radar</string> <string name="txt_pet_close">Pet is close, try Radar</string>
<string name="txt_load_more_pull_text">Pull to load more</string> <string name="txt_load_more_pull_text">Pull to load more</string>
<string name="txt_load_more_release_text">Release to load</string> <string name="txt_load_more_release_text">Release to load</string>
<string name="txt_fully_charged">Fully charged</string> <string name="txt_fully_charged">Fully charged</string>
<string name="txt_fully_asleep">Fell asleep %s ago</string>
<string name="txt_move_wake">Move %s to wake up</string>
</resources> </resources>