1.修改基础套餐过期或退款,触发高级套餐功能提示过期去充值
2.去除地图启动移动动画 3.仅在首次启动APP时,提示一次蓝牙开关;去掉开启直播坚持蓝牙开关 4.输入wifi密码界面点击连接按钮收起键盘
This commit is contained in:
@@ -30,7 +30,7 @@ android {
|
|||||||
targetSdkVersion 35
|
targetSdkVersion 35
|
||||||
versionCode 2101
|
versionCode 2101
|
||||||
// versionName "2.1.1"
|
// versionName "2.1.1"
|
||||||
versionName "2.1.1-Beta1"
|
versionName "2.1.1-Beta2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ abstract class BaseFragment<T : ViewBinding>(
|
|||||||
var mContext: Context? = null
|
var mContext: Context? = null
|
||||||
var mLoadingDialog: QMUITipDialog? = null
|
var mLoadingDialog: QMUITipDialog? = null
|
||||||
|
|
||||||
|
//防止某个时间执行多次
|
||||||
|
var mLimitExecutionTime = 0L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ class PackageUpgradeDialog(activity: BaseActivity<*>, deviceId: String) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
mSubscriptionsOrderLiveData.removeObservers(mBaseActivity)
|
||||||
}
|
}
|
||||||
getSubscriptionsOrder()
|
getSubscriptionsOrder()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.abbidot.tracker.R
|
|||||||
import com.abbidot.tracker.adapter.ChangePetListDialogAdapter
|
import com.abbidot.tracker.adapter.ChangePetListDialogAdapter
|
||||||
import com.abbidot.tracker.adapter.ViewPagerAdapter
|
import com.abbidot.tracker.adapter.ViewPagerAdapter
|
||||||
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.PetBean
|
import com.abbidot.tracker.bean.PetBean
|
||||||
import com.abbidot.tracker.bean.ReceiveDeviceData
|
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||||
@@ -31,12 +30,10 @@ 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
|
||||||
import com.abbidot.tracker.databinding.ActivityHomeV2Binding
|
import com.abbidot.tracker.databinding.ActivityHomeV2Binding
|
||||||
import com.abbidot.tracker.dialog.CommonDialog2
|
|
||||||
import com.abbidot.tracker.dialog.CommonListDialog
|
import com.abbidot.tracker.dialog.CommonListDialog
|
||||||
import com.abbidot.tracker.receiver.BluetoothMonitorReceiver
|
import com.abbidot.tracker.receiver.BluetoothMonitorReceiver
|
||||||
import com.abbidot.tracker.ui.DebugActivity
|
import com.abbidot.tracker.ui.DebugActivity
|
||||||
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
||||||
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionPlanActivity
|
|
||||||
import com.abbidot.tracker.ui.fragment.account.AccountV2Fragment
|
import com.abbidot.tracker.ui.fragment.account.AccountV2Fragment
|
||||||
import com.abbidot.tracker.ui.fragment.data.ActivityV2Fragment
|
import com.abbidot.tracker.ui.fragment.data.ActivityV2Fragment
|
||||||
import com.abbidot.tracker.ui.fragment.data.RouteV2Fragment
|
import com.abbidot.tracker.ui.fragment.data.RouteV2Fragment
|
||||||
@@ -321,34 +318,6 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 套餐过期查询订单回调,防止和升级套餐查询套餐回调冲突
|
|
||||||
*/
|
|
||||||
private fun packageExpiresObserve() {
|
|
||||||
mSubscriptionViewModel.mSubscriptionsOrderLiveData.observe(this@HomeV2Activity) {
|
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
|
||||||
override fun onResult(any: Any) {
|
|
||||||
it.getOrNull()?.let { list ->
|
|
||||||
val pet = mPetList[mSelectPetPosition]
|
|
||||||
for (l in list) {
|
|
||||||
if (l.deviceId == pet.deviceId) {
|
|
||||||
Intent(
|
|
||||||
mContext, SubscriptionPlanActivity::class.java
|
|
||||||
).let { i ->
|
|
||||||
i.putExtra(ConstantString.LkSetMeal, l)
|
|
||||||
i.putExtra(ConstantString.RechargeType, ConstantInt.Type2)
|
|
||||||
startActivity(i)
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
mSubscriptionViewModel.mSubscriptionsOrderLiveData.removeObservers(this@HomeV2Activity)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun setPetData(petList: MutableList<PetBean>) {
|
private fun setPetData(petList: MutableList<PetBean>) {
|
||||||
mPetList.addAll(petList)
|
mPetList.addAll(petList)
|
||||||
if (mSelectPetPosition > mPetList.size - 1) {
|
if (mSelectPetPosition > mPetList.size - 1) {
|
||||||
@@ -369,6 +338,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
getPet(false)?.apply {
|
getPet(false)?.apply {
|
||||||
mLogBleReportViewModel.uploadLog(mContext, macID)
|
mLogBleReportViewModel.uploadLog(mContext, macID)
|
||||||
}
|
}
|
||||||
|
(mFragments[2] as MapV2Fragment).showPetNameAndHead(mSelectPetPosition)
|
||||||
} else {
|
} else {
|
||||||
onChangeClick(mSelectPetPosition)
|
onChangeClick(mSelectPetPosition)
|
||||||
when (mViewBinding.homeV2ViewPager2.currentItem) {
|
when (mViewBinding.homeV2ViewPager2.currentItem) {
|
||||||
@@ -394,7 +364,6 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(mFragments[2] as MapV2Fragment).showPetNameAndHead(mSelectPetPosition)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,16 +375,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
getPet(false)?.apply {
|
getPet(false)?.apply {
|
||||||
//判断套餐有没有到期
|
//判断套餐有没有到期
|
||||||
if (shared == ConstantInt.NoShare && availableOrder == ConstantInt.Type0) {
|
if (shared == ConstantInt.NoShare && availableOrder == ConstantInt.Type0) {
|
||||||
CommonDialog2(
|
Util.checkPackageExpired(this@HomeV2Activity, deviceId)
|
||||||
mContext,
|
|
||||||
getString(R.string.txt_subscription_expired),
|
|
||||||
getString(R.string.txt_card_recharge),
|
|
||||||
object : BaseDialog.OnDialogOkListener {
|
|
||||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
|
||||||
packageExpiresObserve()
|
|
||||||
mSubscriptionViewModel.getSubscriptionsOrder()
|
|
||||||
}
|
|
||||||
}).show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,9 +395,11 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
* 检查获取定位蓝牙权限
|
* 检查获取定位蓝牙权限
|
||||||
*/
|
*/
|
||||||
private fun checkPermissions() {
|
private fun checkPermissions() {
|
||||||
|
val checkBleOpen = MMKVUtil.getBoolean(MMKVKey.isFirstCheckBleOpen, true)
|
||||||
Util.checkBluetoothPermissionsEnabled(mContext, {
|
Util.checkBluetoothPermissionsEnabled(mContext, {
|
||||||
// mAutomaticConnectionDeviceViewModel.autoConnectBleDevice(mContext)
|
// mAutomaticConnectionDeviceViewModel.autoConnectBleDevice(mContext)
|
||||||
})
|
}, isCheckBleOpen = checkBleOpen)
|
||||||
|
if (checkBleOpen) MMKVUtil.putBoolean(MMKVKey.isFirstCheckBleOpen, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -556,7 +518,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
private fun autoConnectDevice() {
|
private fun autoConnectDevice() {
|
||||||
getPet(false)?.apply {
|
getPet(false)?.apply {
|
||||||
if (TextUtils.isEmpty(macID)) return@apply
|
if (TextUtils.isEmpty(macID)) return@apply
|
||||||
if (SRBleUtil.instance.isBlueEnable(mContext)) {
|
if (SRBleUtil.instance.isBleEnable(mContext)) {
|
||||||
if (BleManager.getInstance().isConnected(macID)) {
|
if (BleManager.getInstance().isConnected(macID)) {
|
||||||
SRBleUtil.instance.cancelBleScan("已连接设备,取消其他连接扫描")
|
SRBleUtil.instance.cancelBleScan("已连接设备,取消其他连接扫描")
|
||||||
val bleTrack = SRBleUtil.instance.getConnectMacDevice(macID)
|
val bleTrack = SRBleUtil.instance.getConnectMacDevice(macID)
|
||||||
@@ -570,6 +532,31 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override fun onTrimMemory(level: Int) {
|
||||||
|
// super.onTrimMemory(level)
|
||||||
|
// LogUtil.e("系统级别:$level"+printLevel(level))
|
||||||
|
// }
|
||||||
|
// private fun printLevel( level:Int) :String{
|
||||||
|
// var desc=""
|
||||||
|
// when (level) {
|
||||||
|
// TRIM_MEMORY_COMPLETE->//80
|
||||||
|
// desc = "进程在LRU尾部,如果没有足够的内存, 将很快被杀死";
|
||||||
|
// TRIM_MEMORY_MODERATE->//60
|
||||||
|
// desc = "进程在LRU中部,如果系统进一步需要内存, 可能会被杀死";
|
||||||
|
// TRIM_MEMORY_BACKGROUND->//40
|
||||||
|
// desc = "进程在LRU头部,虽然本进程不会被高优杀死, 但系统已经开始准备杀死LRU列表中的其他进程";
|
||||||
|
// TRIM_MEMORY_UI_HIDDEN->//20
|
||||||
|
// desc = "界面不可见,建议释放UI资源";
|
||||||
|
// TRIM_MEMORY_RUNNING_CRITICAL->//15
|
||||||
|
// desc = "虽然进程不会被高优杀死, 但系统已经开始准备杀死LRU列表中的其他进程,应该释放无用资源以防止性能下降";
|
||||||
|
// TRIM_MEMORY_RUNNING_LOW->//10
|
||||||
|
// desc = "虽然进程不会被高优杀死, 但系统已经开始准备杀死LRU列表中的其他进程,应该释放不必要的资源来提供系统性能";
|
||||||
|
// TRIM_MEMORY_RUNNING_MODERATE->//5
|
||||||
|
// desc = "系统已经进入了低内存的状态,进程正在运行但是不会被杀死";
|
||||||
|
// }
|
||||||
|
// return desc;
|
||||||
|
// }
|
||||||
|
|
||||||
private var mTempTime = 0L
|
private var mTempTime = 0L
|
||||||
override fun listenBackPressed() {
|
override fun listenBackPressed() {
|
||||||
// 2s内再次选择back键有效
|
// 2s内再次选择back键有效
|
||||||
|
|||||||
@@ -124,13 +124,6 @@ open class AddAndEditFencesZoneBaseActivity :
|
|||||||
isEditFences,
|
isEditFences,
|
||||||
this@AddAndEditFencesZoneBaseActivity
|
this@AddAndEditFencesZoneBaseActivity
|
||||||
) {
|
) {
|
||||||
// mFencesList?.apply {
|
|
||||||
// mPetBean?.let {
|
|
||||||
// mFencesMapCommon.setPetHeadAndCurrentLocation(
|
|
||||||
// it.imgurl, latitude, longitude
|
|
||||||
// )
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
mapLoadOk()
|
mapLoadOk()
|
||||||
}
|
}
|
||||||
supportFragmentManager.commit {
|
supportFragmentManager.commit {
|
||||||
@@ -392,6 +385,11 @@ open class AddAndEditFencesZoneBaseActivity :
|
|||||||
successTips(R.string.txt_save_successful)
|
successTips(R.string.txt_save_successful)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
|
super.onRequestError(exceptionCode)
|
||||||
|
setButtonEnabled(mViewBinding.btnSaveFencesZone, ConstantInt.Type1)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -688,6 +686,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
mActionType = ConstantInt.Type1
|
mActionType = ConstantInt.Type1
|
||||||
|
setButtonEnabled(mViewBinding.btnSaveFencesZone, ConstantInt.Type0)
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
if (BleManager.getInstance().isConnected(it.macID)) {
|
if (BleManager.getInstance().isConnected(it.macID)) {
|
||||||
sendFenceData()
|
sendFenceData()
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ class PreviewFencesZoneActivity :
|
|||||||
mRightImageButton = addRightImageButton(R.drawable.icon_gray_delete_svg)
|
mRightImageButton = addRightImageButton(R.drawable.icon_gray_delete_svg)
|
||||||
}
|
}
|
||||||
|
|
||||||
val mapTypeSp = Util.getMapTypeSp()
|
|
||||||
isSatelliteMap = mapTypeSp == ConstantInt.Type1
|
|
||||||
|
|
||||||
mFencesList = mutableListOf()
|
mFencesList = mutableListOf()
|
||||||
|
|
||||||
intent?.apply {
|
intent?.apply {
|
||||||
@@ -286,15 +283,24 @@ class PreviewFencesZoneActivity :
|
|||||||
mFencesList.addAll(this.toList())
|
mFencesList.addAll(this.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentFencesId = ""
|
|
||||||
mCurrentFences?.apply {
|
mCurrentFences?.apply {
|
||||||
currentFencesId = fenceId
|
|
||||||
setCurrentFencesInfo(this)
|
setCurrentFencesInfo(this)
|
||||||
|
setFencesAndPetData()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setFencesAndPetData() {
|
||||||
|
var currentFencesId = ""
|
||||||
|
val mapTypeSp = Util.getMapTypeSp()
|
||||||
|
isSatelliteMap = mapTypeSp == ConstantInt.Type1
|
||||||
|
mCurrentFences?.apply {
|
||||||
|
currentFencesId = fenceId
|
||||||
mFencesMapViewModel.setImageFencesData(
|
mFencesMapViewModel.setImageFencesData(
|
||||||
mContext, mFencesList, mFragment, currentFencesId, isSatelliteMap
|
mContext, mFencesList, mFragment, currentFencesId, isSatelliteMap
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
mGetFencesBean?.apply {
|
||||||
mPetBean?.let {
|
mPetBean?.let {
|
||||||
mCurrentFences?.deviceServiceId = it.deviceServiceId
|
mCurrentFences?.deviceServiceId = it.deviceServiceId
|
||||||
mCurrentFences?.deviceId = it.deviceId
|
mCurrentFences?.deviceId = it.deviceId
|
||||||
@@ -420,13 +426,10 @@ class PreviewFencesZoneActivity :
|
|||||||
cbPreviewFencesSwitch -> mCurrentFences?.apply { changeOnAndOff(this) }
|
cbPreviewFencesSwitch -> mCurrentFences?.apply { changeOnAndOff(this) }
|
||||||
|
|
||||||
ivPreviewFencesMapSwitchBtn -> {
|
ivPreviewFencesMapSwitchBtn -> {
|
||||||
isSatelliteMap = !isSatelliteMap
|
|
||||||
mPreviewFencesMapCommon.switchSatelliteAndNormalMapType()
|
mPreviewFencesMapCommon.switchSatelliteAndNormalMapType()
|
||||||
//切换卫星地图,围栏换颜色
|
//切换卫星地图,围栏换颜色
|
||||||
mCurrentFences?.apply {
|
mCurrentFences?.apply {
|
||||||
mFencesMapViewModel.setImageFencesData(
|
setFencesAndPetData()
|
||||||
mContext, mFencesList, mFragment, fenceId, isSatelliteMap
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.clj.fastble.utils.HexUtil
|
|||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
||||||
class AddWifiPasswordActivity :
|
class AddWifiPasswordActivity :
|
||||||
BaseActivity<ActivityAddWifiPasswordBinding>(ActivityAddWifiPasswordBinding::inflate) {
|
BaseActivity<ActivityAddWifiPasswordBinding>(ActivityAddWifiPasswordBinding::inflate) {
|
||||||
|
|
||||||
@@ -202,6 +203,7 @@ class AddWifiPasswordActivity :
|
|||||||
private fun sendPasswordStart() {
|
private fun sendPasswordStart() {
|
||||||
showLoading(true, R.string.txt_please_wait)
|
showLoading(true, R.string.txt_please_wait)
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
|
hideInputMethod(ilAddWifiPwdPassword.etInputContent)
|
||||||
btnAddWifiPwdConnect.isEnabled = false
|
btnAddWifiPwdConnect.isEnabled = false
|
||||||
lavAddWifiPwdAnim.playAnimation()
|
lavAddWifiPwdAnim.playAnimation()
|
||||||
lavAddWifiPwdAnim.visibility = View.VISIBLE
|
lavAddWifiPwdAnim.visibility = View.VISIBLE
|
||||||
|
|||||||
@@ -53,7 +53,12 @@ class AddWifiPowerZone2Activity :
|
|||||||
add(R.id.fc_wifi_power_zone2_map_fragment, mFragment)
|
add(R.id.fc_wifi_power_zone2_map_fragment, mFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
setOnClickListenerViews(btnAddWifiZone2Next, tbRefreshLocationBtn, tvWifiZone2LaterBtn)
|
setOnClickListenerViews(
|
||||||
|
btnAddWifiZone2Next,
|
||||||
|
tbRefreshLocationBtn,
|
||||||
|
tvWifiZone2LaterBtn,
|
||||||
|
ivWifiPowerZone2MapTypeBtn
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +105,8 @@ class AddWifiPowerZone2Activity :
|
|||||||
ViewUtil.instance.viewAlphaAndRotationObjectAnimator(v)
|
ViewUtil.instance.viewAlphaAndRotationObjectAnimator(v)
|
||||||
mWifiZone2MapCommon.refreshLocation()
|
mWifiZone2MapCommon.refreshLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ivWifiPowerZone2MapTypeBtn -> mWifiZone2MapCommon.switchSatelliteAndNormalMapType()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ class EditWifiPowerZoneActivity :
|
|||||||
mViewBinding.ilEditPowerZoneBluetoothTips.trbBleConnectState.let { view ->
|
mViewBinding.ilEditPowerZoneBluetoothTips.trbBleConnectState.let { view ->
|
||||||
val bgColor = if (trackDevice.conState == ConState.CONNECTED) {
|
val bgColor = if (trackDevice.conState == ConState.CONNECTED) {
|
||||||
view.text = getString(R.string.tracker_manage_set_ble_connect)
|
view.text = getString(R.string.tracker_manage_set_ble_connect)
|
||||||
|
mPetBean?.let {
|
||||||
|
//查找当前Mac的设备
|
||||||
|
mBleTrackDeviceBean = SRBleUtil.instance.getConnectMacDevice(it.macID)
|
||||||
|
}
|
||||||
ContextCompat.getColor(mContext, R.color.cyan_color1)
|
ContextCompat.getColor(mContext, R.color.cyan_color1)
|
||||||
} else {
|
} else {
|
||||||
view.text = getString(R.string.tracker_manage_set_ble_unconnect)
|
view.text = getString(R.string.tracker_manage_set_ble_unconnect)
|
||||||
@@ -345,27 +349,30 @@ class EditWifiPowerZoneActivity :
|
|||||||
val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
|
val data2 = SRBleCmdUtil.instance.byteToInt(data[2])
|
||||||
|
|
||||||
mRightImageButton?.isEnabled = true
|
mRightImageButton?.isEnabled = true
|
||||||
|
if (data0 == 0x10 || data0 == 0x11) {
|
||||||
if (data1 == 0x01 && data2 == 0x00) {
|
if (data1 == 0x01 && data2 == 0x00) {
|
||||||
//添加wifi 指令成功
|
//添加wifi 指令成功
|
||||||
if (data0 == 0x10) {
|
if (data0 == 0x10) {
|
||||||
LogUtil.e("设置设备wifi指令成功")
|
LogUtil.e("设置设备wifi指令成功")
|
||||||
mWiFiZoneViewModel.addWifiZone(this, mWiFiZoneBean)
|
mWiFiZoneViewModel.addWifiZone(this, mWiFiZoneBean)
|
||||||
|
}
|
||||||
|
//删除成功
|
||||||
|
else {
|
||||||
|
LogUtil.e("删除设备wifi指令成功")
|
||||||
|
mWiFiZoneViewModel.deleteWifiZone(
|
||||||
|
this@EditWifiPowerZoneActivity, mWiFiZoneBean
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else if (data1 == 0x01 && data2 == 0x01) {
|
||||||
|
showLoading(false)
|
||||||
|
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
|
||||||
|
showToast(R.string.txt_duplicate_wifi_not, gravity = Gravity.CENTER)
|
||||||
|
} else {
|
||||||
|
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
|
||||||
|
showLoading(false)
|
||||||
|
showToast("Fail", gravity = Gravity.CENTER)
|
||||||
|
LogUtil.e("设备wifi指令失败")
|
||||||
}
|
}
|
||||||
//删除成功
|
|
||||||
else if (data0 == 0x11) {
|
|
||||||
LogUtil.e("删除设备wifi指令成功")
|
|
||||||
mWiFiZoneViewModel.deleteWifiZone(this@EditWifiPowerZoneActivity, mWiFiZoneBean)
|
|
||||||
}
|
|
||||||
} else if (data1 == 0x01 && data2 == 0x01) {
|
|
||||||
showLoading(false)
|
|
||||||
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
|
|
||||||
showToast(R.string.txt_duplicate_wifi_not, gravity = Gravity.CENTER)
|
|
||||||
} else {
|
|
||||||
setButtonEnabled(mViewBinding.btnSaveWifiZone, ConstantInt.Type1)
|
|
||||||
showLoading(false)
|
|
||||||
showToast("Fail", gravity = Gravity.CENTER)
|
|
||||||
LogUtil.e("设备wifi指令失败")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import android.graphics.Typeface
|
|||||||
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.view.isGone
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
@@ -82,7 +83,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
private var mMapDeviceBean: MapDeviceBean? = null
|
private var mMapDeviceBean: MapDeviceBean? = null
|
||||||
|
|
||||||
//启动动画移动地图摄像机
|
//启动动画移动地图摄像机
|
||||||
private var isAnimMoveCamera = true
|
private var isMoveCamera = true
|
||||||
|
|
||||||
//是否显示围栏
|
//是否显示围栏
|
||||||
private var isShowFence = true
|
private var isShowFence = true
|
||||||
@@ -343,6 +344,11 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
|
|
||||||
//接收蓝牙连接状态
|
//接收蓝牙连接状态
|
||||||
XEventBus.observe(this, EventName.ConnectDeviceState) { trackBle: BleTrackDeviceBean ->
|
XEventBus.observe(this, EventName.ConnectDeviceState) { trackBle: BleTrackDeviceBean ->
|
||||||
|
mPetBean?.apply {
|
||||||
|
if (trackBle.mac == macID && trackBle.conState != ConState.CONNECTED) {
|
||||||
|
mViewBinding.rvLiveV2MapDeviceMsg.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
mMapDeviceBean?.apply {
|
mMapDeviceBean?.apply {
|
||||||
if (trackBle.mac == deviceMacId) {
|
if (trackBle.mac == deviceMacId) {
|
||||||
updateConState(trackBle)
|
updateConState(trackBle)
|
||||||
@@ -485,14 +491,17 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
mViewBinding.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isChecked =
|
mViewBinding.ilLiveV2BluetoothFindDevice.ilLiveV2RadarLightSwitch.cbDeviceLightSwitch.isChecked =
|
||||||
isOpen
|
isOpen
|
||||||
|
|
||||||
if (haveLocationData && liveFlag == ConstantInt.Type1) {
|
// if (haveLocationData && liveFlag == ConstantInt.Type1) {
|
||||||
|
if (liveFlag == ConstantInt.Type1) {
|
||||||
if (!isStartLive) {
|
if (!isStartLive) {
|
||||||
isStartLive = true
|
isStartLive = true
|
||||||
liveStartTip()
|
liveStartTip()
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
if (haveLocationData) {
|
||||||
locationList?.let { location ->
|
lifecycleScope.launch {
|
||||||
liveDrawLines(location)
|
locationList?.let { location ->
|
||||||
|
liveDrawLines(location)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mHomeMapCommon.setMapDeviceBean(it)
|
mHomeMapCommon.setMapDeviceBean(it)
|
||||||
@@ -642,7 +651,11 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
if (null == bleConDevice) {
|
if (null == bleConDevice) {
|
||||||
if (isLiveJump) {
|
if (isLiveJump) {
|
||||||
//没有连接,一进入页面就尝试连接
|
//没有连接,一进入页面就尝试连接
|
||||||
mConDeviceViewModel.connectDeviceToMac(this@LiveActivityV2, macID)
|
if (SRBleUtil.instance.isBleEnable(mContext)) {
|
||||||
|
mConDeviceViewModel.connectDeviceToMac(this@LiveActivityV2, macID)
|
||||||
|
} else {
|
||||||
|
openNetLive(ConstantInt.Type2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
updateConState(bleConDevice)
|
updateConState(bleConDevice)
|
||||||
@@ -669,9 +682,9 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
|
|
||||||
mHomeMapCommon.let {
|
mHomeMapCommon.let {
|
||||||
it.setMapDeviceBean(this)
|
it.setMapDeviceBean(this)
|
||||||
it.refreshPetCurrentLocation(latitude, longitude, isAnimMoveCamera)
|
it.refreshPetCurrentLocation(latitude, longitude, isMoveCamera)
|
||||||
it.startRippleCircleAnim()
|
it.startRippleCircleAnim()
|
||||||
isAnimMoveCamera = false
|
isMoveCamera = false
|
||||||
// val userAndPetDistance = it.getUserAndPetDistance()
|
// val userAndPetDistance = it.getUserAndPetDistance()
|
||||||
// mViewBinding.tvLiveV2Distance.text = String.format(
|
// mViewBinding.tvLiveV2Distance.text = String.format(
|
||||||
// getString(R.string.txt_ft_unit), Utils.formatDecimal(userAndPetDistance)
|
// getString(R.string.txt_ft_unit), Utils.formatDecimal(userAndPetDistance)
|
||||||
@@ -772,20 +785,18 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
*/
|
*/
|
||||||
private fun liveStartTip() {
|
private fun liveStartTip() {
|
||||||
LogUtil.e("直播开始了")
|
LogUtil.e("直播开始了")
|
||||||
// mStartLiveIndex = 2
|
if (mStartLiveIndex == 0) {
|
||||||
//直播开始显示Starting 5-min Live
|
mStartLiveIndex = 2
|
||||||
// mCountDownViewModel.startCountDown(2)
|
//直播开始显示Starting 5-min Live
|
||||||
|
mCountDownViewModel.startCountDown(1)
|
||||||
|
mHomeMapCommon.greenRippleCircleAnim()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 直播画线
|
* 直播画线
|
||||||
*/
|
*/
|
||||||
private fun liveDrawLine(latitude: Double, longitude: Double) {
|
private fun liveDrawLine(latitude: Double, longitude: Double) {
|
||||||
if (mStartLiveIndex == 0) {
|
|
||||||
mStartLiveIndex = 2
|
|
||||||
//直播开始显示Starting 5-min Live
|
|
||||||
mCountDownViewModel.startCountDown(1)
|
|
||||||
}
|
|
||||||
mHomeMapCommon.addTrackLine(latitude, longitude)
|
mHomeMapCommon.addTrackLine(latitude, longitude)
|
||||||
val userAndPetDistance = mHomeMapCommon.getUserAndPetDistance()
|
val userAndPetDistance = mHomeMapCommon.getUserAndPetDistance()
|
||||||
val distanceStr = Util.metricConvertUnits(
|
val distanceStr = Util.metricConvertUnits(
|
||||||
@@ -798,11 +809,6 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
* 直播画线
|
* 直播画线
|
||||||
*/
|
*/
|
||||||
private fun liveDrawLines(trackList: MutableList<HistoryDataBean>) {
|
private fun liveDrawLines(trackList: MutableList<HistoryDataBean>) {
|
||||||
if (mStartLiveIndex == 0) {
|
|
||||||
mStartLiveIndex = 2
|
|
||||||
//直播开始显示Starting 5-min Live
|
|
||||||
mCountDownViewModel.startCountDown(1)
|
|
||||||
}
|
|
||||||
mHomeMapCommon.addTrackLines(trackList)
|
mHomeMapCommon.addTrackLines(trackList)
|
||||||
val userAndPetDistance = mHomeMapCommon.getUserAndPetDistance()
|
val userAndPetDistance = mHomeMapCommon.getUserAndPetDistance()
|
||||||
val distanceStr = Util.metricConvertUnits(
|
val distanceStr = Util.metricConvertUnits(
|
||||||
@@ -819,7 +825,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
miLiveV2MapAddressView.visibility = View.GONE
|
miLiveV2MapAddressView.visibility = View.GONE
|
||||||
val relativeLayout = ivMapLiveV2RefreshBtn.layoutParams as RelativeLayout.LayoutParams
|
val relativeLayout = ivMapLiveV2RefreshBtn.layoutParams as RelativeLayout.LayoutParams
|
||||||
ivMapLiveV2RefreshBtn.visibility = View.GONE
|
ivMapLiveV2RefreshBtn.visibility = View.GONE
|
||||||
if (ilLiveV2BluetoothFindDevice.root.visibility == View.GONE) {
|
if (ilLiveV2BluetoothFindDevice.root.isGone) {
|
||||||
//找蓝牙设备布局显示
|
//找蓝牙设备布局显示
|
||||||
YoYo.with(Techniques.BounceInUp).duration(800).onStart {
|
YoYo.with(Techniques.BounceInUp).duration(800).onStart {
|
||||||
ilLiveV2OperateLayout.root.visibility = View.GONE
|
ilLiveV2OperateLayout.root.visibility = View.GONE
|
||||||
@@ -863,7 +869,7 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
private fun showLiveIssue() {
|
private fun showLiveIssue() {
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
miLiveV2MapAddressView.visibility = View.GONE
|
miLiveV2MapAddressView.visibility = View.GONE
|
||||||
if (ilMapLiveV2IssueLayout.root.visibility == View.GONE) {
|
if (ilMapLiveV2IssueLayout.root.isGone) {
|
||||||
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
|
YoYo.with(Techniques.BounceInUp).duration(700).onStart {
|
||||||
ilLiveV2OperateLayout.root.visibility = View.GONE
|
ilLiveV2OperateLayout.root.visibility = View.GONE
|
||||||
ilMapLiveV2IssueLayout.root.visibility = View.VISIBLE
|
ilMapLiveV2IssueLayout.root.visibility = View.VISIBLE
|
||||||
@@ -902,9 +908,6 @@ class LiveActivityV2 : BaseActivity<ActivityLiveV2Binding>(ActivityLiveV2Binding
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// override fun onBackPressed() {
|
|
||||||
// stopMapLive()
|
|
||||||
// }
|
|
||||||
override fun listenBackPressed() {
|
override fun listenBackPressed() {
|
||||||
if (isLiveJump) stopMapLive()
|
if (isLiveJump) stopMapLive()
|
||||||
else super.listenBackPressed()
|
else super.listenBackPressed()
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.abbidot.tracker.ui.activity.subscribe
|
package com.abbidot.tracker.ui.activity.subscribe
|
||||||
|
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.adapter.MySubscriptionAdapter
|
import com.abbidot.tracker.adapter.MySubscriptionAdapter
|
||||||
@@ -18,6 +20,7 @@ class MySubscriptionActivity :
|
|||||||
|
|
||||||
private lateinit var mSubscriptionAdapter: MySubscriptionAdapter
|
private lateinit var mSubscriptionAdapter: MySubscriptionAdapter
|
||||||
private var mPosition = 0
|
private var mPosition = 0
|
||||||
|
private var mRefreshPackage = true
|
||||||
|
|
||||||
override fun getTopBar() = mViewBinding.ilMySubscriptionTopBar.titleTopBar
|
override fun getTopBar() = mViewBinding.ilMySubscriptionTopBar.titleTopBar
|
||||||
|
|
||||||
@@ -46,13 +49,16 @@ class MySubscriptionActivity :
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mSubscriptionViewModel.getSubscriptionsOrder()
|
if (mRefreshPackage) {
|
||||||
|
mRefreshPackage = false
|
||||||
|
mSubscriptionViewModel.getSubscriptionsOrder()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
// XEventBus.observe(this, EventName.PayBack) {
|
XEventBus.observe(this, EventName.RefreshPackage) {
|
||||||
// mSubscriptionViewModel.getSubscriptionsOrder()
|
mRefreshPackage = true
|
||||||
// }
|
}
|
||||||
mSubscriptionViewModel.apply {
|
mSubscriptionViewModel.apply {
|
||||||
mSubscriptionsOrderLiveData.observe(this@MySubscriptionActivity) {
|
mSubscriptionsOrderLiveData.observe(this@MySubscriptionActivity) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class PaymentSuccessActivity :
|
|||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
//接收蓝牙连接状态
|
//接收蓝牙连接状态
|
||||||
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
XEventBus.observe(this, EventName.ConnectDeviceState) { ble: BleTrackDeviceBean ->
|
||||||
|
if (TextUtils.isEmpty(mMac)) return@observe
|
||||||
mViewBinding.ilPaymentSuccessBluetoothTips.trbBleConnectState.let { view ->
|
mViewBinding.ilPaymentSuccessBluetoothTips.trbBleConnectState.let { view ->
|
||||||
val bgColor = if (ble.conState == ConState.CONNECTED) {
|
val bgColor = if (ble.conState == ConState.CONNECTED) {
|
||||||
setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type1)
|
setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type1)
|
||||||
@@ -118,6 +119,7 @@ class PaymentSuccessActivity :
|
|||||||
|
|
||||||
//搜索蓝牙的设备状态
|
//搜索蓝牙的设备状态
|
||||||
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
XEventBus.observe(this, EventName.ActionConDeviceState) { conState: Int ->
|
||||||
|
if (TextUtils.isEmpty(mMac)) return@observe
|
||||||
setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type0)
|
setButtonEnabled(mViewBinding.btnPaymentSuccessContinue, ConstantInt.Type0)
|
||||||
if (conState == ConState.DEVICE_NOT_FOUND) {
|
if (conState == ConState.DEVICE_NOT_FOUND) {
|
||||||
// ViewUtil.instance.showDialog(
|
// ViewUtil.instance.showDialog(
|
||||||
@@ -139,6 +141,7 @@ class PaymentSuccessActivity :
|
|||||||
|
|
||||||
//接收蓝牙返回数据
|
//接收蓝牙返回数据
|
||||||
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
|
XEventBus.observe(this, EventName.DeviceReceiveData) { receiveData: ReceiveDeviceData ->
|
||||||
|
if (TextUtils.isEmpty(mMac)) return@observe
|
||||||
mPayResult?.apply {
|
mPayResult?.apply {
|
||||||
if (mMac == receiveData.mac) {
|
if (mMac == receiveData.mac) {
|
||||||
val data = receiveData.data
|
val data = receiveData.data
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.abbidot.tracker.ui.activity.subscribe
|
|||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
import com.abbidot.tracker.bean.SubscriptionsOrderBean
|
||||||
@@ -39,7 +41,7 @@ class RequestRefundActivity :
|
|||||||
val planName = getString(R.string.txt_plan) + " ${it.mealName}"
|
val planName = getString(R.string.txt_plan) + " ${it.mealName}"
|
||||||
tvRequestRefundPlanName.text = planName
|
tvRequestRefundPlanName.text = planName
|
||||||
val refundRefund = getString(R.string.txt_refund) + ": " + String.format(
|
val refundRefund = getString(R.string.txt_refund) + ": " + String.format(
|
||||||
mContext.getString(R.string.txt_money_unit), it.totalAmountWithTax
|
mContext.getString(R.string.txt_money_unit), "${it.totalAmountWithTax}"
|
||||||
)
|
)
|
||||||
tvRequestRefundRefund.text = refundRefund
|
tvRequestRefundRefund.text = refundRefund
|
||||||
}
|
}
|
||||||
@@ -73,6 +75,7 @@ class RequestRefundActivity :
|
|||||||
mRefundLiveData.observe(this@RequestRefundActivity) {
|
mRefundLiveData.observe(this@RequestRefundActivity) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
|
XEventBus.post(EventName.RefreshPackage)
|
||||||
showToast(R.string.txt_successful, true)
|
showToast(R.string.txt_successful, true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.abbidot.tracker.ui.activity.subscribe
|
package com.abbidot.tracker.ui.activity.subscribe
|
||||||
|
|
||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.adapter.SubscriptionHistoryAdapter
|
import com.abbidot.tracker.adapter.SubscriptionHistoryAdapter
|
||||||
@@ -22,6 +24,7 @@ class SubscriptionHistoryActivity :
|
|||||||
private lateinit var mHistoryAdapter: SubscriptionHistoryAdapter
|
private lateinit var mHistoryAdapter: SubscriptionHistoryAdapter
|
||||||
private var mSubscriptionsOrderList = mutableListOf<SubscriptionsOrderBean>()
|
private var mSubscriptionsOrderList = mutableListOf<SubscriptionsOrderBean>()
|
||||||
private var mDeviceId = ""
|
private var mDeviceId = ""
|
||||||
|
private var mRefreshPackage = true
|
||||||
|
|
||||||
override fun getTopBar() = mViewBinding.ilSubscriptionHistoryTopBar.titleTopBar
|
override fun getTopBar() = mViewBinding.ilSubscriptionHistoryTopBar.titleTopBar
|
||||||
|
|
||||||
@@ -44,13 +47,16 @@ class SubscriptionHistoryActivity :
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
mSubscriptionViewModel.getSubscriptionsHistory(mDeviceId)
|
if (mRefreshPackage) {
|
||||||
|
mRefreshPackage = false
|
||||||
|
mSubscriptionViewModel.getSubscriptionsHistory(mDeviceId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
// XEventBus.observe(this, EventName.UpdateData) {
|
XEventBus.observe(this, EventName.RefreshPackage) {
|
||||||
// mSubscriptionViewModel.getSubscriptionsHistory(mDeviceId)
|
mRefreshPackage = true
|
||||||
// }
|
}
|
||||||
mSubscriptionViewModel.mSubscriptionsHistoryLiveData.observe(this) {
|
mSubscriptionViewModel.mSubscriptionsHistoryLiveData.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class PermissionsActivityCommon(context: Context) {
|
|||||||
PermissionLists.getBluetoothScanPermission(),
|
PermissionLists.getBluetoothScanPermission(),
|
||||||
PermissionLists.getBluetoothConnectPermission()
|
PermissionLists.getBluetoothConnectPermission()
|
||||||
)
|
)
|
||||||
) && SRBleUtil.instance.isBlueEnable(mContext)
|
) && SRBleUtil.instance.isBleEnable(mContext)
|
||||||
) {
|
) {
|
||||||
list[0].state = ConstantInt.Type1
|
list[0].state = ConstantInt.Type1
|
||||||
list[0].selected = false
|
list[0].selected = false
|
||||||
|
|||||||
@@ -76,15 +76,15 @@ class HomeMapCommon @Inject constructor() : BaseMapCommon() {
|
|||||||
if (null != mHomeMapBaiduMapFragment) {
|
if (null != mHomeMapBaiduMapFragment) {
|
||||||
mHomeMapBaiduMapFragment!!.mBaiduMap?.clear()
|
mHomeMapBaiduMapFragment!!.mBaiduMap?.clear()
|
||||||
} else if (null != mHomeMapGoogleMapFragment) {
|
} else if (null != mHomeMapGoogleMapFragment) {
|
||||||
mHomeMapGoogleMapFragment!!.mGoogleMap?.clear()
|
mHomeMapGoogleMapFragment!!.clearAllMarker()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun refreshPetCurrentLocation(latitude: Double, longitude: Double, isAnimMoveCamera: Boolean) {
|
fun refreshPetCurrentLocation(latitude: Double, longitude: Double, isMoveCamera: Boolean) {
|
||||||
if (null != mHomeMapBaiduMapFragment) {
|
if (null != mHomeMapBaiduMapFragment) {
|
||||||
mHomeMapBaiduMapFragment?.apply {
|
mHomeMapBaiduMapFragment?.apply {
|
||||||
refreshPetCurrentLocation(
|
refreshPetCurrentLocation(
|
||||||
latitude, longitude, isAnimMoveCamera = isAnimMoveCamera
|
latitude, longitude, isMoveCamera
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (null != mHomeMapGoogleMapFragment) {
|
} else if (null != mHomeMapGoogleMapFragment) {
|
||||||
@@ -92,9 +92,7 @@ class HomeMapCommon @Inject constructor() : BaseMapCommon() {
|
|||||||
MMKVUtil.putDouble(MMKVKey.MapShowDefaultLon, longitude)
|
MMKVUtil.putDouble(MMKVKey.MapShowDefaultLon, longitude)
|
||||||
mHomeMapGoogleMapFragment?.apply {
|
mHomeMapGoogleMapFragment?.apply {
|
||||||
refreshPetCurrentLocation(
|
refreshPetCurrentLocation(
|
||||||
LatLng(latitude, longitude),
|
LatLng(latitude, longitude), needMoveCamera = isMoveCamera
|
||||||
isAnimMoveCamera = isAnimMoveCamera,
|
|
||||||
needMoveCamera = isAnimMoveCamera
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,6 +172,10 @@ class HomeMapCommon @Inject constructor() : BaseMapCommon() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun greenRippleCircleAnim() {
|
||||||
|
mHomeMapGoogleMapFragment?.greenRippleCircleAnim()
|
||||||
|
}
|
||||||
|
|
||||||
fun setMarkerInfoViewOffset() {
|
fun setMarkerInfoViewOffset() {
|
||||||
if (null != mHomeMapBaiduMapFragment) {
|
if (null != mHomeMapBaiduMapFragment) {
|
||||||
} else if (null != mHomeMapGoogleMapFragment) {
|
} else if (null != mHomeMapGoogleMapFragment) {
|
||||||
|
|||||||
@@ -32,6 +32,13 @@ class WifiZone2MapCommon : BaseMapCommon() {
|
|||||||
mWiFiZone2GoogleMapFragment?.getLastLocation()
|
mWiFiZone2GoogleMapFragment?.getLastLocation()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换地图类型
|
||||||
|
*/
|
||||||
|
fun switchSatelliteAndNormalMapType() {
|
||||||
|
switchSatelliteAndNormalMapType(mBaiduMapFragment, mWiFiZone2GoogleMapFragment)
|
||||||
|
}
|
||||||
|
|
||||||
fun getDecWiFiAddressData(): HistoryDataBean? {
|
fun getDecWiFiAddressData(): HistoryDataBean? {
|
||||||
if (null != mWiFiZone2GoogleMapFragment) {
|
if (null != mWiFiZone2GoogleMapFragment) {
|
||||||
if (null !== mWiFiZone2GoogleMapFragment!!.mDecWifiAddressData) return mWiFiZone2GoogleMapFragment!!.mDecWifiAddressData
|
if (null !== mWiFiZone2GoogleMapFragment!!.mDecWifiAddressData) return mWiFiZone2GoogleMapFragment!!.mDecWifiAddressData
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
import com.abbidot.baselibrary.constant.MMKVKey
|
import com.abbidot.baselibrary.constant.MMKVKey
|
||||||
|
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.MMKVUtil
|
import com.abbidot.baselibrary.util.MMKVUtil
|
||||||
import com.abbidot.baselibrary.util.Utils
|
import com.abbidot.baselibrary.util.Utils
|
||||||
@@ -68,6 +70,9 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
private var isFirst = true
|
private var isFirst = true
|
||||||
private var mProgress = -1
|
private var mProgress = -1
|
||||||
|
|
||||||
|
//充值续费或升级返回类型
|
||||||
|
private var mRechargeBackType = ConstantInt.SpecialType
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(context: Context) = RouteV2Fragment().apply {
|
fun newInstance(context: Context) = RouteV2Fragment().apply {
|
||||||
@@ -209,6 +214,10 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
activity?.apply {
|
activity?.apply {
|
||||||
mHomeV2Activity = this as HomeV2Activity
|
mHomeV2Activity = this as HomeV2Activity
|
||||||
}
|
}
|
||||||
|
//续费成功后,不执行
|
||||||
|
if (mRechargeBackType == ConstantInt.Type1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (mCurrentShowPetPos == mHomeV2Activity.mSelectPetPosition) {
|
if (mCurrentShowPetPos == mHomeV2Activity.mSelectPetPosition) {
|
||||||
if (!isSelectCustomDate) {
|
if (!isSelectCustomDate) {
|
||||||
if (mHistoryDataMapCommon.isMapLoadOk()) {
|
if (mHistoryDataMapCommon.isMapLoadOk()) {
|
||||||
@@ -224,6 +233,14 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun liveDataObserve() {
|
override fun liveDataObserve() {
|
||||||
|
//更新套餐数据
|
||||||
|
XEventBus.observe(this, EventName.RefreshPackage) {
|
||||||
|
//监听续费成功
|
||||||
|
if (mRechargeBackType == ConstantInt.Type0) {
|
||||||
|
mRechargeBackType = ConstantInt.Type1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mDataDetailViewModel.mHistoryDetailLive.observe(this) {
|
mDataDetailViewModel.mHistoryDetailLive.observe(this) {
|
||||||
dealRequestResult(it, object : GetResultCallback {
|
dealRequestResult(it, object : GetResultCallback {
|
||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
@@ -319,6 +336,7 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
if (isResumed) {
|
if (isResumed) {
|
||||||
mHomeV2Activity.getPet()?.let { pet ->
|
mHomeV2Activity.getPet()?.let { pet ->
|
||||||
if (Util.checkPackageLimit(mHomeV2Activity, pet.deviceId)) {
|
if (Util.checkPackageLimit(mHomeV2Activity, pet.deviceId)) {
|
||||||
|
mRechargeBackType = pet.availableOrder
|
||||||
mHistoryDataMapCommon.setPetUserLatLng()
|
mHistoryDataMapCommon.setPetUserLatLng()
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
@@ -412,7 +430,15 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
|
|
||||||
llHomeRouteCalendarFrom -> {
|
llHomeRouteCalendarFrom -> {
|
||||||
mHomeV2Activity.getPet()?.let {
|
mHomeV2Activity.getPet()?.let {
|
||||||
if (Util.checkPackageLimit(mHomeV2Activity, it.deviceId)) return@apply
|
//防止执行多次弹窗
|
||||||
|
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
||||||
|
return@apply
|
||||||
|
}
|
||||||
|
if (Util.checkPackageLimit(mHomeV2Activity, it.deviceId)) {
|
||||||
|
mRechargeBackType = it.availableOrder
|
||||||
|
mLimitExecutionTime = System.currentTimeMillis()
|
||||||
|
return@apply
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null == mFromCalenderDialog) {
|
if (null == mFromCalenderDialog) {
|
||||||
@@ -433,7 +459,15 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
|
|
||||||
llHomeRouteCalendarTo -> {
|
llHomeRouteCalendarTo -> {
|
||||||
mHomeV2Activity.getPet()?.let {
|
mHomeV2Activity.getPet()?.let {
|
||||||
if (Util.checkPackageLimit(mHomeV2Activity, it.deviceId)) return@apply
|
//防止执行多次弹窗
|
||||||
|
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
||||||
|
return@apply
|
||||||
|
}
|
||||||
|
if (Util.checkPackageLimit(mHomeV2Activity, it.deviceId)) {
|
||||||
|
mRechargeBackType = it.availableOrder
|
||||||
|
mLimitExecutionTime = System.currentTimeMillis()
|
||||||
|
return@apply
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (null == mToCalenderDialog) {
|
if (null == mToCalenderDialog) {
|
||||||
mToCalenderDialog = ShowCalenderAndTimeDialog(
|
mToCalenderDialog = ShowCalenderAndTimeDialog(
|
||||||
|
|||||||
@@ -85,8 +85,8 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
private lateinit var mDeviceMsgList: MutableList<DataBean>
|
private lateinit var mDeviceMsgList: MutableList<DataBean>
|
||||||
private lateinit var mDeviceMsgAdapter: HomeMapDeviceMsgAdapter
|
private lateinit var mDeviceMsgAdapter: HomeMapDeviceMsgAdapter
|
||||||
|
|
||||||
//启动动画移动地图摄像机
|
//启动移动地图摄像机
|
||||||
private var isAnimMoveCamera = true
|
private var isMoveCamera = true
|
||||||
private var mShowCenterLocationType = ConstantInt.PetLocationType
|
private var mShowCenterLocationType = ConstantInt.PetLocationType
|
||||||
|
|
||||||
//是否显示围栏
|
//是否显示围栏
|
||||||
@@ -169,9 +169,7 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
activity?.apply {
|
|
||||||
mHomeV2Activity = this as HomeV2Activity
|
|
||||||
}
|
|
||||||
//其他页面是否选择了宠物
|
//其他页面是否选择了宠物
|
||||||
if (mCurrentShowPetPos != mHomeV2Activity.mSelectPetPosition) {
|
if (mCurrentShowPetPos != mHomeV2Activity.mSelectPetPosition) {
|
||||||
showPetNameAndHead(mHomeV2Activity.mSelectPetPosition)
|
showPetNameAndHead(mHomeV2Activity.mSelectPetPosition)
|
||||||
@@ -192,6 +190,15 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun getHomeV2Activity(): HomeV2Activity? {
|
||||||
|
return if (null == activity) {
|
||||||
|
LogUtil.e("getHomeV2Activity,null == activity")
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
activity as HomeV2Activity
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地图加载好了
|
* 地图加载好了
|
||||||
*/
|
*/
|
||||||
@@ -282,6 +289,8 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
mHomeV2Activity.getPet(false)?.apply {
|
mHomeV2Activity.getPet(false)?.apply {
|
||||||
//蓝牙断开就重新获取服务器数据,蓝牙数据上报断开
|
//蓝牙断开就重新获取服务器数据,蓝牙数据上报断开
|
||||||
if (trackBle.mac == macID && trackBle.conState != ConState.CONNECTED) {
|
if (trackBle.mac == macID && trackBle.conState != ConState.CONNECTED) {
|
||||||
|
//隐藏蓝牙nearby
|
||||||
|
mViewBinding.rvHomeMapDeviceMsg.visibility = View.GONE
|
||||||
updateMapDeviceStatus()
|
updateMapDeviceStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +315,7 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
}
|
}
|
||||||
mHomeMapCommon.setMapDeviceBean(mMapDeviceBean)
|
mHomeMapCommon.setMapDeviceBean(mMapDeviceBean)
|
||||||
mHomeMapCommon.refreshPetCurrentLocation(
|
mHomeMapCommon.refreshPetCurrentLocation(
|
||||||
it.latitude, it.longitude, isAnimMoveCamera
|
it.latitude, it.longitude, isMoveCamera
|
||||||
)
|
)
|
||||||
mHomeMapCommon.startRefreshUserLocation()
|
mHomeMapCommon.startRefreshUserLocation()
|
||||||
}
|
}
|
||||||
@@ -424,17 +433,17 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
private fun updateMapDeviceStatus(
|
private fun updateMapDeviceStatus(
|
||||||
isNeedCountDown: Boolean = true, useBleLocation: Boolean = false
|
isNeedCountDown: Boolean = true, useBleLocation: Boolean = false
|
||||||
) {
|
) {
|
||||||
mShowCenterLocationType = ConstantInt.PetLocationType
|
// mShowCenterLocationType = ConstantInt.PetLocationType
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
mViewBinding.homeMapRefreshBtn, mShowCenterLocationType
|
// mViewBinding.homeMapRefreshBtn, mShowCenterLocationType
|
||||||
)
|
// )
|
||||||
if (mHomeV2Activity.mPetList.size <= mCurrentShowPetPos) return
|
if (mHomeV2Activity.mPetList.size <= mCurrentShowPetPos) return
|
||||||
mHomeV2Activity.getPet()?.apply {
|
mHomeV2Activity.getPet()?.apply {
|
||||||
//蓝牙连接上,就直接用蓝牙上报的位置刷新
|
//蓝牙连接上,就直接用蓝牙上报的位置刷新
|
||||||
if (useBleLocation && BleManager.getInstance().isConnected(macID)) {
|
if (useBleLocation && BleManager.getInstance().isConnected(macID)) {
|
||||||
mMapDeviceBean?.let {
|
mMapDeviceBean?.let {
|
||||||
mHomeMapCommon.refreshPetCurrentLocation(
|
mHomeMapCommon.refreshPetCurrentLocation(
|
||||||
it.latitude, it.longitude, isAnimMoveCamera
|
it.latitude, it.longitude, isMoveCamera
|
||||||
)
|
)
|
||||||
mHomeMapCommon.startRefreshUserLocation()
|
mHomeMapCommon.startRefreshUserLocation()
|
||||||
}
|
}
|
||||||
@@ -546,14 +555,14 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mShowCenterLocationType = ConstantInt.PetLocationType
|
// mShowCenterLocationType = ConstantInt.PetLocationType
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
mViewBinding.homeMapRefreshBtn, mShowCenterLocationType
|
// mViewBinding.homeMapRefreshBtn, mShowCenterLocationType
|
||||||
)
|
// )
|
||||||
mHomeMapCommon.refreshPetCurrentLocation(latitude, longitude, isAnimMoveCamera)
|
mHomeMapCommon.refreshPetCurrentLocation(latitude, longitude, isMoveCamera)
|
||||||
mHomeMapCommon.startRefreshUserLocation()
|
mHomeMapCommon.startRefreshUserLocation()
|
||||||
|
|
||||||
isAnimMoveCamera = false
|
isMoveCamera = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -578,7 +587,7 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (type == 1) {
|
} else if (type == 1) {
|
||||||
if (!SRBleUtil.instance.isBlueEnable(mContext!!)) {
|
if (!SRBleUtil.instance.isBleEnable(mContext!!)) {
|
||||||
SRBleUtil.instance.openBluetooth(mContext!!)
|
SRBleUtil.instance.openBluetooth(mContext!!)
|
||||||
} else if (mHomeV2Activity.isRequestPetData && mHomeV2Activity.mPetList.size == 0) {
|
} else if (mHomeV2Activity.isRequestPetData && mHomeV2Activity.mPetList.size == 0) {
|
||||||
showToast(R.string.no_bind_pet)
|
showToast(R.string.no_bind_pet)
|
||||||
@@ -606,17 +615,27 @@ class MapV2Fragment : BaseFragment<FragmentMapV2Binding>(FragmentMapV2Binding::i
|
|||||||
if (mShowCenterLocationType == ConstantInt.PetLocationType) {
|
if (mShowCenterLocationType == ConstantInt.PetLocationType) {
|
||||||
mShowCenterLocationType = ConstantInt.UserLocationType
|
mShowCenterLocationType = ConstantInt.UserLocationType
|
||||||
mHomeMapCommon.switchShowLocation(mShowCenterLocationType)
|
mHomeMapCommon.switchShowLocation(mShowCenterLocationType)
|
||||||
|
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
|
||||||
homeMapRefreshBtn, mShowCenterLocationType
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
isAnimMoveCamera = true
|
mShowCenterLocationType = ConstantInt.PetLocationType
|
||||||
|
isMoveCamera = true
|
||||||
updateMapDeviceStatus(useBleLocation = true)
|
updateMapDeviceStatus(useBleLocation = true)
|
||||||
}
|
}
|
||||||
|
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
|
homeMapRefreshBtn, mShowCenterLocationType
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
homeMapLiveBtn -> {
|
||||||
|
// locationPermissionsTip()
|
||||||
|
mHomeV2Activity.getPet()?.apply {
|
||||||
|
mViewBinding.homeMapLiveBtn.isEnabled = false
|
||||||
|
val intent = Intent(mContext, LiveActivityV2::class.java)
|
||||||
|
intent.putExtra(ConstantString.JumpActivity, true)
|
||||||
|
intent.putExtra(ConstantString.Pet, this)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
homeMapLiveBtn -> locationPermissionsTip()
|
|
||||||
llHomeMapTopPet.ivTopPetBtnSmall -> showMapTypeDialog()
|
llHomeMapTopPet.ivTopPetBtnSmall -> showMapTypeDialog()
|
||||||
homeMapBluetoothBtn -> checkPermissions(1)
|
homeMapBluetoothBtn -> checkPermissions(1)
|
||||||
llHomeMapTopPet.homeDataPetNameSmall, llHomeMapTopPet.homeDataPetHeadSmall.root -> mHomeV2Activity.selectPetDialog()
|
llHomeMapTopPet.homeDataPetNameSmall, llHomeMapTopPet.homeDataPetHeadSmall.root -> mHomeV2Activity.selectPetDialog()
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ abstract class BaseBaiduMapFragment :
|
|||||||
lat: Double,
|
lat: Double,
|
||||||
lon: Double,
|
lon: Double,
|
||||||
needMoveCamera: Boolean = true,
|
needMoveCamera: Boolean = true,
|
||||||
isAnimMoveCamera: Boolean = true,
|
isAnimMoveCamera: Boolean = false,
|
||||||
needConvertGCJ02: Boolean = true,
|
needConvertGCJ02: Boolean = true,
|
||||||
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
||||||
) {
|
) {
|
||||||
@@ -316,7 +316,7 @@ abstract class BaseBaiduMapFragment :
|
|||||||
fun refreshPetCurrentLocation(
|
fun refreshPetCurrentLocation(
|
||||||
latLng: LatLng,
|
latLng: LatLng,
|
||||||
needMoveCamera: Boolean = true,
|
needMoveCamera: Boolean = true,
|
||||||
isAnimMoveCamera: Boolean = true,
|
isAnimMoveCamera: Boolean = false,
|
||||||
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
||||||
) {
|
) {
|
||||||
refreshPetCurrentLocation(
|
refreshPetCurrentLocation(
|
||||||
@@ -341,7 +341,7 @@ abstract class BaseBaiduMapFragment :
|
|||||||
* @param needConvertGCJ02 是否需要转换GCJ02坐标
|
* @param needConvertGCJ02 是否需要转换GCJ02坐标
|
||||||
*/
|
*/
|
||||||
fun moveCameraLocation(
|
fun moveCameraLocation(
|
||||||
lat: Double, lon: Double, needConvertGCJ02: Boolean = true, isAnimMoveCamera: Boolean = true
|
lat: Double, lon: Double, needConvertGCJ02: Boolean = true, isAnimMoveCamera: Boolean = false
|
||||||
) {
|
) {
|
||||||
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
val latLng = getBaiduMapLatLng(lat, lon, needConvertGCJ02)
|
||||||
|
|
||||||
@@ -359,7 +359,7 @@ abstract class BaseBaiduMapFragment :
|
|||||||
* 改变地图手势的中心点(地图的中心点)
|
* 改变地图手势的中心点(地图的中心点)
|
||||||
* @param latLng 已经是转换好的坐标
|
* @param latLng 已经是转换好的坐标
|
||||||
*/
|
*/
|
||||||
fun moveCameraLocation(latLng: LatLng, isAnimMoveCamera: Boolean = true) {
|
fun moveCameraLocation(latLng: LatLng, isAnimMoveCamera: Boolean = false) {
|
||||||
moveCameraLocation(latLng.latitude, latLng.longitude, false, isAnimMoveCamera)
|
moveCameraLocation(latLng.latitude, latLng.longitude, false, isAnimMoveCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,8 @@ abstract class BaseGoogleMapFragment :
|
|||||||
//默认华盛顿经纬度
|
//默认华盛顿经纬度
|
||||||
val lat = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLat, 38.913611)
|
val lat = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLat, 38.913611)
|
||||||
val lon = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLon, -77.013222)
|
val lon = MMKVUtil.getDouble(MMKVKey.MapShowDefaultLon, -77.013222)
|
||||||
val position = CameraPosition.fromLatLngZoom(LatLng(lat, lon), 4f)
|
//不使用地图摄像头移动动画,默认级别一样大
|
||||||
|
val position = CameraPosition.fromLatLngZoom(LatLng(lat, lon), mGoogleMapZoom)
|
||||||
camera(position)
|
camera(position)
|
||||||
}
|
}
|
||||||
mGoogleMapView = MapView(this.requireActivity(), options)
|
mGoogleMapView = MapView(this.requireActivity(), options)
|
||||||
@@ -244,7 +245,7 @@ abstract class BaseGoogleMapFragment :
|
|||||||
/**
|
/**
|
||||||
* 根据CameraUpdate移动摄像机
|
* 根据CameraUpdate移动摄像机
|
||||||
*/
|
*/
|
||||||
fun moveCameraUpdate(lat: Double, lon: Double, isAnimMoveCamera: Boolean = true) {
|
fun moveCameraUpdate(lat: Double, lon: Double, isAnimMoveCamera: Boolean = false) {
|
||||||
if (null == mCameraUpdate) {
|
if (null == mCameraUpdate) {
|
||||||
moveCameraLocation(lat, lon, isAnimMoveCamera)
|
moveCameraLocation(lat, lon, isAnimMoveCamera)
|
||||||
LogUtil.e("moveCameraUpdate---------->CameraUpdate=null,摄像机移动靠moveCameraLocation经纬度")
|
LogUtil.e("moveCameraUpdate---------->CameraUpdate=null,摄像机移动靠moveCameraLocation经纬度")
|
||||||
@@ -263,14 +264,14 @@ abstract class BaseGoogleMapFragment :
|
|||||||
/**
|
/**
|
||||||
* 根据CameraUpdate移动摄像机
|
* 根据CameraUpdate移动摄像机
|
||||||
*/
|
*/
|
||||||
fun moveCameraUpdate(latLng: LatLng, isAnimMoveCamera: Boolean = true) {
|
fun moveCameraUpdate(latLng: LatLng, isAnimMoveCamera: Boolean = false) {
|
||||||
moveCameraUpdate(latLng.latitude, latLng.longitude, isAnimMoveCamera)
|
moveCameraUpdate(latLng.latitude, latLng.longitude, isAnimMoveCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动到某个位置 为中心点
|
* 移动到某个位置 为中心点
|
||||||
*/
|
*/
|
||||||
fun moveCameraLocation(latLng: LatLng, isAnimMoveCamera: Boolean = true) {
|
fun moveCameraLocation(latLng: LatLng, isAnimMoveCamera: Boolean = false) {
|
||||||
mGoogleMap?.apply {
|
mGoogleMap?.apply {
|
||||||
//animateCamera使用动画
|
//animateCamera使用动画
|
||||||
if (isAnimMoveCamera) {
|
if (isAnimMoveCamera) {
|
||||||
@@ -288,7 +289,7 @@ abstract class BaseGoogleMapFragment :
|
|||||||
/**
|
/**
|
||||||
* 移动到某个位置 为中心点
|
* 移动到某个位置 为中心点
|
||||||
*/
|
*/
|
||||||
fun moveCameraLocation(lat: Double, lon: Double, isAnimMoveCamera: Boolean = true) {
|
fun moveCameraLocation(lat: Double, lon: Double, isAnimMoveCamera: Boolean = false) {
|
||||||
moveCameraLocation(LatLng(lat, lon), isAnimMoveCamera)
|
moveCameraLocation(LatLng(lat, lon), isAnimMoveCamera)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,7 +374,7 @@ abstract class BaseGoogleMapFragment :
|
|||||||
fun refreshPetCurrentLocation(
|
fun refreshPetCurrentLocation(
|
||||||
latLng: LatLng,
|
latLng: LatLng,
|
||||||
needMoveCamera: Boolean = true,
|
needMoveCamera: Boolean = true,
|
||||||
isAnimMoveCamera: Boolean = true,
|
isAnimMoveCamera: Boolean = false,
|
||||||
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
headBgResId: Int = R.drawable.pic_map_gps_avatar
|
||||||
) {
|
) {
|
||||||
mPetLatLng = latLng
|
mPetLatLng = latLng
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
mFencesCircleView.postDelayed({
|
mFencesCircleView.postDelayed({
|
||||||
isMapZoomReady = true
|
isMapZoomReady = true
|
||||||
restoreEditFences()
|
restoreEditFences()
|
||||||
}, 1500)
|
}, 1000)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,14 +251,14 @@ class HomeMapGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
// addUserAndPetLine(latLng)
|
// addUserAndPetLine(latLng)
|
||||||
refreshPetCurrentLocation(latLng, needMoveCamera = isMoveCamera)
|
refreshPetCurrentLocation(latLng, needMoveCamera = isMoveCamera)
|
||||||
|
|
||||||
mRippleCircle?.apply {
|
// mRippleCircle?.apply {
|
||||||
//一像素对应几米
|
// //一像素对应几米
|
||||||
val pxDis = 2.0.pow(15.5 - getGoogleMapZoom())
|
// val pxDis = 2.0.pow(15.5 - getGoogleMapZoom())
|
||||||
mRippleCircleRadius = (pxDis * 150).toInt()
|
// mRippleCircleRadius = (pxDis * 150).toInt()
|
||||||
fillColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
// fillColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
||||||
strokeColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
// strokeColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
||||||
mValueAnimator?.duration = 2000
|
// mValueAnimator?.duration = 2000
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -277,15 +277,6 @@ class HomeMapGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// addPolyLines(mGoogleMap!!, latLngList)
|
// addPolyLines(mGoogleMap!!, latLngList)
|
||||||
|
|
||||||
mRippleCircle?.apply {
|
|
||||||
//一像素对应几米
|
|
||||||
val pxDis = 2.0.pow(15.5 - getGoogleMapZoom())
|
|
||||||
mRippleCircleRadius = (pxDis * 150).toInt()
|
|
||||||
fillColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
|
||||||
strokeColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
|
||||||
mValueAnimator?.duration = 2000
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -301,6 +292,20 @@ class HomeMapGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直播开始之后,改变绿色波纹动画
|
||||||
|
*/
|
||||||
|
fun greenRippleCircleAnim() {
|
||||||
|
mRippleCircle?.apply {
|
||||||
|
//一像素对应几米
|
||||||
|
val pxDis = 2.0.pow(15.5 - getGoogleMapZoom())
|
||||||
|
mRippleCircleRadius = (pxDis * 150).toInt()
|
||||||
|
fillColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
||||||
|
strokeColor = (ContextCompat.getColor(mContext!!, R.color.select_color5))
|
||||||
|
mValueAnimator?.duration = 2000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDetach() {
|
override fun onDetach() {
|
||||||
super.onDetach()
|
super.onDetach()
|
||||||
mValueAnimator?.cancel()
|
mValueAnimator?.cancel()
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.os.Build
|
|||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import androidx.lifecycle.LifecycleCoroutineScope
|
import androidx.lifecycle.LifecycleCoroutineScope
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import cn.jpush.android.api.JPushInterface
|
import cn.jpush.android.api.JPushInterface
|
||||||
import com.abbidot.baselibrary.constant.EventName
|
import com.abbidot.baselibrary.constant.EventName
|
||||||
import com.abbidot.baselibrary.constant.MMKVKey
|
import com.abbidot.baselibrary.constant.MMKVKey
|
||||||
@@ -18,20 +19,25 @@ import com.abbidot.baselibrary.util.MMKVUtil
|
|||||||
import com.abbidot.baselibrary.util.Utils
|
import com.abbidot.baselibrary.util.Utils
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
|
import com.abbidot.tracker.base.BaseDialog
|
||||||
import com.abbidot.tracker.bean.BleReportDataBean
|
import com.abbidot.tracker.bean.BleReportDataBean
|
||||||
import com.abbidot.tracker.bean.MapDeviceBean
|
import com.abbidot.tracker.bean.MapDeviceBean
|
||||||
import com.abbidot.tracker.bean.MessageBean
|
import com.abbidot.tracker.bean.MessageBean
|
||||||
import com.abbidot.tracker.bean.UserBean
|
import com.abbidot.tracker.bean.UserBean
|
||||||
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.database.MyDatabase
|
import com.abbidot.tracker.database.MyDatabase
|
||||||
|
import com.abbidot.tracker.dialog.CommonDialog2
|
||||||
import com.abbidot.tracker.dialog.PackageUpgradeDialog
|
import com.abbidot.tracker.dialog.PackageUpgradeDialog
|
||||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||||
import com.abbidot.tracker.ui.activity.SayHelloActivity
|
import com.abbidot.tracker.ui.activity.SayHelloActivity
|
||||||
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
import com.abbidot.tracker.ui.activity.device.AddNewTracker1Activity
|
||||||
import com.abbidot.tracker.ui.activity.pet.ShowInviteDeviceActivity
|
import com.abbidot.tracker.ui.activity.pet.ShowInviteDeviceActivity
|
||||||
import com.abbidot.tracker.ui.activity.pet.first.FirstSetPetTypeActivity
|
import com.abbidot.tracker.ui.activity.pet.first.FirstSetPetTypeActivity
|
||||||
|
import com.abbidot.tracker.ui.activity.subscribe.SubscriptionPlanActivity
|
||||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||||
|
import com.abbidot.tracker.vm.SubscriptionManageViewModel
|
||||||
import com.baidu.mapapi.utils.DistanceUtil
|
import com.baidu.mapapi.utils.DistanceUtil
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.google.android.gms.maps.model.LatLng
|
import com.google.android.gms.maps.model.LatLng
|
||||||
@@ -623,7 +629,7 @@ class Util {
|
|||||||
PermissionLists.getBluetoothScanPermission(),
|
PermissionLists.getBluetoothScanPermission(),
|
||||||
PermissionLists.getBluetoothConnectPermission()
|
PermissionLists.getBluetoothConnectPermission()
|
||||||
)
|
)
|
||||||
) || !SRBleUtil.instance.isBlueEnable(context)
|
) || !SRBleUtil.instance.isBleEnable(context)
|
||||||
) {
|
) {
|
||||||
hasPermissions = false
|
hasPermissions = false
|
||||||
}
|
}
|
||||||
@@ -658,14 +664,17 @@ class Util {
|
|||||||
* 检查蓝牙权限和开关
|
* 检查蓝牙权限和开关
|
||||||
*/
|
*/
|
||||||
fun checkBluetoothPermissionsEnabled(
|
fun checkBluetoothPermissionsEnabled(
|
||||||
context: Context, successAuthorize: () -> Unit, isShowToast: Boolean = true
|
context: Context,
|
||||||
|
successAuthorize: () -> Unit,
|
||||||
|
isShowToast: Boolean = true,
|
||||||
|
isCheckBleOpen: Boolean = true
|
||||||
) {
|
) {
|
||||||
checkPermissions(
|
checkPermissions(
|
||||||
context,
|
context,
|
||||||
object : RequestPermissionCallback {
|
object : RequestPermissionCallback {
|
||||||
override fun onRequestPermissionSuccess() {
|
override fun onRequestPermissionSuccess() {
|
||||||
//判断蓝牙是否打开
|
//判断蓝牙是否打开
|
||||||
if (!SRBleUtil.instance.isBlueEnable(context)) {
|
if (isCheckBleOpen && !SRBleUtil.instance.isBleEnable(context)) {
|
||||||
SRBleUtil.instance.openBluetooth(context)
|
SRBleUtil.instance.openBluetooth(context)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -715,13 +724,60 @@ class Util {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 套餐过期提示充值
|
||||||
|
*/
|
||||||
|
fun checkPackageExpired(activity: BaseActivity<*>, deviceId: String) {
|
||||||
|
LogUtil.e("套餐过期deviceId=$deviceId")
|
||||||
|
CommonDialog2(
|
||||||
|
activity,
|
||||||
|
activity.getString(R.string.txt_subscription_expired),
|
||||||
|
activity.getString(R.string.txt_card_recharge),
|
||||||
|
object : BaseDialog.OnDialogOkListener {
|
||||||
|
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||||
|
ViewModelProvider(activity)[SubscriptionManageViewModel::class.java].apply {
|
||||||
|
mSubscriptionsOrderLiveData.observe(activity) {
|
||||||
|
activity.dealRequestResult(it, object : GetResultCallback {
|
||||||
|
override fun onResult(any: Any) {
|
||||||
|
it.getOrNull()?.let { list ->
|
||||||
|
for (l in list) {
|
||||||
|
if (l.deviceId == deviceId) {
|
||||||
|
Intent(
|
||||||
|
activity,
|
||||||
|
SubscriptionPlanActivity::class.java
|
||||||
|
).let { i ->
|
||||||
|
i.putExtra(ConstantString.LkSetMeal, l)
|
||||||
|
i.putExtra(
|
||||||
|
ConstantString.RechargeType,
|
||||||
|
ConstantInt.Type2
|
||||||
|
)
|
||||||
|
activity.startActivity(i)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
mSubscriptionsOrderLiveData.removeObservers(activity)
|
||||||
|
}
|
||||||
|
getSubscriptionsOrder()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).show()
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础套餐权限控制
|
* 基础套餐权限控制
|
||||||
*/
|
*/
|
||||||
fun checkPackageLimit(
|
fun checkPackageLimit(activity: BaseActivity<*>, deviceId: String): Boolean {
|
||||||
activity: BaseActivity<*>, deviceId: String
|
|
||||||
): Boolean {
|
|
||||||
LogUtil.e("基础套餐权限控制deviceId=$deviceId")
|
LogUtil.e("基础套餐权限控制deviceId=$deviceId")
|
||||||
|
//先判断有没有过期
|
||||||
|
val availableOrder = MMKVUtil.getInt(MMKVKey.AvailableOrder, 1)
|
||||||
|
if (availableOrder == ConstantInt.Type0) {
|
||||||
|
checkPackageExpired(activity, deviceId)
|
||||||
|
return true
|
||||||
|
}
|
||||||
val mealType = MMKVUtil.getInt(MMKVKey.MealType)
|
val mealType = MMKVUtil.getInt(MMKVKey.MealType)
|
||||||
if (ConstantInt.BasicPackage == mealType) {
|
if (ConstantInt.BasicPackage == mealType) {
|
||||||
PackageUpgradeDialog(activity, deviceId).show()
|
PackageUpgradeDialog(activity, deviceId).show()
|
||||||
@@ -768,6 +824,13 @@ class Util {
|
|||||||
return updateMin > ConstantInt.ReportTimeOutTime
|
return updateMin > ConstantInt.ReportTimeOutTime
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 是否限制时间执行
|
||||||
|
*/
|
||||||
|
fun isTimeLimit(cTime: Long, limitSecond: Int = 1): Boolean {
|
||||||
|
return System.currentTimeMillis() - cTime < limitSecond * 1000
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取保存的地图模式 地图类型,0标准 1卫星地图
|
* 获取保存的地图模式 地图类型,0标准 1卫星地图
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -985,6 +985,9 @@ class ViewUtil private constructor() {
|
|||||||
MMKVUtil.putInt(MMKVKey.PetSelectPosition, selectPos)
|
MMKVUtil.putInt(MMKVKey.PetSelectPosition, selectPos)
|
||||||
//保存当前设备的套餐类型,控制权限
|
//保存当前设备的套餐类型,控制权限
|
||||||
MMKVUtil.putInt(MMKVKey.MealType, petBean.mealType)
|
MMKVUtil.putInt(MMKVKey.MealType, petBean.mealType)
|
||||||
|
//套餐是否过期
|
||||||
|
MMKVUtil.putInt(MMKVKey.AvailableOrder, petBean.availableOrder)
|
||||||
|
LogUtil.e("保存宠物相关数据到本地,savePetSP")
|
||||||
//保存当前宠物是否分享的
|
//保存当前宠物是否分享的
|
||||||
MMKVUtil.putInt(MMKVKey.Shared, petBean.shared)
|
MMKVUtil.putInt(MMKVKey.Shared, petBean.shared)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,12 +16,10 @@ import com.abbidot.baselibrary.eventbus.XEventBus
|
|||||||
import com.abbidot.baselibrary.util.AppUtils
|
import com.abbidot.baselibrary.util.AppUtils
|
||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
import com.abbidot.tracker.bean.BleTrackDeviceBean
|
||||||
import com.abbidot.tracker.bean.FencesBean
|
|
||||||
import com.abbidot.tracker.bean.ReceiveDeviceData
|
import com.abbidot.tracker.bean.ReceiveDeviceData
|
||||||
import com.abbidot.tracker.util.Util
|
import com.abbidot.tracker.util.Util
|
||||||
import com.clj.fastble.BleManager
|
import com.clj.fastble.BleManager
|
||||||
import com.clj.fastble.callback.BleGattCallback
|
import com.clj.fastble.callback.BleGattCallback
|
||||||
import com.clj.fastble.callback.BleMtuChangedCallback
|
|
||||||
import com.clj.fastble.callback.BleNotifyCallback
|
import com.clj.fastble.callback.BleNotifyCallback
|
||||||
import com.clj.fastble.callback.BleRssiCallback
|
import com.clj.fastble.callback.BleRssiCallback
|
||||||
import com.clj.fastble.callback.BleWriteCallback
|
import com.clj.fastble.callback.BleWriteCallback
|
||||||
@@ -112,7 +110,7 @@ class SRBleUtil private constructor() {
|
|||||||
/**
|
/**
|
||||||
* 判断当前Android设备的蓝牙是否已经打开
|
* 判断当前Android设备的蓝牙是否已经打开
|
||||||
*/
|
*/
|
||||||
fun isBlueEnable(context: Context): Boolean {
|
fun isBleEnable(context: Context): Boolean {
|
||||||
// BleManager.getInstance().isBlueEnable
|
// BleManager.getInstance().isBlueEnable
|
||||||
// 获取BluetoothManager服务
|
// 获取BluetoothManager服务
|
||||||
val bluetoothManager =
|
val bluetoothManager =
|
||||||
@@ -173,7 +171,7 @@ class SRBleUtil private constructor() {
|
|||||||
LogUtil.e("蓝牙断开${bleDevice.name},${bleDevice.mac},activeDisConnected=$isActiveDisConnected,status=$status")
|
LogUtil.e("蓝牙断开${bleDevice.name},${bleDevice.mac},activeDisConnected=$isActiveDisConnected,status=$status")
|
||||||
notifyDeviceState(bleDevice, ConState.DISCONNECTED)
|
notifyDeviceState(bleDevice, ConState.DISCONNECTED)
|
||||||
mContext?.apply {
|
mContext?.apply {
|
||||||
if (isBlueEnable(this) && !isActiveDisConnected) {
|
if (isBleEnable(this) && !isActiveDisConnected) {
|
||||||
connect(bleDevice)
|
connect(bleDevice)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class ConnectionDeviceViewModel : ViewModel() {
|
|||||||
|
|
||||||
fun autoConnectBleDevice(context: Context) {
|
fun autoConnectBleDevice(context: Context) {
|
||||||
//判断蓝牙是否打开
|
//判断蓝牙是否打开
|
||||||
if (!SRBleUtil.instance.isBlueEnable(context)) {
|
if (!SRBleUtil.instance.isBleEnable(context)) {
|
||||||
LogUtil.e("automaticConnection,蓝牙没打开")
|
LogUtil.e("automaticConnection,蓝牙没打开")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -144,6 +144,10 @@ class ConnectionDeviceViewModel : ViewModel() {
|
|||||||
if (TextUtils.isEmpty(mac)) {
|
if (TextUtils.isEmpty(mac)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (BleManager.getInstance().isConnected(mac)) {
|
||||||
|
LogUtil.e("设备已经连接")
|
||||||
|
return
|
||||||
|
}
|
||||||
if (SRBleUtil.instance.isBleConnecting) {
|
if (SRBleUtil.instance.isBleConnecting) {
|
||||||
LogUtil.e("已经有设备在连接中...")
|
LogUtil.e("已经有设备在连接中...")
|
||||||
XEventBus.post(EventName.ActionConDeviceState, ConState.CONNECTING_MAC)
|
XEventBus.post(EventName.ActionConDeviceState, ConState.CONNECTING_MAC)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class FindBleDeviceViewModel : ViewModel() {
|
|||||||
if (TextUtils.isEmpty(mac)) {
|
if (TextUtils.isEmpty(mac)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (!SRBleUtil.instance.isBlueEnable(activity)) {
|
if (!SRBleUtil.instance.isBleEnable(activity)) {
|
||||||
activity.showToast(R.string.txt_ble_enable)
|
activity.showToast(R.string.txt_ble_enable)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,14 @@
|
|||||||
style="@style/map_image_yellow_btn_style"
|
style="@style/map_image_yellow_btn_style"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:layout_marginEnd="@dimen/dp_18"
|
android:layout_marginEnd="@dimen/dp_18"
|
||||||
android:layout_marginBottom="@dimen/dp_36" />
|
android:layout_marginBottom="@dimen/dp_36"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_wifi_power_zone2_map_type_btn"
|
||||||
|
style="@style/map_image_white_btn_style"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/dp_16" />
|
||||||
|
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ import androidx.annotation.StringDef
|
|||||||
MMKVKey.MapType,
|
MMKVKey.MapType,
|
||||||
MMKVKey.ShowFence,
|
MMKVKey.ShowFence,
|
||||||
MMKVKey.isCrash,
|
MMKVKey.isCrash,
|
||||||
|
MMKVKey.AvailableOrder,
|
||||||
|
MMKVKey.isFirstCheckBleOpen,
|
||||||
MMKVKey.Shared
|
MMKVKey.Shared
|
||||||
)
|
)
|
||||||
@Retention(AnnotationRetention.SOURCE)
|
@Retention(AnnotationRetention.SOURCE)
|
||||||
@@ -93,9 +95,13 @@ annotation class MMKVKey {
|
|||||||
|
|
||||||
//套餐类型
|
//套餐类型
|
||||||
const val MealType = "mealType"
|
const val MealType = "mealType"
|
||||||
|
//套餐是否可用
|
||||||
|
const val AvailableOrder = "availableOrder"
|
||||||
|
|
||||||
//是否分享的
|
//是否分享的
|
||||||
const val Shared = "shared"
|
const val Shared = "shared"
|
||||||
const val isCrash = "isCrash"
|
const val isCrash = "isCrash"
|
||||||
|
//首次检查蓝牙是否开关
|
||||||
|
const val isFirstCheckBleOpen = "isFirstCheckBleOpen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user