1.增加led开关灯加载效果
2.修复蓝牙连接,充电还能开灯的bug 3.修复雷达页面,位置不更新bug 4.修复雷达页面,被分享和wifi内能开灯的bug 5.修复直播页面,wifi内能开灯的bug
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 2110
|
versionCode 2111
|
||||||
// versionName "2.1.10"
|
// versionName "2.1.11"
|
||||||
versionName "2.1.10-Beta10"
|
versionName "2.1.11-Beta1"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.abbidot.tracker.R
|
|||||||
import com.abbidot.tracker.bean.MenuTxtBean
|
import com.abbidot.tracker.bean.MenuTxtBean
|
||||||
import com.abbidot.tracker.constant.ConstantInt
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.constant.MultipleEntity
|
import com.abbidot.tracker.constant.MultipleEntity
|
||||||
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import com.abbidot.tracker.widget.BatteryView
|
import com.abbidot.tracker.widget.BatteryView
|
||||||
import com.abbidot.tracker.widget.MyBluetoothAnimView
|
import com.abbidot.tracker.widget.MyBluetoothAnimView
|
||||||
import com.abbidot.tracker.widget.TypefaceTextView
|
import com.abbidot.tracker.widget.TypefaceTextView
|
||||||
@@ -27,12 +28,13 @@ class HomePetTrackStateAdapter(
|
|||||||
val stateTextView = holder!!.getView(R.id.tv_home_pet_device_state_item) as TypefaceTextView
|
val stateTextView = holder!!.getView(R.id.tv_home_pet_device_state_item) as TypefaceTextView
|
||||||
stateTextView.text = item.menuName
|
stateTextView.text = item.menuName
|
||||||
|
|
||||||
holder.getTextView(R.id.tv_home_pet_device_state_name_item).apply {
|
val stateName = holder.getTextView(R.id.tv_home_pet_device_state_name_item).apply {
|
||||||
text = item.menuValue
|
text = item.menuValue
|
||||||
val color = if (item.type == ConstantInt.SpecialType) R.color.grey_color
|
val color = if (item.type == ConstantInt.SpecialType) R.color.grey_color
|
||||||
else item.colorRedId
|
else item.colorRedId
|
||||||
setTextColor(ContextCompat.getColor(mContext, color))
|
setTextColor(ContextCompat.getColor(mContext, color))
|
||||||
}
|
}
|
||||||
|
val btnState = holder.getImageView(R.id.iv_home_pet_btn_state)
|
||||||
|
|
||||||
val color = if (item.type == ConstantInt.SpecialType) R.color.grey_color
|
val color = if (item.type == ConstantInt.SpecialType) R.color.grey_color
|
||||||
else R.color.data_black_color
|
else R.color.data_black_color
|
||||||
@@ -43,7 +45,9 @@ class HomePetTrackStateAdapter(
|
|||||||
holder.getView(R.id.mba_home_pet_device_search_anim_item) as MyBluetoothAnimView
|
holder.getView(R.id.mba_home_pet_device_search_anim_item) as MyBluetoothAnimView
|
||||||
when (item.menuType) {
|
when (item.menuType) {
|
||||||
MultipleEntity.IMG_TEXT_IMG -> {
|
MultipleEntity.IMG_TEXT_IMG -> {
|
||||||
|
stateName.visibility = View.VISIBLE
|
||||||
bluetoothAnimView.visibility = View.GONE
|
bluetoothAnimView.visibility = View.GONE
|
||||||
|
btnState.visibility = View.GONE
|
||||||
bv.visibility = View.VISIBLE
|
bv.visibility = View.VISIBLE
|
||||||
bv.setValue(item.imageId)
|
bv.setValue(item.imageId)
|
||||||
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
||||||
@@ -51,8 +55,10 @@ class HomePetTrackStateAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
MultipleEntity.TEXT_TEXT_IMG -> {
|
MultipleEntity.TEXT_TEXT_IMG -> {
|
||||||
|
stateName.visibility = View.VISIBLE
|
||||||
bluetoothAnimView.visibility = View.VISIBLE
|
bluetoothAnimView.visibility = View.VISIBLE
|
||||||
bv.visibility = View.GONE
|
bv.visibility = View.GONE
|
||||||
|
btnState.visibility = View.GONE
|
||||||
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
bluetoothAnimView.setBluetoothAnimStartAndStop(item.isSwitch)
|
||||||
stateTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
stateTextView.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
@@ -73,6 +79,16 @@ class HomePetTrackStateAdapter(
|
|||||||
null, drawable, null, null
|
null, drawable, null, null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
btnState.apply {
|
||||||
|
ViewUtil.instance.viewRotationAnimator(this, true)
|
||||||
|
visibility = if (item.state == ConstantInt.Type1) {
|
||||||
|
stateName.visibility = View.GONE
|
||||||
|
View.VISIBLE
|
||||||
|
} else {
|
||||||
|
stateName.visibility = View.VISIBLE
|
||||||
|
View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -551,6 +551,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
showLoading: Boolean = false,
|
showLoading: Boolean = false,
|
||||||
isShowNoDataTip: Boolean = true,
|
isShowNoDataTip: Boolean = true,
|
||||||
isShowRequestErrorTip: Boolean = true,
|
isShowRequestErrorTip: Boolean = true,
|
||||||
|
isShowCodeError: Boolean = true,
|
||||||
errorTip: String = getString(R.string.txt_net_error)
|
errorTip: String = getString(R.string.txt_net_error)
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
@@ -566,7 +567,7 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
getResultCallback.onRequestError(exceptionCode)
|
getResultCallback.onRequestError(exceptionCode)
|
||||||
}
|
}
|
||||||
//拦截请求异常code
|
//拦截请求异常code
|
||||||
if (netErrorCodeTips(exceptionCode)) {
|
if (netErrorCodeTips(exceptionCode, isShowCodeError)) {
|
||||||
//已经处理相关错误码就直接返回
|
//已经处理相关错误码就直接返回
|
||||||
getResultCallback.onErrorCode()
|
getResultCallback.onErrorCode()
|
||||||
return
|
return
|
||||||
@@ -606,108 +607,120 @@ abstract class BaseActivity<T : ViewBinding>(val inflater: (inflater: LayoutInfl
|
|||||||
/**
|
/**
|
||||||
* 网络请求错误code提示
|
* 网络请求错误code提示
|
||||||
*/
|
*/
|
||||||
private fun netErrorCodeTips(exceptionCode: String): Boolean {
|
private fun netErrorCodeTips(exceptionCode: String, isShowCodeError: Boolean = true): Boolean {
|
||||||
//设备已过期,请续费
|
//设备已过期,请续费
|
||||||
when (exceptionCode) {
|
when (exceptionCode) {
|
||||||
ErrorCode.DEVICE_RENEWAL.toString() -> {
|
ErrorCode.DEVICE_RENEWAL.toString() -> {
|
||||||
showToast(R.string.txt_device_renewal)
|
if (isShowCodeError) showToast(R.string.txt_device_renewal)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//TOKEN失效或者过期
|
//TOKEN失效或者过期
|
||||||
ErrorCode.TOKEN_OVERDUE.toString() -> {
|
ErrorCode.TOKEN_OVERDUE.toString() -> {
|
||||||
showToast(R.string.txt_token_overdue)
|
if (isShowCodeError) showToast(R.string.txt_token_overdue)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//用户名或密码错误
|
//用户名或密码错误
|
||||||
ErrorCode.USER_PASSWORD_ERROR.toString() -> {
|
ErrorCode.USER_PASSWORD_ERROR.toString() -> {
|
||||||
showToast(R.string.txt_user_password_error, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_user_password_error, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//验证码错误
|
//验证码错误
|
||||||
ErrorCode.VERIFY_CODE_ERROR.toString() -> {
|
ErrorCode.VERIFY_CODE_ERROR.toString() -> {
|
||||||
showToast(R.string.txt_verify_code_error, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_verify_code_error, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//验证码已过期
|
//验证码已过期
|
||||||
ErrorCode.VERIFY_CODE_EXPIRE.toString() -> {
|
ErrorCode.VERIFY_CODE_EXPIRE.toString() -> {
|
||||||
showToast(R.string.txt_verify_code_expire, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_verify_code_expire, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//注册失败
|
//注册失败
|
||||||
ErrorCode.REGISTER_FAIL.toString() -> {
|
ErrorCode.REGISTER_FAIL.toString() -> {
|
||||||
showToast(R.string.txt_register_fail, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_register_fail, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//用户不存在
|
//用户不存在
|
||||||
ErrorCode.USER_NO_EXIST.toString() -> {
|
ErrorCode.USER_NO_EXIST.toString() -> {
|
||||||
showToast(R.string.txt_user_no_exist, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_user_no_exist, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//用户已存在
|
//用户已存在
|
||||||
ErrorCode.USER_HAS_EXIST.toString() -> {
|
ErrorCode.USER_HAS_EXIST.toString() -> {
|
||||||
if (!isInterceptNetErrorCodeTip) {
|
if (!isInterceptNetErrorCodeTip && isShowCodeError) {
|
||||||
showToast(R.string.txt_user_has_exist, gravity = Gravity.BOTTOM)
|
showToast(R.string.txt_user_has_exist, gravity = Gravity.BOTTOM)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//邮箱格式不对
|
//邮箱格式不对
|
||||||
ErrorCode.EMAIL_FORMAT_ERROR.toString() -> {
|
ErrorCode.EMAIL_FORMAT_ERROR.toString() -> {
|
||||||
showToast(R.string.txt_email_format_error, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_email_format_error, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//不能分享给自己
|
//不能分享给自己
|
||||||
ErrorCode.NO_SHARE_MYSELF.toString() -> {
|
ErrorCode.NO_SHARE_MYSELF.toString() -> {
|
||||||
showToast(R.string.txt_no_share_myself)
|
if (isShowCodeError) showToast(R.string.txt_no_share_myself)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//当前用户已经绑定该设备
|
//当前用户已经绑定该设备
|
||||||
ErrorCode.DEVICE_HAS_BOUND.toString() -> {
|
ErrorCode.DEVICE_HAS_BOUND.toString() -> {
|
||||||
showToast(R.string.txt_device_has_bound)
|
if (isShowCodeError) showToast(R.string.txt_device_has_bound)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//该设备已被绑定
|
//该设备已被绑定
|
||||||
ErrorCode.DEVICE_HAS_BIND.toString() -> {
|
ErrorCode.DEVICE_HAS_BIND.toString() -> {
|
||||||
showToast(R.string.txt_device_has_bind)
|
if (isShowCodeError) showToast(R.string.txt_device_has_bind)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//设备不存在
|
//设备不存在
|
||||||
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
|
ErrorCode.DEVICE_NOT_EXIST.toString() -> {
|
||||||
showToast(R.string.txt_no_dfu)
|
if (isShowCodeError) showToast(R.string.txt_no_dfu)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
//系统异常
|
//系统异常
|
||||||
"1001" -> {
|
"1001" -> {
|
||||||
showToast(R.string.txt_system_error, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_system_error, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1002" -> {
|
"1002" -> {
|
||||||
showToast(R.string.txt_missing_param, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_missing_param, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1003" -> {
|
"1003" -> {
|
||||||
showToast(R.string.txt_tracker_busy, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_tracker_busy, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1004" -> {
|
"1004" -> {
|
||||||
showToast(R.string.txt_tracker_offline, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_tracker_offline, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1005" -> {
|
"1005" -> {
|
||||||
showToast(R.string.txt_tracker_live, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_tracker_live, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1006" -> {
|
"1006" -> {
|
||||||
showToast(R.string.txt_time_out_try_again, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(
|
||||||
|
R.string.txt_time_out_try_again, gravity = Gravity.CENTER
|
||||||
|
)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
"1007" -> {
|
"1007" -> {
|
||||||
showToast(R.string.txt_abnormity, gravity = Gravity.CENTER)
|
if (isShowCodeError) showToast(R.string.txt_abnormity, gravity = Gravity.CENTER)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ abstract class BaseFragment<T : ViewBinding>(
|
|||||||
var mLoadingDialog: QMUITipDialog? = null
|
var mLoadingDialog: QMUITipDialog? = null
|
||||||
|
|
||||||
//防止某个时间执行多次
|
//防止某个时间执行多次
|
||||||
private var mLimitExecutionTime = 0L
|
private var mLimitExecutionTime = 0L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
||||||
@@ -173,10 +173,17 @@ abstract class BaseFragment<T : ViewBinding>(
|
|||||||
showLoading: Boolean = false,
|
showLoading: Boolean = false,
|
||||||
isShowNoDataTip: Boolean = true,
|
isShowNoDataTip: Boolean = true,
|
||||||
isRequestErrorTip: Boolean = true,
|
isRequestErrorTip: Boolean = true,
|
||||||
|
isShowCodeError: Boolean = true,
|
||||||
errorTip: String = getString(R.string.txt_net_error)
|
errorTip: String = getString(R.string.txt_net_error)
|
||||||
) {
|
) {
|
||||||
(activity as BaseActivity<*>).dealRequestResult(
|
(activity as BaseActivity<*>).dealRequestResult(
|
||||||
it, getResultCallback, showLoading, isShowNoDataTip, isRequestErrorTip, errorTip
|
it,
|
||||||
|
getResultCallback,
|
||||||
|
showLoading,
|
||||||
|
isShowNoDataTip,
|
||||||
|
isRequestErrorTip,
|
||||||
|
isShowCodeError,
|
||||||
|
errorTip
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16,23 +16,24 @@ data class MenuTxtBean(
|
|||||||
var imageUrl: String,
|
var imageUrl: String,
|
||||||
var isSwitch: Boolean,
|
var isSwitch: Boolean,
|
||||||
var type: Int,
|
var type: Int,
|
||||||
|
var state: Int,
|
||||||
@MultipleEntity val menuType: Int
|
@MultipleEntity val menuType: Int
|
||||||
) : MultiItemEntity {
|
) : MultiItemEntity {
|
||||||
|
|
||||||
//设置空的构造方法
|
//设置空的构造方法
|
||||||
constructor(@MultipleEntity menuType: Int) : this("", "", 0, 0, "", false, 0, menuType)
|
constructor(@MultipleEntity menuType: Int) : this("", "", 0, 0, "", false, 0, 0, menuType)
|
||||||
|
|
||||||
//设置多个构造方法
|
//设置多个构造方法
|
||||||
constructor(menuName: String, menuValue: String, @MultipleEntity menuType: Int) : this(
|
constructor(menuName: String, menuValue: String, @MultipleEntity menuType: Int) : this(
|
||||||
menuName, menuValue, 0, 0, "", false, 0, menuType
|
menuName, menuValue, 0, 0, "", false, 0, 0, menuType
|
||||||
)
|
)
|
||||||
|
|
||||||
constructor(menuName: String, menuValue: String) : this(
|
constructor(menuName: String, menuValue: String) : this(
|
||||||
menuName, menuValue, 0, 0, "", false, 0, MultipleEntity.TEXT
|
menuName, menuValue, 0, 0, "", false, 0, 0, MultipleEntity.TEXT
|
||||||
)
|
)
|
||||||
|
|
||||||
constructor(menuName: String, imageId: Int, menuValue: String) : this(
|
constructor(menuName: String, imageId: Int, menuValue: String) : this(
|
||||||
menuName, menuValue, imageId, 0, "", false, 0, MultipleEntity.TEXT
|
menuName, menuValue, imageId, 0, "", false, 0, 0, MultipleEntity.TEXT
|
||||||
)
|
)
|
||||||
|
|
||||||
@MultipleEntity
|
@MultipleEntity
|
||||||
|
|||||||
@@ -108,8 +108,7 @@ class AddNewTracker3Activity :
|
|||||||
} else if (ble.conState == ConState.CONNECTION_FAIL) {
|
} else if (ble.conState == ConState.CONNECTION_FAIL) {
|
||||||
setNoConnectState()
|
setNoConnectState()
|
||||||
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
mViewBinding.ivAddNewTracker3RefreshBtn.isEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,6 +215,17 @@ class AddNewTracker3Activity :
|
|||||||
mScanDeviceAdapter.notifyItemRangeInserted(list.size - 1, 1)
|
mScanDeviceAdapter.notifyItemRangeInserted(list.size - 1, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (null != name && name.contains("Pet_")) {
|
||||||
|
DeviceBean().let {
|
||||||
|
it.type = getDeviceType("typeName")
|
||||||
|
it.deviceOutId = scanRecord.sliceArray(45..45 + 6).decodeToString()
|
||||||
|
it.macId = mac
|
||||||
|
it.deviceName = name
|
||||||
|
mScanDeviceAdapter.getData().let { list ->
|
||||||
|
list.add(it)
|
||||||
|
mScanDeviceAdapter.notifyItemRangeInserted(list.size - 1, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ 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
|
||||||
|
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||||
import com.abbidot.tracker.constant.ConstantInt
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
import com.abbidot.tracker.constant.ConstantString
|
import com.abbidot.tracker.constant.ConstantString
|
||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
@@ -33,6 +34,7 @@ import com.abbidot.tracker.vm.TrackerInfoViewModel
|
|||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.daimajia.androidanimations.library.Techniques
|
import com.daimajia.androidanimations.library.Techniques
|
||||||
import com.daimajia.androidanimations.library.YoYo
|
import com.daimajia.androidanimations.library.YoYo
|
||||||
|
import com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,6 +137,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
|
|
||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
|
ViewUtil.instance.viewRotationAnimator(ilLedLightBtnState.ivLedBtnState, true)
|
||||||
ilLedLightIssueLayout.let {
|
ilLedLightIssueLayout.let {
|
||||||
it.tvIssueOneBigTitle.setText(R.string.txt_led_light_set)
|
it.tvIssueOneBigTitle.setText(R.string.txt_led_light_set)
|
||||||
it.tvIssueTwoSmallOneTitle.setText(R.string.txt_bluetooth_setup)
|
it.tvIssueTwoSmallOneTitle.setText(R.string.txt_bluetooth_setup)
|
||||||
@@ -221,6 +224,47 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//接收发送指令后设备返回的数据
|
||||||
|
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
|
||||||
|
mPetBean?.apply {
|
||||||
|
if (macID == receiveData.mac) {
|
||||||
|
parseData(receiveData.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun parseData(data: ByteArray?) {
|
||||||
|
if (null != data && data.isNotEmpty()) {
|
||||||
|
val data0 = SRBleCmdUtil.instance.byteToInt(data[0])
|
||||||
|
val data1 = SRBleCmdUtil.instance.byteToInt(data[1])
|
||||||
|
val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
|
||||||
|
if (data0 == 3 && data1 == 1) {
|
||||||
|
val data3 = SRBleCmdUtil.instance.byteToInt(data[3])
|
||||||
|
val ledSwitch = if (data3 > 0) {
|
||||||
|
mViewBinding.ledLightOpenAndClose.switch.isChecked = true
|
||||||
|
ConstantInt.Open
|
||||||
|
} else {
|
||||||
|
mViewBinding.ledLightOpenAndClose.switch.isChecked = false
|
||||||
|
ConstantInt.Close
|
||||||
|
}
|
||||||
|
mMapDeviceBean?.ledSwitch = ledSwitch
|
||||||
|
val modeType = if (data2 == 0) {
|
||||||
|
ConstantInt.Type1
|
||||||
|
} else {
|
||||||
|
ConstantInt.Type3
|
||||||
|
}
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
mViewBinding.ledLightOpenAndClose.accessoryType =
|
||||||
|
QMUICommonListItemView.ACCESSORY_TYPE_SWITCH
|
||||||
|
mViewBinding.ilLedLightBtnState.root.visibility = View.GONE
|
||||||
|
//远程控制
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, it.deviceServerId, ledSwitch, modeType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setDeviceData(mapDeviceBean: MapDeviceBean) {
|
private fun setDeviceData(mapDeviceBean: MapDeviceBean) {
|
||||||
@@ -241,17 +285,7 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
|
|
||||||
private fun updateDisabledState(mapDeviceBean: MapDeviceBean) {
|
private fun updateDisabledState(mapDeviceBean: MapDeviceBean) {
|
||||||
mapDeviceBean.apply {
|
mapDeviceBean.apply {
|
||||||
if (SRBleUtil.instance.isMacConnect(deviceMacId)) {
|
setDisabledState(!Util.getLedControlState(deviceMacId,mapDeviceBean))
|
||||||
setDisabledState(false)
|
|
||||||
} else {
|
|
||||||
//是否超时上报
|
|
||||||
val isTimeoutReport = Util.isTimeoutReport(updateTime)
|
|
||||||
if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) {
|
|
||||||
setDisabledState(true)
|
|
||||||
} else {
|
|
||||||
setDisabledState(false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,12 +457,24 @@ class LedLightActivity : BaseActivity<ActivityLedLightBinding>(ActivityLedLightB
|
|||||||
private fun setLedSwitch() {
|
private fun setLedSwitch() {
|
||||||
mViewBinding.ledLightOpenAndClose.switch.apply {
|
mViewBinding.ledLightOpenAndClose.switch.apply {
|
||||||
mMapDeviceBean?.let {
|
mMapDeviceBean?.let {
|
||||||
if (isChecked) {
|
mViewBinding.ledLightOpenAndClose.accessoryType =
|
||||||
it.ledSwitch = ConstantInt.Open
|
QMUICommonListItemView.ACCESSORY_TYPE_NONE
|
||||||
setBleLedMode(it.ledMode)
|
mViewBinding.ilLedLightBtnState.root.visibility = View.VISIBLE
|
||||||
|
val ledSwitch = if (it.ledSwitch == ConstantInt.Open) {
|
||||||
|
ConstantInt.Close
|
||||||
} else {
|
} else {
|
||||||
it.ledSwitch = ConstantInt.Close
|
ConstantInt.Open
|
||||||
setBleLedMode(0)
|
}
|
||||||
|
if (BleManager.getInstance().isConnected(it.deviceMacId)) {
|
||||||
|
//蓝牙控制
|
||||||
|
mBleTrackDeviceBean?.apply {
|
||||||
|
SRBleUtil.instance.setBleLedSwitch(mContext, bleDevice, ledSwitch)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//远程控制
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, it.deviceServerId, ledSwitch, ConstantInt.Type2
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,467 @@
|
|||||||
|
package com.abbidot.tracker.ui.activity.device.set
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.graphics.drawable.ColorDrawable
|
||||||
|
import android.view.Gravity
|
||||||
|
import android.view.View
|
||||||
|
import androidx.activity.viewModels
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
|
import androidx.core.view.isGone
|
||||||
|
import com.abbidot.baselibrary.constant.ConState
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
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.adapter.LedLightColorAdapter
|
||||||
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
|
import com.abbidot.tracker.base.BaseDialog
|
||||||
|
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||||
|
import com.abbidot.tracker.bean.MapDeviceBean
|
||||||
|
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.ActivityLedLightBinding
|
||||||
|
import com.abbidot.tracker.deprecated.ui.activity.vm.LedLightViewModel
|
||||||
|
import com.abbidot.tracker.util.Util
|
||||||
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
|
import com.abbidot.tracker.util.bluetooth.SRBleCmdUtil
|
||||||
|
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||||
|
import com.abbidot.tracker.vm.ConnectionDeviceViewModel
|
||||||
|
import com.abbidot.tracker.vm.TrackerInfoViewModel
|
||||||
|
import com.clj.fastble.BleManager
|
||||||
|
import com.daimajia.androidanimations.library.Techniques
|
||||||
|
import com.daimajia.androidanimations.library.YoYo
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* LedLight颜色光源设置
|
||||||
|
*/
|
||||||
|
class LedLightActivityV0 : BaseActivity<ActivityLedLightBinding>(ActivityLedLightBinding::inflate) {
|
||||||
|
|
||||||
|
private val mLedLightViewModel: LedLightViewModel by viewModels()
|
||||||
|
private val mTrackerManageSetViewModel: TrackerInfoViewModel by viewModels()
|
||||||
|
private val mConnectionDeviceViewModel: ConnectionDeviceViewModel by viewModels()
|
||||||
|
|
||||||
|
private var mPetBean: PetBean? = 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 var isFinishSave = false
|
||||||
|
|
||||||
|
//禁用模式
|
||||||
|
private var isDisabledMode = true
|
||||||
|
|
||||||
|
override fun getTopBar() = mViewBinding.ilLedLightBar.titleTopBar
|
||||||
|
|
||||||
|
override fun initData() {
|
||||||
|
super.initData()
|
||||||
|
setTopBarTitle(R.string.tracker_manage_set_led)
|
||||||
|
setLeftBackImage(R.drawable.icon_white_back_svg)
|
||||||
|
// initStatus()
|
||||||
|
|
||||||
|
mPetBean = Util.getParcelableAdaptive(intent, ConstantString.Pet, PetBean::class.java)
|
||||||
|
|
||||||
|
mLedModeList = mutableListOf(
|
||||||
|
getString(R.string.tracker_light_mode_sustained),
|
||||||
|
getString(R.string.tracker_light_mode_breathing),
|
||||||
|
// getString(R.string.tracker_light_mode_slow_flash),
|
||||||
|
getString(R.string.tracker_light_mode_flash)
|
||||||
|
)
|
||||||
|
|
||||||
|
ViewUtil.instance.showQMUICommonListItemView(
|
||||||
|
mContext,
|
||||||
|
mViewBinding.ledLightOpenAndClose,
|
||||||
|
null,
|
||||||
|
getString(R.string.tracker_manage_set_led)
|
||||||
|
)
|
||||||
|
|
||||||
|
val builder = ViewUtil.instance.showBottomSheetList(mContext, { dialog, _, position, _ ->
|
||||||
|
mMapDeviceBean?.apply {
|
||||||
|
dialog.dismiss()
|
||||||
|
ledMode = position + 1
|
||||||
|
mViewBinding.ledLightMode.detailText = mLedModeList[position]
|
||||||
|
mViewBinding.ledLightOpenAndClose.switch.let {
|
||||||
|
if (!it.isChecked) {
|
||||||
|
it.isChecked = true
|
||||||
|
}
|
||||||
|
setBleLedMode(ledMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
for (i in 0 until mLedModeList.size) builder.addItem(mLedModeList[i])
|
||||||
|
|
||||||
|
mViewBinding.ledLightMode.apply {
|
||||||
|
ViewUtil.instance.showQMUICommonListItemView(mContext, this, {
|
||||||
|
if (!isDisabledMode) builder.build().show()
|
||||||
|
}, 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 {
|
||||||
|
ilLedLightIssueLayout.let {
|
||||||
|
it.tvIssueOneBigTitle.setText(R.string.txt_led_light_set)
|
||||||
|
it.tvIssueTwoSmallOneTitle.setText(R.string.txt_bluetooth_setup)
|
||||||
|
it.tvIssueTwoSmallOneTitle.setText(R.string.txt_bluetooth_setup)
|
||||||
|
it.tvIssueTwoSmallTitleOneContent.setText(R.string.txt_bluetooth_setup_dec)
|
||||||
|
it.tvIssueTwoSmallTwoTitle.setText(R.string.txt_network_setup)
|
||||||
|
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(
|
||||||
|
ledLightBluetoothTips.trbBleConnectState,
|
||||||
|
btnLedLightSetSave,
|
||||||
|
btnLedLightIssue,
|
||||||
|
ilLedLightIssueLayout.tvCloseIssueBtn,
|
||||||
|
mViewBinding.ledLightOpenAndClose.switch
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
setDisabledState(true)
|
||||||
|
mPetBean?.apply {
|
||||||
|
//查找是否连接了蓝牙
|
||||||
|
SRBleUtil.instance.getConnectMacDevice(macID)?.let {
|
||||||
|
updateConState(it, false)
|
||||||
|
}
|
||||||
|
mTrackerManageSetViewModel.getPetTrackerInfo(this@LedLightActivityV0, deviceId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun liveDataObserve() {
|
||||||
|
mTrackerManageSetViewModel.mTrackerInfoLiveData.observe(this) {
|
||||||
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
val data = it.getOrNull()
|
||||||
|
data?.apply {
|
||||||
|
mMapDeviceBean = data
|
||||||
|
mOldMapDeviceBean = data.copy()
|
||||||
|
setDeviceData(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
mLedLightViewModel.mSetLedLightLiveData.observe(this) {
|
||||||
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
showToast(R.string.txt_change_successful, isFinish = true)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
|
isFinishSave = false
|
||||||
|
mViewBinding.btnLedLightSetSave.isEnabled = true
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//接收开蓝牙操作,然后搜索连接设备
|
||||||
|
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
||||||
|
mViewBinding.ledLightBluetoothTips.trbBleConnectState.let { view ->
|
||||||
|
if (!isDisabledMode) {
|
||||||
|
ViewUtil.instance.bleConActionState(this, view, conState)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//接收蓝牙连接状态
|
||||||
|
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
||||||
|
mPetBean?.apply {
|
||||||
|
if (ble.mac == macID) {
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
updateDisabledState(it)
|
||||||
|
}
|
||||||
|
updateConState(ble)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setDeviceData(mapDeviceBean: MapDeviceBean) {
|
||||||
|
mapDeviceBean.apply {
|
||||||
|
mViewBinding.let {
|
||||||
|
it.ledLightOpenAndClose.switch.isChecked = ledSwitch == ConstantInt.Open
|
||||||
|
|
||||||
|
setLedLightColor(
|
||||||
|
Color.rgb(ledRedValue, ledGreenValue, ledBlueValue), true
|
||||||
|
)
|
||||||
|
if (ledMode == 0 || ledMode > mLedModeList.size) ledMode = 1
|
||||||
|
it.ledLightMode.detailText = mLedModeList[ledMode - 1]
|
||||||
|
|
||||||
|
updateDisabledState(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateDisabledState(mapDeviceBean: MapDeviceBean) {
|
||||||
|
mapDeviceBean.apply {
|
||||||
|
if (SRBleUtil.instance.isMacConnect(deviceMacId)) {
|
||||||
|
setDisabledState(false)
|
||||||
|
} else {
|
||||||
|
//是否超时上报
|
||||||
|
val isTimeoutReport = Util.isTimeoutReport(updateTime)
|
||||||
|
if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) {
|
||||||
|
setDisabledState(true)
|
||||||
|
} else {
|
||||||
|
setDisabledState(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setDisabledState(isDisabled: Boolean) {
|
||||||
|
isDisabledMode = isDisabled
|
||||||
|
mViewBinding.apply {
|
||||||
|
val tColor = if (isDisabled) {
|
||||||
|
btnLedLightSetSave.visibility = View.GONE
|
||||||
|
ledLightBluetoothTips.root.visibility = View.GONE
|
||||||
|
R.color.grey_color
|
||||||
|
} else {
|
||||||
|
btnLedLightSetSave.visibility = View.VISIBLE
|
||||||
|
ledLightBluetoothTips.root.visibility = View.VISIBLE
|
||||||
|
R.color.qmui_config_color_gray_1
|
||||||
|
}
|
||||||
|
ledLightOpenAndClose.textView.setTextColor(ContextCompat.getColor(mContext, tColor))
|
||||||
|
ledLightMode.textView.setTextColor(ContextCompat.getColor(mContext, tColor))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新设备连接状态
|
||||||
|
*/
|
||||||
|
private fun updateConState(trackBleDevice: BleTrackDeviceBean, isShowToast: Boolean = true) {
|
||||||
|
mBleTrackDeviceBean = trackBleDevice
|
||||||
|
mViewBinding.ledLightBluetoothTips.trbBleConnectState.let { view ->
|
||||||
|
val bgColor = if (trackBleDevice.conState == ConState.CONNECTED) {
|
||||||
|
view.text = getString(R.string.tracker_manage_set_ble_connect)
|
||||||
|
ContextCompat.getColor(mContext, R.color.cyan_color1)
|
||||||
|
} else {
|
||||||
|
view.text = getString(R.string.tracker_manage_set_ble_unconnect)
|
||||||
|
ContextCompat.getColor(mContext, R.color.red_color4)
|
||||||
|
}
|
||||||
|
view.setBackgroundColor(bgColor)
|
||||||
|
}
|
||||||
|
if (!isDisabledMode && isShowToast) {
|
||||||
|
ViewUtil.instance.bleConStateToast(this, trackBleDevice.conState, Gravity.CENTER)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
mOldMapDeviceBean?.let {
|
||||||
|
if (it == mMapDeviceBean) {
|
||||||
|
super.leftBackOnClick()
|
||||||
|
} else {
|
||||||
|
//判断是否有蓝牙连接
|
||||||
|
if (BleManager.getInstance().isConnected(mBleTrackDeviceBean!!.bleDevice)) {
|
||||||
|
finishAndSave(ConstantInt.Type1)
|
||||||
|
} else {
|
||||||
|
super.leftBackOnClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
super.leftBackOnClick()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存设置数据
|
||||||
|
*/
|
||||||
|
private fun finishAndSave(modeType: Int) {
|
||||||
|
if (null == mMapDeviceBean) {
|
||||||
|
finish()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mMapDeviceBean?.apply {
|
||||||
|
isFinishSave = true
|
||||||
|
mLedLightViewModel.setLedLight(this@LedLightActivityV0, 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)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手动连接/断开设备
|
||||||
|
*/
|
||||||
|
private fun connectionBtn(btnString: String) {
|
||||||
|
mPetBean?.apply {
|
||||||
|
ViewUtil.instance.connectionBtn(mContext, btnString, macID) {
|
||||||
|
mConnectionDeviceViewModel.connectDeviceToMac(this@LedLightActivityV0, macID)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 显示led问题
|
||||||
|
*/
|
||||||
|
private fun showLedIssue() {
|
||||||
|
mViewBinding.apply {
|
||||||
|
if (ilLedLightIssueLayout.root.isGone) {
|
||||||
|
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
|
||||||
|
ilLedLightIssueLayout.root.visibility = View.VISIBLE
|
||||||
|
}.playOn(ilLedLightIssueLayout.root)
|
||||||
|
} else {
|
||||||
|
YoYo.with(Techniques.SlideOutDown).duration(600).onEnd {
|
||||||
|
ilLedLightIssueLayout.root.visibility = View.GONE
|
||||||
|
}.playOn(ilLedLightIssueLayout.root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setLedSwitch() {
|
||||||
|
mViewBinding.ledLightOpenAndClose.switch.apply {
|
||||||
|
mMapDeviceBean?.let {
|
||||||
|
if (isChecked) {
|
||||||
|
it.ledSwitch = ConstantInt.Open
|
||||||
|
setBleLedMode(it.ledMode)
|
||||||
|
} else {
|
||||||
|
it.ledSwitch = ConstantInt.Close
|
||||||
|
setBleLedMode(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onClick(v: View?) {
|
||||||
|
mViewBinding.apply {
|
||||||
|
when (v) {
|
||||||
|
//手动连接设备
|
||||||
|
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()
|
||||||
|
ilLedLightIssueLayout.tvCloseIssueBtn -> showLedIssue()
|
||||||
|
ledLightOpenAndClose.switch -> {
|
||||||
|
if (isDisabledMode) {
|
||||||
|
ledLightOpenAndClose.switch.isChecked =
|
||||||
|
!ledLightOpenAndClose.switch.isChecked
|
||||||
|
} else setLedSwitch()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
|
super.onDestroy()
|
||||||
|
mViewBinding.selectColorPaintView.recycle()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -137,6 +137,14 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
isShowFence = Util.getShowFenceSp()
|
isShowFence = Util.getShowFenceSp()
|
||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
|
ViewUtil.instance.viewRotationAnimator(
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.ilDeviceLightBtnState.ivLedBtnState,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
ViewUtil.instance.viewRotationAnimator(
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.ilDeviceLightBtnState.ivLedBtnState,
|
||||||
|
true
|
||||||
|
)
|
||||||
ilLiveV2BluetoothFindDevice.ivMapLiveV2BleConState.setValue(0)
|
ilLiveV2BluetoothFindDevice.ivMapLiveV2BleConState.setValue(0)
|
||||||
mFragment = mHomeMapCommon.getMapFragment(
|
mFragment = mHomeMapCommon.getMapFragment(
|
||||||
mContext,
|
mContext,
|
||||||
@@ -148,6 +156,32 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
ivMapLiveV2RefreshBtn, mShowCenterLocation
|
ivMapLiveV2RefreshBtn, mShowCenterLocation
|
||||||
)
|
)
|
||||||
|
setLedBtnEnabled(false)
|
||||||
|
mPetBean?.let { p ->
|
||||||
|
if (p.deviceType == ConstantInt.Type2) {
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
|
getString(R.string.txt_tone)
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
R.drawable.icon_sound_image, 0, 0, 0
|
||||||
|
)
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
|
getString(R.string.txt_tone)
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
R.drawable.icon_sound_image, 0, 0, 0
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
|
getString(R.string.txt_light)
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
R.drawable.icon_light_svg, 0, 0, 0
|
||||||
|
)
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
||||||
|
getString(R.string.txt_light)
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
|
R.drawable.icon_light_svg, 0, 0, 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
ilLiveV2OperateLayout.tvLiveV2Speed.text = "--$mSpeedUnit"
|
ilLiveV2OperateLayout.tvLiveV2Speed.text = "--$mSpeedUnit"
|
||||||
ilLiveV2OperateLayout.tvLiveV2Distance.text = "--$mDistanceUnit"
|
ilLiveV2OperateLayout.tvLiveV2Distance.text = "--$mDistanceUnit"
|
||||||
llLiveV2MapTopPet.ivTopPetBtnSmall.setImageResource(R.drawable.icon_map_type)
|
llLiveV2MapTopPet.ivTopPetBtnSmall.setImageResource(R.drawable.icon_map_type)
|
||||||
@@ -258,6 +292,7 @@ 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
|
||||||
@@ -282,7 +317,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
} else {
|
} else {
|
||||||
mPetBean?.apply {
|
mPetBean?.apply {
|
||||||
//获取首页设备信息状态
|
//获取首页设备信息状态
|
||||||
mMapViewModel.getMapDeviceStatus(deviceId, false)
|
mMapViewModel.getMapDeviceStatus(deviceId, !isLiveJump)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -358,15 +393,19 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
|
|
||||||
//接收蓝牙连接状态
|
//接收蓝牙连接状态
|
||||||
XEventBus.observe(this, EventName.ConnectDeviceState) { trackBle: BleTrackDeviceBean ->
|
XEventBus.observe(this, EventName.ConnectDeviceState) { trackBle: BleTrackDeviceBean ->
|
||||||
mPetBean?.apply {
|
mPetBean?.let { p ->
|
||||||
if (trackBle.mac == macID && trackBle.conState != ConState.CONNECTED) {
|
if (trackBle.mac == p.macID && trackBle.conState != ConState.CONNECTED) {
|
||||||
//隐藏蓝牙nearby
|
//隐藏蓝牙nearby
|
||||||
mViewBinding.ilLiveV3MapDeviceMsg.root.visibility = View.GONE
|
mViewBinding.ilLiveV3MapDeviceMsg.root.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
mMapDeviceBean?.apply {
|
||||||
mMapDeviceBean?.apply {
|
if (trackBle.mac == deviceMacId) {
|
||||||
if (trackBle.mac == deviceMacId) {
|
updateConState(trackBle)
|
||||||
updateConState(trackBle)
|
//分享设备不可以控制灯
|
||||||
|
if (p.shared == ConstantInt.NoShare) {
|
||||||
|
setLedBtnEnabled(Util.getLedControlState(p.macID, this))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -393,9 +432,30 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
mLedLightViewModel.mLedSwitchLiveData.observe(this) {
|
mLedLightViewModel.mLedSwitchLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
// mViewBinding.cbLiveV2DeviceLightSwitch.isChecked =
|
mPetBean?.apply {
|
||||||
// !mViewBinding.cbLiveV2DeviceLightSwitch.isChecked
|
if (!SRBleUtil.instance.isMacConnect(macID)) {
|
||||||
// showToast(R.string.txt_please_wait)
|
mViewBinding.let { m ->
|
||||||
|
m.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
m.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onErrorCode() {
|
||||||
|
setErrorLedState()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
|
setErrorLedState()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -418,6 +478,26 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setErrorLedState() {
|
||||||
|
mPetBean?.apply {
|
||||||
|
if (!SRBleUtil.instance.isMacConnect(macID)) {
|
||||||
|
isLedOpen = !isLedOpen
|
||||||
|
mViewBinding.let { m ->
|
||||||
|
m.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
m.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun finishActivity() {
|
private fun finishActivity() {
|
||||||
val intent = Intent()
|
val intent = Intent()
|
||||||
mMapDeviceBean?.let {
|
mMapDeviceBean?.let {
|
||||||
@@ -483,6 +563,18 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data0 == 3 && data1 == 1) {
|
} else if (data0 == 3 && data1 == 1) {
|
||||||
|
mViewBinding.let { m ->
|
||||||
|
m.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
m.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.let { i ->
|
||||||
|
i.cbDeviceLightSwitch.isChecked = isLedOpen
|
||||||
|
i.cbDeviceLightSwitch.visibility = View.VISIBLE
|
||||||
|
i.ilDeviceLightBtnState.root.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
val modeType = if (data2 == 0) {
|
val modeType = if (data2 == 0) {
|
||||||
ConstantInt.Type1
|
ConstantInt.Type1
|
||||||
} else {
|
} else {
|
||||||
@@ -572,24 +664,37 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
* 远程设置led开关
|
* 远程设置led开关
|
||||||
*/
|
*/
|
||||||
private fun setLedSwitch() {
|
private fun setLedSwitch() {
|
||||||
isLedOpen = !isLedOpen
|
mPetBean?.let { p ->
|
||||||
mViewBinding.apply {
|
//分享设备不可以点击控制灯
|
||||||
//屏蔽点击就变状态
|
if (p.shared != ConstantInt.NoShare) {
|
||||||
// cbLiveV2DeviceLightSwitch.isChecked = !cbLiveV2DeviceLightSwitch.isChecked
|
return
|
||||||
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isChecked = isLedOpen
|
}
|
||||||
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isChecked =
|
isLedOpen = !isLedOpen
|
||||||
isLedOpen
|
mViewBinding.apply {
|
||||||
val ledSwitch = if (isLedOpen) ConstantInt.Open
|
//屏蔽点击就变状态
|
||||||
else ConstantInt.Close
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.let {
|
||||||
|
it.cbDeviceLightSwitch.isChecked = !isLedOpen
|
||||||
|
it.cbDeviceLightSwitch.visibility = View.GONE
|
||||||
|
it.ilDeviceLightBtnState.root.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.let {
|
||||||
|
it.cbDeviceLightSwitch.isChecked = !isLedOpen
|
||||||
|
it.cbDeviceLightSwitch.visibility = View.GONE
|
||||||
|
it.ilDeviceLightBtnState.root.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
|
||||||
mMapDeviceBean?.apply {
|
val ledSwitch = if (isLedOpen) ConstantInt.Open
|
||||||
this.ledSwitch = ledSwitch
|
else ConstantInt.Close
|
||||||
if (BleManager.getInstance().isConnected(deviceMacId)) {
|
|
||||||
setLedSwitch(ledSwitch)
|
mMapDeviceBean?.apply {
|
||||||
} else {
|
this.ledSwitch = ledSwitch
|
||||||
mLedLightViewModel.setLedSwitch(
|
if (BleManager.getInstance().isConnected(deviceMacId)) {
|
||||||
null, deviceServerId, ledSwitch, ConstantInt.Type2
|
setLedSwitch(ledSwitch)
|
||||||
)
|
} else {
|
||||||
|
mLedLightViewModel.setLedSwitch(
|
||||||
|
null, deviceServerId, ledSwitch, ConstantInt.Type2
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -705,41 +810,21 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
} else {
|
} else {
|
||||||
updateConState(bleConDevice)
|
updateConState(bleConDevice)
|
||||||
}
|
}
|
||||||
}
|
mViewBinding.let {
|
||||||
|
//分享设备不可以控制灯
|
||||||
mViewBinding.let {
|
if (shared == ConstantInt.NoShare) {
|
||||||
if (deviceType == ConstantInt.Type2) {
|
setLedBtnEnabled(Util.getLedControlState(deviceMacId, mapDeviceBean))
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
}
|
||||||
getString(R.string.txt_tone)
|
isLedOpen = ledSwitch == ConstantInt.Open
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isChecked =
|
||||||
R.drawable.icon_sound_image, 0, 0, 0
|
isLedOpen
|
||||||
)
|
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isChecked =
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
isLedOpen
|
||||||
getString(R.string.txt_tone)
|
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
|
||||||
R.drawable.icon_sound_image, 0, 0, 0
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.text =
|
|
||||||
getString(R.string.txt_light)
|
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
|
||||||
R.drawable.icon_light_svg, 0, 0, 0
|
|
||||||
)
|
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.text =
|
|
||||||
getString(R.string.txt_light)
|
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.tvDeviceLightSwitchTitle.setCompoundDrawablesWithIntrinsicBounds(
|
|
||||||
R.drawable.icon_light_svg, 0, 0, 0
|
|
||||||
)
|
|
||||||
}
|
|
||||||
isLedOpen = ledSwitch == ConstantInt.Open
|
|
||||||
it.ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isChecked =
|
|
||||||
isLedOpen
|
|
||||||
it.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isChecked =
|
|
||||||
isLedOpen
|
|
||||||
// it.tvLiveV2Speed.text = String.format(
|
// it.tvLiveV2Speed.text = String.format(
|
||||||
// getString(R.string.txt_mph_unit),
|
// getString(R.string.txt_mph_unit),
|
||||||
// Utils.formatDecimal(Util.kmhToMph(speed.toDouble()))
|
// Utils.formatDecimal(Util.kmhToMph(speed.toDouble()))
|
||||||
// )
|
// )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isShowFence) {
|
if (isShowFence) {
|
||||||
@@ -761,6 +846,16 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setLedBtnEnabled(btnEnabled: Boolean) {
|
||||||
|
mViewBinding.apply {
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.cbDeviceLightSwitch.isEnabled = btnEnabled
|
||||||
|
ilLiveV2OperateLayout.ilLiveV2DataLightSwitch.root.isEnabled = btnEnabled
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.root.isEnabled = btnEnabled
|
||||||
|
ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isEnabled =
|
||||||
|
btnEnabled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
||||||
mapDeviceBean.apply {
|
mapDeviceBean.apply {
|
||||||
mViewBinding.ilLiveV3MapDeviceBatteryLayout.let {
|
mViewBinding.ilLiveV3MapDeviceBatteryLayout.let {
|
||||||
@@ -796,7 +891,7 @@ class LiveActivityV3 : BaseActivity<ActivityLiveV3Binding>(ActivityLiveV3Binding
|
|||||||
mHomeMapCommon.setPetHeadIcon(imgurl, petType)
|
mHomeMapCommon.setPetHeadIcon(imgurl, petType)
|
||||||
|
|
||||||
//获取首页设备信息状态
|
//获取首页设备信息状态
|
||||||
mMapViewModel.getMapDeviceStatus(deviceId, false)
|
mMapViewModel.getMapDeviceStatus(deviceId, !isLiveJump)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.abbidot.tracker.bean.FencesBean
|
|||||||
import com.abbidot.tracker.bean.FirmwareBean
|
import com.abbidot.tracker.bean.FirmwareBean
|
||||||
import com.abbidot.tracker.bean.MapDeviceBean
|
import com.abbidot.tracker.bean.MapDeviceBean
|
||||||
import com.abbidot.tracker.bean.MenuTxtBean
|
import com.abbidot.tracker.bean.MenuTxtBean
|
||||||
|
import com.abbidot.tracker.bean.PetBean
|
||||||
import com.abbidot.tracker.bean.ReceiveDeviceData
|
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||||
import com.abbidot.tracker.bean.WiFiZoneBean
|
import com.abbidot.tracker.bean.WiFiZoneBean
|
||||||
import com.abbidot.tracker.constant.ConstantInt
|
import com.abbidot.tracker.constant.ConstantInt
|
||||||
@@ -92,6 +93,7 @@ class HomeTrackFragment :
|
|||||||
private var isDFUCallback = false
|
private var isDFUCallback = false
|
||||||
private var mFirmwareBean: FirmwareBean? = null
|
private var mFirmwareBean: FirmwareBean? = null
|
||||||
private var isSwitchPet = true
|
private var isSwitchPet = true
|
||||||
|
private var mLedMac = ""
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@@ -288,7 +290,6 @@ class HomeTrackFragment :
|
|||||||
// LogUtil.e("蓝牙连接,不使用接口数据更新状态")
|
// LogUtil.e("蓝牙连接,不使用接口数据更新状态")
|
||||||
// } else {
|
// } else {
|
||||||
// }
|
// }
|
||||||
addMenuListData()
|
|
||||||
setStateData(data)
|
setStateData(data)
|
||||||
setZoneData(data)
|
setZoneData(data)
|
||||||
}
|
}
|
||||||
@@ -384,11 +385,54 @@ class HomeTrackFragment :
|
|||||||
|
|
||||||
}
|
}
|
||||||
mLedLightViewModel.mLedSwitchLiveData.observe(viewLifecycleOwner) {
|
mLedLightViewModel.mLedSwitchLiveData.observe(viewLifecycleOwner) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(
|
||||||
override fun onResult(any: Any) {
|
it,
|
||||||
|
object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
getHomeV2Activity()?.let { h ->
|
||||||
|
h.getPet(false)?.let { p ->
|
||||||
|
if (mLedMac == p.macID && !BleManager.getInstance()
|
||||||
|
.isConnected(p.macID)
|
||||||
|
) {
|
||||||
|
mTrackStateList[5].apply {
|
||||||
|
val ledSwitch =
|
||||||
|
if (menuValue == getString(R.string.tracker_manage_set_led_on)) {
|
||||||
|
ConstantInt.Close
|
||||||
|
} else {
|
||||||
|
ConstantInt.Open
|
||||||
|
}
|
||||||
|
setLedState(ledSwitch)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onErrorCode() {
|
||||||
|
setLedErrorState()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
|
setLedErrorState()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
isRequestErrorTip = mLedMac == getHomeV2Activity()!!.getPet(false)!!.macID,
|
||||||
|
isShowCodeError = mLedMac == getHomeV2Activity()!!.getPet(false)!!.macID
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setLedErrorState() {
|
||||||
|
getHomeV2Activity()?.apply {
|
||||||
|
getPet(false)?.let {
|
||||||
|
if (mLedMac == it.macID && !BleManager.getInstance().isConnected(it.macID)) {
|
||||||
|
mTrackStateList[5].apply {
|
||||||
|
state = ConstantInt.Type0
|
||||||
|
type = ConstantInt.Type0
|
||||||
|
mHomePetTrackStateAdapter.notifyItemChanged(5)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,13 +440,20 @@ class HomeTrackFragment :
|
|||||||
isSwitchPet = switchPet
|
isSwitchPet = switchPet
|
||||||
getHomeV2Activity()?.let {
|
getHomeV2Activity()?.let {
|
||||||
it.getPet()?.apply {
|
it.getPet()?.apply {
|
||||||
|
|
||||||
if (isSwitchPet) {
|
if (isSwitchPet) {
|
||||||
|
|
||||||
isSwitchPet = false
|
isSwitchPet = false
|
||||||
|
mTrackStateList[5].apply {
|
||||||
|
state = ConstantInt.Type0
|
||||||
|
type = ConstantInt.SpecialType
|
||||||
|
menuValue = getString(R.string.tracker_manage_set_led_off)
|
||||||
|
mHomePetTrackStateAdapter.notifyItemChanged(5)
|
||||||
|
}
|
||||||
mTrackMenuAdapter.notifyItemRangeRemoved(0, mTrackMenuList.size)
|
mTrackMenuAdapter.notifyItemRangeRemoved(0, mTrackMenuList.size)
|
||||||
mTrackMenuList.clear()
|
mTrackMenuList.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addMenuListData(this)
|
||||||
mTrackerInfoViewModel.getPetTrackerInfo(it, deviceId)
|
mTrackerInfoViewModel.getPetTrackerInfo(it, deviceId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -470,8 +521,8 @@ class HomeTrackFragment :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addMenuListData() {
|
private fun addMenuListData(petBean: PetBean) {
|
||||||
mMapDeviceBean?.apply {
|
petBean.apply {
|
||||||
if (mTrackMenuList.size == 0) {
|
if (mTrackMenuList.size == 0) {
|
||||||
if (deviceType == ConstantInt.Type1) {
|
if (deviceType == ConstantInt.Type1) {
|
||||||
ViewUtil.instance.addMenuBean(
|
ViewUtil.instance.addMenuBean(
|
||||||
@@ -710,11 +761,9 @@ class HomeTrackFragment :
|
|||||||
it.menuName = getString(R.string.txt_tone)
|
it.menuName = getString(R.string.txt_tone)
|
||||||
}
|
}
|
||||||
it.colorRedId = R.color.orange_color3
|
it.colorRedId = R.color.orange_color3
|
||||||
it.type = if (SRBleUtil.instance.isMacConnect(deviceMacId)) {
|
it.type = if (Util.getLedControlState(deviceMacId, this)) ConstantInt.Type0
|
||||||
ConstantInt.Type0
|
else ConstantInt.SpecialType
|
||||||
} else if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) {
|
|
||||||
ConstantInt.SpecialType
|
|
||||||
} else ConstantInt.Type0
|
|
||||||
it.menuValue = if (ledSwitch == ConstantInt.Open) {
|
it.menuValue = if (ledSwitch == ConstantInt.Open) {
|
||||||
it.colorRedId = R.color.blue_color1
|
it.colorRedId = R.color.blue_color1
|
||||||
getString(R.string.tracker_manage_set_led_on)
|
getString(R.string.tracker_manage_set_led_on)
|
||||||
@@ -887,7 +936,7 @@ class HomeTrackFragment :
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (data0 == 3 && data1 == 1) {
|
} else if (getHomeV2Activity()!!.isFrontRunning && data0 == 3 && data1 == 1) {
|
||||||
val ledSwitch =
|
val ledSwitch =
|
||||||
if (mTrackStateList[5].menuValue == getString(R.string.tracker_manage_set_led_on)) {
|
if (mTrackStateList[5].menuValue == getString(R.string.tracker_manage_set_led_on)) {
|
||||||
ConstantInt.Close
|
ConstantInt.Close
|
||||||
@@ -1082,13 +1131,17 @@ class HomeTrackFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
mMapDeviceBean?.let {
|
mMapDeviceBean?.let {
|
||||||
|
state = ConstantInt.Type1
|
||||||
|
type = ConstantInt.SpecialType
|
||||||
|
mHomePetTrackStateAdapter.notifyItemChanged(5)
|
||||||
|
mLedMac = it.deviceMacId
|
||||||
if (BleManager.getInstance().isConnected(it.deviceMacId)) {
|
if (BleManager.getInstance().isConnected(it.deviceMacId)) {
|
||||||
//蓝牙控制
|
//蓝牙控制
|
||||||
getBleTrackDeviceBean(false)?.let { ble ->
|
getBleTrackDeviceBean(false)?.let { ble ->
|
||||||
SRBleUtil.instance.setBleLedSwitch(mContext!!, ble.bleDevice, ledSwitch)
|
SRBleUtil.instance.setBleLedSwitch(mContext!!, ble.bleDevice, ledSwitch)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setLedState(ledSwitch)
|
// setLedState(ledSwitch)
|
||||||
//远程控制
|
//远程控制
|
||||||
mLedLightViewModel.setLedSwitch(
|
mLedLightViewModel.setLedSwitch(
|
||||||
null, it.deviceServerId, ledSwitch, ConstantInt.Type2
|
null, it.deviceServerId, ledSwitch, ConstantInt.Type2
|
||||||
@@ -1103,6 +1156,8 @@ class HomeTrackFragment :
|
|||||||
*/
|
*/
|
||||||
private fun setLedState(ledSwitch: Int) {
|
private fun setLedState(ledSwitch: Int) {
|
||||||
mTrackStateList[5].apply {
|
mTrackStateList[5].apply {
|
||||||
|
state = ConstantInt.Type0
|
||||||
|
type = ConstantInt.Type0
|
||||||
colorRedId = R.color.orange_color3
|
colorRedId = R.color.orange_color3
|
||||||
menuValue = if (ledSwitch == ConstantInt.Open) {
|
menuValue = if (ledSwitch == ConstantInt.Open) {
|
||||||
colorRedId = R.color.blue_color1
|
colorRedId = R.color.blue_color1
|
||||||
|
|||||||
@@ -826,6 +826,22 @@ class Util {
|
|||||||
else -> R.drawable.icon_tracker_device_small
|
else -> R.drawable.icon_tracker_device_small
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取LED是否可以控制
|
||||||
|
*/
|
||||||
|
fun getLedControlState(mac: String, mapDeviceBean: MapDeviceBean): Boolean {
|
||||||
|
var isControl: Boolean
|
||||||
|
mapDeviceBean.apply {
|
||||||
|
//是否超时上报
|
||||||
|
val isTimeoutReport = isTimeoutReport(updateTime)
|
||||||
|
isControl = if (powerSwitch == ConstantInt.Type3) false
|
||||||
|
else if (SRBleUtil.instance.isMacConnect(mac)) true
|
||||||
|
else if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) false
|
||||||
|
else true
|
||||||
|
}
|
||||||
|
return isControl
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,16 +113,19 @@ class GeoCoderViewModel : ViewModel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
searchResult.address?.let {
|
searchResult.address?.let {
|
||||||
|
if (!TextUtils.isEmpty(it.houseNumber)) {
|
||||||
|
address += "${it.houseNumber} "
|
||||||
|
}
|
||||||
if (!TextUtils.isEmpty(it.street)) {
|
if (!TextUtils.isEmpty(it.street)) {
|
||||||
address += "${it.street} "
|
address += "${it.street} "
|
||||||
}
|
}
|
||||||
// if (!TextUtils.isEmpty(it.houseNumber)) {
|
if (TextUtils.isEmpty(address) && !TextUtils.isEmpty(it.neighborhood)) {
|
||||||
// address += "${it.houseNumber} "
|
address += "${it.neighborhood} "
|
||||||
// }
|
}
|
||||||
if (!TextUtils.isEmpty(it.locality)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(it.locality)) {
|
||||||
address += "${it.locality} "
|
address += "${it.locality} "
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(it.place)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(it.place)) {
|
||||||
address += "${it.place} "
|
address += "${it.place} "
|
||||||
}
|
}
|
||||||
if (isShowDetailAddress && !TextUtils.isEmpty(it.region)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(it.region)) {
|
||||||
@@ -131,6 +134,17 @@ class GeoCoderViewModel : ViewModel() {
|
|||||||
if (isShowDetailAddress && !TextUtils.isEmpty(it.country)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(it.country)) {
|
||||||
address += "${it.country}"
|
address += "${it.country}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//防止显示空的地址
|
||||||
|
if (TextUtils.isEmpty(address) && !TextUtils.isEmpty(it.locality)) {
|
||||||
|
address += "${it.locality} "
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(address) && !TextUtils.isEmpty(it.place)) {
|
||||||
|
address += "${it.place} "
|
||||||
|
}
|
||||||
|
if (TextUtils.isEmpty(address) && !TextUtils.isEmpty(it.region)) {
|
||||||
|
address += "${it.region} "
|
||||||
|
}
|
||||||
mRegion = it.region.toString()
|
mRegion = it.region.toString()
|
||||||
}
|
}
|
||||||
// address = address?.replace("null", "")
|
// address = address?.replace("null", "")
|
||||||
@@ -169,7 +183,7 @@ class GeoCoderViewModel : ViewModel() {
|
|||||||
if (isShowDetailAddress && !TextUtils.isEmpty(province)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(province)) {
|
||||||
address += province
|
address += province
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(city)) {
|
if (isShowDetailAddress && !TextUtils.isEmpty(city)) {
|
||||||
address += city
|
address += city
|
||||||
}
|
}
|
||||||
if (!TextUtils.isEmpty(district)) {
|
if (!TextUtils.isEmpty(district)) {
|
||||||
|
|||||||
@@ -458,15 +458,18 @@ class MapViewModel : ViewModel() {
|
|||||||
ViewUtil.instance.viewShow(closeBtn)
|
ViewUtil.instance.viewShow(closeBtn)
|
||||||
}
|
}
|
||||||
} else if (powerSwitch == ConstantInt.Type3) {
|
} else if (powerSwitch == ConstantInt.Type3) {
|
||||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
val image = if (batteryLevel == 100) {
|
||||||
R.drawable.icon_charge_image, 0, 0, 0
|
it.text = context.getString(R.string.txt_fully_charged)
|
||||||
)
|
R.drawable.icon_fully_charged_image
|
||||||
it.text = context.getString(R.string.txt_charging)
|
} else {
|
||||||
|
it.text = context.getString(R.string.txt_charging)
|
||||||
|
R.drawable.icon_charge_image
|
||||||
|
}
|
||||||
|
it.setCompoundDrawablesWithIntrinsicBounds(image, 0, 0, 0)
|
||||||
ViewUtil.instance.viewShow(closeBtn)
|
ViewUtil.instance.viewShow(closeBtn)
|
||||||
} else if (batteryLevel <= ConstantInt.LowBattery20) {
|
} else if (batteryLevel <= ConstantInt.LowBattery20) {
|
||||||
val lowBattery =
|
val lowBattery =
|
||||||
if (batteryLevel <= ConstantInt.LowBattery10) ConstantInt.LowBattery10
|
if (batteryLevel <= ConstantInt.LowBattery10) ConstantInt.LowBattery10
|
||||||
// else if (batteryLevel <= ConstantInt.LowBattery20) ConstantInt.LowBattery20
|
|
||||||
else ConstantInt.LowBattery20
|
else ConstantInt.LowBattery20
|
||||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
it.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_low_battery_image, 0, 0, 0
|
R.drawable.icon_low_battery_image, 0, 0, 0
|
||||||
|
|||||||
BIN
app/src/main/res/drawable-xhdpi/icon_fully_charged_image.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/icon_fully_charged_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 251 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_fully_charged_image.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_fully_charged_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 B |
BIN
app/src/main/res/drawable-xxxhdpi/icon_fully_charged_image.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/icon_fully_charged_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 331 B |
8
app/src/main/res/drawable/shape32_grey_color_bg.xml
Normal file
8
app/src/main/res/drawable/shape32_grey_color_bg.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:shape="rectangle">
|
||||||
|
<solid android:color="@color/white_color1" />
|
||||||
|
<corners android:radius="@dimen/dp_32" />
|
||||||
|
</shape>
|
||||||
|
|
||||||
@@ -1,11 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<item android:state_enabled="true">
|
||||||
android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/white" />
|
<solid android:color="@color/white" />
|
||||||
<stroke
|
<stroke android:width="@dimen/dp_1" android:color="@color/white_gray_color1" />
|
||||||
android:width="@dimen/dp_1"
|
<corners android:radius="@dimen/dp_44" />
|
||||||
android:color="@color/white_gray_color1" />
|
</shape>
|
||||||
<corners android:radius="@dimen/dp_44" />
|
</item>
|
||||||
</shape>
|
<item android:state_enabled="false">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/grey_color" />
|
||||||
|
<stroke android:width="@dimen/dp_1" android:color="@color/white_gray_color1" />
|
||||||
|
<corners android:radius="@dimen/dp_44" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
||||||
|
|
||||||
|
|||||||
@@ -74,17 +74,46 @@
|
|||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
<RelativeLayout
|
||||||
android:id="@+id/led_light_open_and_close"
|
android:layout_width="match_parent"
|
||||||
style="@style/my_QMUICommonListItemView_style"
|
android:layout_height="@dimen/dp_58"
|
||||||
android:layout_marginTop="@dimen/dp_22"
|
android:layout_marginTop="@dimen/dp_22">
|
||||||
app:qmui_accessory_type="switcher" />
|
|
||||||
|
|
||||||
<com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
<com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||||
android:id="@+id/led_light_mode"
|
android:id="@+id/led_light_open_and_close"
|
||||||
style="@style/my_QMUICommonListItemView_style"
|
style="@style/my_QMUICommonListItemView_style"
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
app:qmui_accessory_type="switcher" />
|
||||||
app:qmui_accessory_type="chevron" />
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/il_led_light_btn_state"
|
||||||
|
layout="@layout/layout_led_btn_state"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="@dimen/dp_20"
|
||||||
|
android:visibility="gone" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="@dimen/dp_58"
|
||||||
|
android:layout_marginTop="@dimen/dp_10">
|
||||||
|
|
||||||
|
<com.qmuiteam.qmui.widget.grouplist.QMUICommonListItemView
|
||||||
|
android:id="@+id/led_light_mode"
|
||||||
|
style="@style/my_QMUICommonListItemView_style"
|
||||||
|
app:qmui_accessory_type="chevron" />
|
||||||
|
|
||||||
|
<com.qmuiteam.qmui.widget.QMUILoadingView
|
||||||
|
android:id="@+id/lv_led_light_mode_loading"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginEnd="@dimen/dp_36" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
|||||||
@@ -39,4 +39,13 @@
|
|||||||
android:textColor="@color/blue_color1"
|
android:textColor="@color/blue_color1"
|
||||||
android:textSize="@dimen/textSize12"
|
android:textSize="@dimen/textSize12"
|
||||||
app:typeface="@string/roboto_bold_font" />
|
app:typeface="@string/roboto_bold_font" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_home_pet_btn_state"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_2"
|
||||||
|
android:src="@drawable/icon_refresh"
|
||||||
|
android:tint="@color/grey_color"
|
||||||
|
android:visibility="gone" />
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
@@ -10,9 +10,9 @@
|
|||||||
android:paddingVertical="@dimen/dp_8">
|
android:paddingVertical="@dimen/dp_8">
|
||||||
|
|
||||||
<com.abbidot.tracker.widget.TypefaceTextView
|
<com.abbidot.tracker.widget.TypefaceTextView
|
||||||
|
android:id="@+id/tv_device_light_switch_title"
|
||||||
style="@style/my_TextView_style_v2"
|
style="@style/my_TextView_style_v2"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:id="@+id/tv_device_light_switch_title"
|
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:drawableStart="@drawable/icon_light_svg"
|
android:drawableStart="@drawable/icon_light_svg"
|
||||||
android:text="@string/txt_light"
|
android:text="@string/txt_light"
|
||||||
@@ -22,4 +22,9 @@
|
|||||||
<androidx.appcompat.widget.AppCompatCheckBox
|
<androidx.appcompat.widget.AppCompatCheckBox
|
||||||
android:id="@+id/cb_device_light_switch"
|
android:id="@+id/cb_device_light_switch"
|
||||||
style="@style/my_checkbox_switch_style" />
|
style="@style/my_checkbox_switch_style" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/il_device_light_btn_state"
|
||||||
|
layout="@layout/layout_led_btn_state"
|
||||||
|
android:visibility="gone" />
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
15
app/src/main/res/layout/layout_led_btn_state.xml
Normal file
15
app/src/main/res/layout/layout_led_btn_state.xml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/shape32_grey_color_bg"
|
||||||
|
android:paddingHorizontal="@dimen/dp_16"
|
||||||
|
android:paddingVertical="@dimen/dp_4">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_led_btn_state"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:src="@drawable/icon_refresh"
|
||||||
|
android:tint="@color/grey_color" />
|
||||||
|
</LinearLayout>
|
||||||
@@ -3,8 +3,8 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="@dimen/dp_10"
|
android:background="@color/white"
|
||||||
android:background="@color/white">
|
android:paddingTop="@dimen/dp_10">
|
||||||
|
|
||||||
<com.abbidot.tracker.widget.TypefaceTextView
|
<com.abbidot.tracker.widget.TypefaceTextView
|
||||||
android:id="@+id/tv_live_v2_direction_title"
|
android:id="@+id/tv_live_v2_direction_title"
|
||||||
@@ -31,7 +31,6 @@
|
|||||||
android:layout_marginEnd="@dimen/dp_30"
|
android:layout_marginEnd="@dimen/dp_30"
|
||||||
android:layout_marginBottom="@dimen/dp_32" />
|
android:layout_marginBottom="@dimen/dp_32" />
|
||||||
|
|
||||||
|
|
||||||
<com.abbidot.tracker.widget.TypefaceTextView
|
<com.abbidot.tracker.widget.TypefaceTextView
|
||||||
android:id="@+id/tv_live_v2_speed"
|
android:id="@+id/tv_live_v2_speed"
|
||||||
style="@style/my_TextView_style_v2"
|
style="@style/my_TextView_style_v2"
|
||||||
@@ -100,9 +99,9 @@
|
|||||||
android:layout_above="@id/tv_live_v2_distance"
|
android:layout_above="@id/tv_live_v2_distance"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:text="距离"
|
android:text="距离"
|
||||||
android:visibility="gone"
|
|
||||||
android:textColor="@color/select_color3"
|
android:textColor="@color/select_color3"
|
||||||
android:textSize="@dimen/textSize12"
|
android:textSize="@dimen/textSize12"
|
||||||
|
android:visibility="gone"
|
||||||
app:typeface="@string/roboto_regular_font" />
|
app:typeface="@string/roboto_regular_font" />
|
||||||
|
|
||||||
<com.abbidot.tracker.widget.TypefaceRoundButton
|
<com.abbidot.tracker.widget.TypefaceRoundButton
|
||||||
|
|||||||
@@ -1073,4 +1073,6 @@
|
|||||||
<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>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user