1.修复编辑wifi zone名称时,部分机型输入法会挡住输入框
2.GPS的“Weak signal”替换“No signal”状态 3.隐藏APP中的里程和总里程显示 4.新增手机无网络,开启APP后,手机网络恢复,APP自动获取内容 5.添加/编辑wifi时,不显示复位按钮;位置不可拖动,不显示宠物 6.修改toast白底黑字样式 7.直播禁用,采用不可点击状态,而不是隐藏按钮,点击提示文案:Live works on cellular only 8. 修改不能添加或者解绑宠物,添加设备自动绑定宠物“My Pet” 9.解绑设备改为不需要蓝牙解绑并优化ui
This commit is contained in:
@@ -30,7 +30,7 @@ android {
|
||||
targetSdkVersion 35
|
||||
versionCode 2101
|
||||
// versionName "2.1.1"
|
||||
versionName "2.1.1-Beta9"
|
||||
versionName "2.1.1-Beta10"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
@@ -102,6 +102,7 @@ android {
|
||||
zipAlignEnabled false
|
||||
// 设置混淆
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
|
||||
|
||||
13
app/proguard-rules.pro
vendored
13
app/proguard-rules.pro
vendored
@@ -19,3 +19,16 @@
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
|
||||
|
||||
#禁用所有优化规则,查看混淆后 APK是否可以正常工作
|
||||
-dontoptimize
|
||||
|
||||
# Please add these rules to your existing keep rules in order to suppress warnings.
|
||||
# This is generated automatically by the Android Gradle plugin.
|
||||
-dontwarn com.baidu.mapsdkplatform.comapi.util.SysOSAPI
|
||||
-dontwarn com.daimajia.easing.Glider
|
||||
-dontwarn com.daimajia.easing.Skill
|
||||
|
||||
-keep class android.*
|
||||
@@ -34,9 +34,11 @@ class MyTrackerV2Adapter(
|
||||
val batteryTextView = holder!!.getTextView(R.id.iv_item_my_tracker_v2_battery)
|
||||
val trackerImageView = holder.getImageView(R.id.iv_item_my_tracker_v2_device)
|
||||
val addTrackerLayout = holder.getView(R.id.ll_my_tracker_v2_add_tracker_layout)
|
||||
val petAddLayout = holder.getView(R.id.rl_my_tracker_v2_pet)
|
||||
val petHead = holder.getView(R.id.il_my_tracker_v2_pet_head) as QMUIRadiusImageView
|
||||
val addPetLayout = holder.getView(R.id.ll_my_tracker_v2_add_pet_layout)
|
||||
val trackerName = holder.getTextView(R.id.tv_my_tracker_v2_device_name)
|
||||
val linkImage = holder.getImageView(R.id.iv_my_tracker_v2_link_image)
|
||||
val petName = holder.getTextView(R.id.tv_my_tracker_v2_pet_name)
|
||||
|
||||
holder.getImageView(R.id.iv_my_tracker_v2_share).apply {
|
||||
@@ -79,10 +81,14 @@ class MyTrackerV2Adapter(
|
||||
trackerName.visibility = View.GONE
|
||||
addTrackerLayout.visibility = View.VISIBLE
|
||||
|
||||
addPetLayout.visibility = View.VISIBLE
|
||||
petAddLayout.visibility = View.GONE
|
||||
addPetLayout.visibility = View.GONE
|
||||
linkImage.visibility = View.GONE
|
||||
petHead.visibility = View.GONE
|
||||
petName.visibility = View.GONE
|
||||
} else {
|
||||
petAddLayout.visibility = View.VISIBLE
|
||||
linkImage.visibility = View.VISIBLE
|
||||
if (TextUtils.isEmpty(item.deviceOutId)) {
|
||||
addTrackerLayout.visibility = View.VISIBLE
|
||||
batteryTextView.visibility = View.GONE
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.viewbinding.ViewBinding
|
||||
import com.abbidot.baselibrary.util.LogUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
|
||||
@@ -35,7 +36,7 @@ abstract class BaseFragment<T : ViewBinding>(
|
||||
var mLoadingDialog: QMUITipDialog? = null
|
||||
|
||||
//防止某个时间执行多次
|
||||
var mLimitExecutionTime = 0L
|
||||
private var mLimitExecutionTime = 0L
|
||||
|
||||
/**
|
||||
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
||||
@@ -151,6 +152,18 @@ abstract class BaseFragment<T : ViewBinding>(
|
||||
(activity as BaseActivity<*>).launchActivity(activityResultLauncher, intent)
|
||||
}
|
||||
|
||||
/**
|
||||
* 限制多次点击按钮
|
||||
*/
|
||||
fun isLimitClick(): Boolean {
|
||||
//防止执行多次弹窗
|
||||
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
||||
return true
|
||||
}
|
||||
mLimitExecutionTime = System.currentTimeMillis()
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一处理网络请求结果
|
||||
*/
|
||||
|
||||
@@ -489,13 +489,17 @@ class FencesAddActivity : BaseActivity<ActivityFencesAddBinding>(ActivityFencesA
|
||||
override fun rectEndDragClick() {
|
||||
}
|
||||
|
||||
override fun circleScaleClick() {
|
||||
override fun circleScaleEndClick() {
|
||||
mFencesMapCommon.refreshDistance()
|
||||
}
|
||||
|
||||
override fun circleStartDragClick() {
|
||||
}
|
||||
|
||||
override fun circleScalingClick() {
|
||||
|
||||
}
|
||||
|
||||
override fun circleEndDragClick() {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,10 @@ package com.abbidot.tracker.ui.activity
|
||||
import android.bluetooth.BluetoothAdapter
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.net.ConnectivityManager
|
||||
import android.net.Network
|
||||
import android.net.NetworkCapabilities
|
||||
import android.net.NetworkRequest
|
||||
import android.text.TextUtils
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
@@ -66,6 +70,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
/**
|
||||
* v2版主页
|
||||
*/
|
||||
@@ -139,7 +144,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
}, 1)
|
||||
|
||||
//解决异常 https://blog.csdn.net/w_lin/article/details/123872656
|
||||
it.isSaveEnabled=false
|
||||
it.isSaveEnabled = false
|
||||
|
||||
edgeToEdgeAdapterBars(it)
|
||||
}
|
||||
@@ -163,8 +168,29 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
MMKVUtil.putBoolean(MMKVKey.isCrash, false)
|
||||
showToast(R.string.txt_show_crash)
|
||||
mCountdownType = ConstantInt.Type0
|
||||
mCountDownTimerViewModel.startCountDown(6)
|
||||
mCountDownTimerViewModel.startCountDown(5)
|
||||
} else {
|
||||
val connectivityManager = getSystemService(CONNECTIVITY_SERVICE) as ConnectivityManager
|
||||
val networkCallback: ConnectivityManager.NetworkCallback =
|
||||
object : ConnectivityManager.NetworkCallback() {
|
||||
override fun onAvailable(network: Network) {
|
||||
// 当网络可用时调用
|
||||
super.onAvailable(network)
|
||||
LogUtil.e("当网络可用时,onAvailable")
|
||||
if (mNetworkRequestsFailRetryCount == mNetworkRequestsFailMaxCount && mPetList.size == 0) {
|
||||
mNetworkRequestsFailRetryCount = 0
|
||||
isFirst = false
|
||||
mDataViewModel.getHomeBindPetList(this@HomeV2Activity)
|
||||
}
|
||||
}
|
||||
}
|
||||
val networkRequest =
|
||||
NetworkRequest.Builder().addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_ETHERNET)
|
||||
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR).build()
|
||||
connectivityManager.registerNetworkCallback(networkRequest, networkCallback)
|
||||
|
||||
//注册监听蓝牙开关广播
|
||||
mBleListenerReceiver = BluetoothMonitorReceiver()
|
||||
val intentFilter = IntentFilter()
|
||||
@@ -174,7 +200,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
|
||||
checkPermissions()
|
||||
|
||||
mDataViewModel.getHomeBindPetList(this)
|
||||
mDataViewModel.getHomeBindPetList(this@HomeV2Activity)
|
||||
|
||||
//设置bugly的用户id
|
||||
CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email))
|
||||
|
||||
@@ -30,7 +30,7 @@ class MoreActivityActivity :
|
||||
|
||||
private val mDataDetailViewModel: DataDetailViewModel by viewModels()
|
||||
|
||||
private var mCalenderDialog: ShowCalenderDialog? = null
|
||||
// private var mCalenderDialog: ShowCalenderDialog? = null
|
||||
private lateinit var mMonthsAbbr: Array<String>
|
||||
|
||||
private var mPetBean: PetBean? = null
|
||||
|
||||
@@ -125,12 +125,14 @@ class AddPairedSuccessActivity :
|
||||
override fun onResult(any: Any) {
|
||||
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
|
||||
XEventBus.post(EventName.RefreshDevice)
|
||||
if (isFirstBind) {
|
||||
mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
||||
// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
|
||||
// intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
// startActivityFinish(intent)
|
||||
} else finish()
|
||||
|
||||
mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
||||
// if (isFirstBind) {
|
||||
// mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
||||
//// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
|
||||
//// intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
//// startActivityFinish(intent)
|
||||
// } else finish()
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
@@ -202,11 +204,14 @@ class AddPairedSuccessActivity :
|
||||
showToast(R.string.txt_bind_success, isFinish = true)
|
||||
mViewBinding.root.postDelayed({
|
||||
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.isBind)
|
||||
mPetBean?.apply {
|
||||
val intent = Intent(mContext, AddWifiPowerZone1Activity::class.java)
|
||||
intent.putExtra(ConstantString.Pet, this)
|
||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
startActivity(intent)
|
||||
if (isFirstBind) {
|
||||
mPetBean?.apply {
|
||||
val intent =
|
||||
Intent(mContext, AddWifiPowerZone1Activity::class.java)
|
||||
intent.putExtra(ConstantString.Pet, this)
|
||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||
startActivity(intent)
|
||||
}
|
||||
}
|
||||
}, 1500)
|
||||
}
|
||||
|
||||
@@ -1,17 +1,37 @@
|
||||
package com.abbidot.tracker.ui.activity.device
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.abbidot.baselibrary.constant.EventName
|
||||
import com.abbidot.baselibrary.constant.MMKVKey
|
||||
import com.abbidot.baselibrary.eventbus.XEventBus
|
||||
import com.abbidot.baselibrary.util.MMKVUtil
|
||||
import com.abbidot.tracker.R
|
||||
import com.abbidot.tracker.base.BaseActivity
|
||||
import com.abbidot.tracker.base.BaseDialog
|
||||
import com.abbidot.tracker.bean.DeviceBean
|
||||
import com.abbidot.tracker.constant.ConstantInt
|
||||
import com.abbidot.tracker.constant.ConstantString
|
||||
import com.abbidot.tracker.constant.GetResultCallback
|
||||
import com.abbidot.tracker.database.MyDatabase
|
||||
import com.abbidot.tracker.databinding.ActivityDeleteTracker1Binding
|
||||
import com.abbidot.tracker.dialog.CommonDialog1
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.vm.TrackerSetViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class DeleteTracker1Activity :
|
||||
BaseActivity<ActivityDeleteTracker1Binding>(ActivityDeleteTracker1Binding::inflate) {
|
||||
|
||||
private val mTrackerSetViewModel: TrackerSetViewModel by viewModels()
|
||||
|
||||
private var mDeviceBean: DeviceBean? = null
|
||||
private var isOnlyBindOneDevice = false
|
||||
|
||||
@@ -34,16 +54,93 @@ class DeleteTracker1Activity :
|
||||
}
|
||||
}
|
||||
|
||||
override fun liveDataObserve() {
|
||||
//解绑设备/删除设备
|
||||
mTrackerSetViewModel.mUnbindDeviceLiveData.observe(this@DeleteTracker1Activity) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
lifecycleScope.launch {
|
||||
withContext(Dispatchers.IO) {
|
||||
mDeviceBean?.let { device ->
|
||||
SRBleUtil.instance.disconnectToMac(device.macId)
|
||||
//删除设备成功后,把本地数据库中的设备也删除
|
||||
MyDatabase.deviceDao().deleteByParams(
|
||||
ConstantString.DeviceId,
|
||||
device.deviceId,
|
||||
MyDatabase.DeviceTableName
|
||||
)
|
||||
runOnUiThread {
|
||||
showDeleteDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
super.onRequestError(exceptionCode)
|
||||
setButtonEnabled(mViewBinding.btnNextDeleteTracker1, ConstantInt.Type1)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun showDeleteDialog() {
|
||||
if (isOnlyBindOneDevice) {
|
||||
XEventBus.post(EventName.LogOut)
|
||||
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.Type0)
|
||||
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.Type0)
|
||||
} else {
|
||||
XEventBus.post(EventName.DeleteDevice)
|
||||
}
|
||||
CommonDialog1(
|
||||
mContext,
|
||||
"",
|
||||
getString(R.string.txt_delete_succe),
|
||||
false,
|
||||
5f,
|
||||
Typeface.BOLD,
|
||||
R.color.data_black_color,
|
||||
false,
|
||||
okClickListener = object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
if (isOnlyBindOneDevice) {
|
||||
val intent = Intent(mContext, AddNewTracker1Activity::class.java)
|
||||
intent.putExtra(ConstantString.isFirstBind, true)
|
||||
startActivityFinish(intent)
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
}).show()
|
||||
}
|
||||
|
||||
private fun sureDeleteDevice() {
|
||||
ViewUtil.instance.showDialog(
|
||||
mContext, getString(R.string.txt_delete_tips), object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
dialog.dismiss()
|
||||
mDeviceBean?.apply {
|
||||
setButtonEnabled(mViewBinding.btnNextDeleteTracker1, ConstantInt.Type0)
|
||||
mTrackerSetViewModel.unbindDevice(this@DeleteTracker1Activity, deviceId)
|
||||
}
|
||||
}
|
||||
}, okTextResId = R.string.txt_sure
|
||||
)
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
if (isLimitClick()) return
|
||||
mViewBinding.apply {
|
||||
when (v!!) {
|
||||
btnCancelDeleteTracker1 -> finish()
|
||||
btnNextDeleteTracker1 -> {
|
||||
Intent(mContext, DeleteTracker2Activity::class.java).let {
|
||||
it.putExtra(ConstantString.DeviceInfo, mDeviceBean)
|
||||
it.putExtra(ConstantString.isCheck, isOnlyBindOneDevice)
|
||||
startActivityFinish(it)
|
||||
}
|
||||
sureDeleteDevice()
|
||||
// Intent(mContext, DeleteTracker2Activity::class.java).let {
|
||||
// it.putExtra(ConstantString.DeviceInfo, mDeviceBean)
|
||||
// it.putExtra(ConstantString.isCheck, isOnlyBindOneDevice)
|
||||
// startActivityFinish(it)
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,31 +398,35 @@ class MyTrackerV2Activity :
|
||||
val device = mMyTrackerAdapter.getData()[pos]
|
||||
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
||||
dialog.dismiss()
|
||||
when (position) {
|
||||
0 -> if (null == device.pet) deleteDevice(device)
|
||||
else getUnAssignDeviceData()
|
||||
|
||||
1 -> if (!isOnlyBindOneDevice) unAssignDeviceDialogTips(device)
|
||||
else deleteDevice(device)
|
||||
|
||||
2 -> deleteDevice(device)
|
||||
}
|
||||
}, title = device.deviceOutId).apply {
|
||||
if (null == device.pet) {
|
||||
addItem(
|
||||
getString(R.string.txt_delete) + " ${device.deviceOutId}"
|
||||
)
|
||||
} else {
|
||||
addItem(getString(R.string.txt_assign_other_tracker))
|
||||
if (!isOnlyBindOneDevice) {
|
||||
addItem(
|
||||
String.format(getString(R.string.txt_unassign_other), device.deviceOutId)
|
||||
)
|
||||
}
|
||||
addItem(
|
||||
getString(R.string.txt_delete) + " ${device.deviceOutId}"
|
||||
)
|
||||
deleteDevice(device)
|
||||
// when (position) {
|
||||
// 0 -> if (null == device.pet) deleteDevice(device)
|
||||
// else getUnAssignDeviceData()
|
||||
//
|
||||
// 1 -> if (!isOnlyBindOneDevice) unAssignDeviceDialogTips(device)
|
||||
// else deleteDevice(device)
|
||||
//
|
||||
// 2 -> deleteDevice(device)
|
||||
// }
|
||||
}).apply {
|
||||
if (!isOnlyBindOneDevice) {
|
||||
addItem(getString(R.string.txt_unbind_device))
|
||||
}
|
||||
// if (null == device.pet) {
|
||||
// addItem(
|
||||
// getString(R.string.txt_delete) + " ${device.deviceOutId}"
|
||||
// )
|
||||
// } else {
|
||||
// addItem(getString(R.string.txt_assign_other_tracker))
|
||||
// if (!isOnlyBindOneDevice) {
|
||||
// addItem(
|
||||
// String.format(getString(R.string.txt_unassign_other), device.deviceOutId)
|
||||
// )
|
||||
// }
|
||||
// addItem(
|
||||
// getString(R.string.txt_delete) + " ${device.deviceOutId}"
|
||||
// )
|
||||
// }
|
||||
}.build().show()
|
||||
}
|
||||
|
||||
@@ -432,54 +436,56 @@ class MyTrackerV2Activity :
|
||||
fun showPetBottomSheetMenu(pos: Int) {
|
||||
mCurrentBeanOption = pos
|
||||
val device = mMyTrackerAdapter.getData()[pos]
|
||||
var petName = ""
|
||||
device.pet?.let {
|
||||
petName = it.petName
|
||||
}
|
||||
// var petName = ""
|
||||
// device.pet?.let {
|
||||
// petName = it.petName
|
||||
// }
|
||||
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
||||
dialog.dismiss()
|
||||
when (position) {
|
||||
0 -> {
|
||||
//关联其他宠物
|
||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
getUnAssignPetData()
|
||||
} else {
|
||||
//编辑
|
||||
goEditPet(device)
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
//有绑定对应的设备
|
||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
//只有最后一对设备,只有编辑
|
||||
if (isOnlyBindOneDevice) goEditPet(device)
|
||||
//解绑宠物
|
||||
else unAssignDeviceDialogTips(device)
|
||||
} else {
|
||||
//删除
|
||||
deletePetDialogTips(device)
|
||||
}
|
||||
}
|
||||
//编辑
|
||||
2 -> goEditPet(device)
|
||||
3 -> deletePetDialogTips(device)
|
||||
}
|
||||
}, title = petName).apply {
|
||||
goEditPet(device)
|
||||
// when (position) {
|
||||
// 0 -> {
|
||||
// //关联其他宠物
|
||||
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
// getUnAssignPetData()
|
||||
// } else {
|
||||
// //编辑
|
||||
// goEditPet(device)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// 1 -> {
|
||||
// //有绑定对应的设备
|
||||
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
// //只有最后一对设备,只有编辑
|
||||
// if (isOnlyBindOneDevice) goEditPet(device)
|
||||
// //解绑宠物
|
||||
// else unAssignDeviceDialogTips(device)
|
||||
// } else {
|
||||
// //删除
|
||||
// deletePetDialogTips(device)
|
||||
// }
|
||||
// }
|
||||
// //编辑
|
||||
// 2 -> goEditPet(device)
|
||||
// 3 -> deletePetDialogTips(device)
|
||||
// }
|
||||
}).apply {
|
||||
addItem(getString(R.string.txt_edit_profile))
|
||||
//有绑定对应的设备
|
||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
addItem(getString(R.string.txt_assign_other_pet))
|
||||
if (!isOnlyBindOneDevice) addItem(
|
||||
String.format(getString(R.string.txt_unassign_other), petName)
|
||||
)
|
||||
addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||
if (!isOnlyBindOneDevice) addItem(
|
||||
getString(R.string.txt_delete) + " $petName"
|
||||
)
|
||||
} else {
|
||||
addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||
addItem(getString(R.string.txt_delete) + " $petName")
|
||||
}
|
||||
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||
// addItem(getString(R.string.txt_assign_other_pet))
|
||||
// if (!isOnlyBindOneDevice) addItem(
|
||||
// String.format(getString(R.string.txt_unassign_other), petName)
|
||||
// )
|
||||
// addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||
// if (!isOnlyBindOneDevice) addItem(
|
||||
// getString(R.string.txt_delete) + " $petName"
|
||||
// )
|
||||
// } else {
|
||||
// addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||
// addItem(getString(R.string.txt_delete) + " $petName")
|
||||
// }
|
||||
}.build().show()
|
||||
}
|
||||
|
||||
@@ -513,22 +519,30 @@ class MyTrackerV2Activity :
|
||||
* 删除设备
|
||||
*/
|
||||
private fun deleteDevice(device: DeviceBean) {
|
||||
ViewUtil.instance.showDialog(
|
||||
mContext, getString(R.string.txt_delete_tips), object : BaseDialog.OnDialogOkListener {
|
||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
dialog.dismiss()
|
||||
Intent(mContext, DeleteTracker1Activity::class.java).let {
|
||||
it.putExtra(ConstantString.DeviceInfo, device)
|
||||
val isUnbindLastOne = if (isOnlyBindOneDevice && null == device.pet) {
|
||||
false
|
||||
} else isOnlyBindOneDevice
|
||||
it.putExtra(ConstantString.isCheck, isUnbindLastOne)
|
||||
startActivity(it)
|
||||
}
|
||||
// mTrackerSetViewModel.unbindDevice(this@MyTrackerV2Activity, device.deviceId)
|
||||
}
|
||||
}, okTextResId = R.string.txt_sure
|
||||
)
|
||||
Intent(mContext, DeleteTracker1Activity::class.java).let {
|
||||
it.putExtra(ConstantString.DeviceInfo, device)
|
||||
val isUnbindLastOne = if (isOnlyBindOneDevice && null == device.pet) {
|
||||
false
|
||||
} else isOnlyBindOneDevice
|
||||
it.putExtra(ConstantString.isCheck, isUnbindLastOne)
|
||||
startActivity(it)
|
||||
}
|
||||
// ViewUtil.instance.showDialog(
|
||||
// mContext, getString(R.string.txt_delete_tips), object : BaseDialog.OnDialogOkListener {
|
||||
// override fun onOkClick(dialog: BaseDialog<*>) {
|
||||
// dialog.dismiss()
|
||||
// Intent(mContext, DeleteTracker1Activity::class.java).let {
|
||||
// it.putExtra(ConstantString.DeviceInfo, device)
|
||||
// val isUnbindLastOne = if (isOnlyBindOneDevice && null == device.pet) {
|
||||
// false
|
||||
// } else isOnlyBindOneDevice
|
||||
// it.putExtra(ConstantString.isCheck, isUnbindLastOne)
|
||||
// startActivity(it)
|
||||
// }
|
||||
//// mTrackerSetViewModel.unbindDevice(this@MyTrackerV2Activity, device.deviceId)
|
||||
// }
|
||||
// }, okTextResId = R.string.txt_sure
|
||||
// )
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -799,7 +799,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||
}
|
||||
|
||||
override fun circleScaleClick() {
|
||||
override fun circleScaleEndClick() {
|
||||
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||
}
|
||||
|
||||
@@ -807,6 +807,10 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
mFencesBean.startDrag = true
|
||||
}
|
||||
|
||||
override fun circleScalingClick() {
|
||||
// mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||
}
|
||||
|
||||
override fun circleEndDragClick() {
|
||||
mFencesBean.startDrag = false
|
||||
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||
@@ -878,6 +882,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
||||
override fun calculationDistance(distances: Array<String>) {
|
||||
if (mFencesBean.startDrag) return
|
||||
LogUtil.e("选点计算距离返回${distances.toList()}")
|
||||
if (distances[0].toDouble() <= 0) return
|
||||
when (mFencesBean.fenceShapeType) {
|
||||
ConstantInt.CircleShapeType -> {
|
||||
mFencesBean.radius = Utils.roundOffToInt(distances[0].toDouble())
|
||||
|
||||
@@ -103,15 +103,14 @@ class PreviewFencesZoneActivity :
|
||||
mCurrentFences?.apply {
|
||||
deviceId = mCurrentDeviceId
|
||||
}
|
||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||
ivPreviewFencesRefreshBtn, mShowCenterLocationType
|
||||
)
|
||||
val duration = 2500L
|
||||
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||
// ivPreviewFencesRefreshBtn, mShowCenterLocationType
|
||||
// )
|
||||
val duration = 600L
|
||||
YoYo.with(Techniques.FadeIn).duration(duration).onEnd {
|
||||
ivPreviewFencesMapSwitchBtn.visibility = View.VISIBLE
|
||||
ivPreviewFencesRefreshBtn.visibility = View.VISIBLE
|
||||
// ivPreviewFencesRefreshBtn.visibility = View.VISIBLE
|
||||
}.playOn(rlPreviewFencesInfoLayout)
|
||||
// ViewUtil.instance.viewShowFadeInAnimation(rlPreviewFencesInfoLayout, duration)
|
||||
|
||||
setOnClickListenerViews(
|
||||
btnPreviewFencesEdit,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.abbidot.tracker.ui.activity.device.wifi
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Intent
|
||||
import android.text.TextUtils
|
||||
import android.view.Gravity
|
||||
@@ -70,6 +71,7 @@ class EditWifiPowerZoneActivity :
|
||||
|
||||
override fun getTopBar() = mViewBinding.editPowerZoneTopBar.titleTopBar
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun initData() {
|
||||
super.initData()
|
||||
setTopBarTitle(R.string.txt_edit_power_zone)
|
||||
@@ -91,9 +93,9 @@ class EditWifiPowerZoneActivity :
|
||||
|
||||
mViewBinding.apply {
|
||||
ilWifiNameInputLayout.tvInputNameTitle.text = getString(R.string.txt_zone_name)
|
||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||
ivEditWifiZoneRefreshBtn, mShowCenterLocationType
|
||||
)
|
||||
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||
// ivEditWifiZoneRefreshBtn, mShowCenterLocationType
|
||||
// )
|
||||
setOnClickListenerViews(
|
||||
ivEditWifiZoneRefreshBtn,
|
||||
btnSaveWifiZone,
|
||||
@@ -101,6 +103,10 @@ class EditWifiPowerZoneActivity :
|
||||
btnCancelWifiZone,
|
||||
ilEditPowerZoneBluetoothTips.trbBleConnectState
|
||||
)
|
||||
rvEditWifiZoneType.setOnTouchListener { v, _ ->
|
||||
v?.let { hideInputMethod(it) }
|
||||
false
|
||||
}
|
||||
|
||||
setListData()
|
||||
|
||||
@@ -112,7 +118,7 @@ class EditWifiPowerZoneActivity :
|
||||
add(R.id.fc_edit_power_zone_map_fragment, mFragment)
|
||||
}
|
||||
|
||||
setListenKeyboardChange()
|
||||
setListenKeyboardChange(600)
|
||||
|
||||
if (null != mBleTrackDeviceBean) {
|
||||
ilEditPowerZoneBluetoothTips.trbBleConnectState.let {
|
||||
@@ -205,12 +211,12 @@ class EditWifiPowerZoneActivity :
|
||||
*/
|
||||
private fun mapLoadOk() {
|
||||
mWiFiZoneBean.apply {
|
||||
mEditZoneMapCommon.setShowWifiLocation(latitude, longitude, isEdit)
|
||||
mPetBean?.let {
|
||||
mEditZoneMapCommon.setPetLatLon(
|
||||
it.imgurl, it.petType, mPetCurrentLat, mPetCurrentLon
|
||||
)
|
||||
}
|
||||
mEditZoneMapCommon.setShowWifiLocation(latitude, longitude, false)
|
||||
// mPetBean?.let {
|
||||
// mEditZoneMapCommon.setPetLatLon(
|
||||
// it.imgurl, it.petType, mPetCurrentLat, mPetCurrentLon
|
||||
// )
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,9 +297,11 @@ class EditWifiPowerZoneActivity :
|
||||
mSelectTypeShadeAdapter = SelectFencesTypeCardShadeAdapter(mContext, typeList).apply {
|
||||
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
||||
override fun onItemClick(itemView: View?, pos: Int) {
|
||||
hideInputMethod(mViewBinding.root)
|
||||
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
||||
mSelectTypeShadeAdapter, typeList, pos
|
||||
)
|
||||
if (mWiFiZoneBean.type == pos + 1) return
|
||||
mWiFiZoneBean.type = pos + 1
|
||||
mViewBinding.apply {
|
||||
ilWifiNameInputLayout.let {
|
||||
@@ -450,6 +458,7 @@ class EditWifiPowerZoneActivity :
|
||||
override fun onClick(v: View?) {
|
||||
if (isLimitClick()) return
|
||||
mViewBinding.apply {
|
||||
hideInputMethod(root)
|
||||
when (v!!) {
|
||||
ivEditWifiZoneRefreshBtn -> {
|
||||
mWiFiZoneBean.let {
|
||||
|
||||
@@ -137,7 +137,7 @@ class FencesAddEditMapCommon : BaseMapCommon() {
|
||||
}
|
||||
|
||||
fun calculateDistanceAndGetPointLatLng(
|
||||
activity: BaseActivity<*>? = null, delayMillis: Long = 1000
|
||||
activity: BaseActivity<*>? = null, delayMillis: Long = 600
|
||||
) {
|
||||
activity?.showLoading(true)
|
||||
if (null != mFencesGoogleMapFragment) {
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.abbidot.tracker.databinding.FragmentActivityV2Binding
|
||||
import com.abbidot.tracker.ui.activity.HomeV2Activity
|
||||
import com.abbidot.tracker.ui.activity.data.MoreActivityActivity
|
||||
import com.abbidot.tracker.ui.activity.data.MoreSleepActivity
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.vm.DataViewModel
|
||||
import com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout
|
||||
@@ -59,6 +58,12 @@ class ActivityV2Fragment :
|
||||
svHomeActivityScroll, WindowInsetsCompat.Type.statusBars()
|
||||
)
|
||||
|
||||
ilSportDistanceLayout.apply {
|
||||
ivSportDataType.setImageResource(R.drawable.icon_active_time)
|
||||
tvSportDataTitle.text = getString(R.string.txt_time)
|
||||
tvSportDataUnit.text = getString(R.string.txt_min)
|
||||
}
|
||||
|
||||
ilSportActiveLayout.let {
|
||||
it.root.background =
|
||||
ContextCompat.getDrawable(mContext!!, R.drawable.shape8_gray_yellow_bg)
|
||||
@@ -128,7 +133,7 @@ class ActivityV2Fragment :
|
||||
String.format(getString(R.string.txt_min_unit_lower), "0/$goal")
|
||||
ilSportDistanceLayout.let {
|
||||
it.tvSportDataContent.text = "0"
|
||||
it.tvSportDataUnit.text = Util.getMetricUnits(mContext!!, ConstantInt.Type4)
|
||||
// it.tvSportDataUnit.text = Util.getMetricUnits(mContext!!, ConstantInt.Type4)
|
||||
}
|
||||
ilSportCaloriesLayout.let {
|
||||
it.ivSportDataType.setImageResource(R.drawable.icon_calories)
|
||||
@@ -189,11 +194,15 @@ class ActivityV2Fragment :
|
||||
String.format(getString(R.string.txt_update_time), updateTime)
|
||||
|
||||
homeDataBean.activeTime?.let {
|
||||
|
||||
ViewUtil.instance.viewNumberValueAnimator(
|
||||
ilSportDistanceLayout.tvSportDataContent,
|
||||
0,
|
||||
Util.metricConvertUnits(it.distance.toFloat(), ConstantInt.Type4, 2)
|
||||
ilSportDistanceLayout.tvSportDataContent, 0, it.activeTime / 60
|
||||
)
|
||||
// ViewUtil.instance.viewNumberValueAnimator(
|
||||
// ilSportDistanceLayout.tvSportDataContent,
|
||||
// 0,
|
||||
// Util.metricConvertUnits(it.distance.toFloat(), ConstantInt.Type4, 2)
|
||||
// )
|
||||
ViewUtil.instance.viewNumberValueAnimator(
|
||||
ilSportCaloriesLayout.tvSportDataContent, 0, it.calories
|
||||
)
|
||||
|
||||
@@ -437,12 +437,11 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
llHomeRouteCalendarFrom -> {
|
||||
getHomeV2Activity()?.getPet()?.let {
|
||||
//防止执行多次弹窗
|
||||
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
||||
if (isLimitClick()) {
|
||||
return@apply
|
||||
}
|
||||
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
||||
mRechargeBackType = it.availableOrder
|
||||
mLimitExecutionTime = System.currentTimeMillis()
|
||||
return@apply
|
||||
}
|
||||
}
|
||||
@@ -466,12 +465,11 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
llHomeRouteCalendarTo -> {
|
||||
getHomeV2Activity()?.getPet()?.let {
|
||||
//防止执行多次弹窗
|
||||
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
||||
if (isLimitClick()) {
|
||||
return@apply
|
||||
}
|
||||
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
||||
mRechargeBackType = it.availableOrder
|
||||
mLimitExecutionTime = System.currentTimeMillis()
|
||||
return@apply
|
||||
}
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ class HomeTrackFragment :
|
||||
it.colorRedId = R.color.orange_color3
|
||||
it.menuValue =
|
||||
if (isTimeoutReport || gpsSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1) {
|
||||
getString(R.string.txt_no_signal)
|
||||
getString(R.string.txt_weak_signal)
|
||||
} else if (gpsSignal > ConstantInt.WeakSignal) {
|
||||
it.colorRedId = R.color.blue_color1
|
||||
getString(R.string.txt_strong_signal)
|
||||
|
||||
@@ -2,11 +2,14 @@ package com.abbidot.tracker.ui.fragment.map
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Typeface
|
||||
import android.location.LocationManager
|
||||
import android.provider.Settings
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.commit
|
||||
@@ -87,6 +90,9 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
//地图类型,标准和卫星地图
|
||||
private var mMapType = ConstantInt.Type0
|
||||
|
||||
//是否可用直播
|
||||
private var isCanLive = false
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun newInstance(context: Context) = MapV3Fragment().apply {
|
||||
@@ -174,11 +180,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
mViewBinding.apply {
|
||||
homeMapLiveBtn.isEnabled = true
|
||||
homeMapBluetoothBtn.isEnabled = true
|
||||
}
|
||||
|
||||
val showFence = Util.getShowFenceSp()
|
||||
//检测直播页面有没有修改围栏显示
|
||||
if (isShowFence != showFence) {
|
||||
@@ -467,6 +468,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
//隐藏蓝牙nearby
|
||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
mViewBinding.homeMapLiveBtn.visibility = View.GONE
|
||||
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
|
||||
|
||||
@@ -520,12 +522,42 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLiveBtnState(canLive: Boolean) {
|
||||
mViewBinding.apply {
|
||||
ViewUtil.instance.viewShow(homeMapLiveBtn)
|
||||
val tColor = if (canLive) {
|
||||
homeMapLiveBtn.setBackgroundResource(R.drawable.shape38_green_alpha_circle_bg)
|
||||
R.color.data_black_color
|
||||
} else {
|
||||
homeMapLiveBtn.setBackgroundResource(R.drawable.shape38_gray_alpha_circle_bg)
|
||||
R.color.grey_color
|
||||
}
|
||||
tvHomeMapLiveTitle.setTextColor(ContextCompat.getColor(mContext!!, tColor))
|
||||
|
||||
ivHomeMapLiveImage.let {
|
||||
val bg = if (canLive) {
|
||||
it.imageTintList = ColorStateList.valueOf(0)
|
||||
it.setImageResource(R.drawable.icon_red_dot)
|
||||
R.drawable.icon_black_cir_ring
|
||||
} else {
|
||||
it.imageTintList = ColorStateList.valueOf(
|
||||
ContextCompat.getColor(
|
||||
mContext!!, R.color.grey_color
|
||||
)
|
||||
)
|
||||
R.drawable.icon_gray_cir_ring
|
||||
}
|
||||
it.setBackgroundResource(bg)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
||||
mapDeviceBean.apply {
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
mViewBinding.homeMapLiveBtn.visibility =
|
||||
if (Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1) View.GONE
|
||||
else View.VISIBLE
|
||||
isCanLive =
|
||||
!(Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||
setLiveBtnState(isCanLive)
|
||||
|
||||
mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
||||
mMapViewModel.setMapDeviceBattery(
|
||||
@@ -601,11 +633,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
private fun goLive(isLiveJump: Boolean) {
|
||||
getHomeV2Activity()?.apply {
|
||||
getPet()?.apply {
|
||||
if (isLiveJump) {
|
||||
mViewBinding.homeMapLiveBtn.isEnabled = false
|
||||
} else {
|
||||
mViewBinding.homeMapBluetoothBtn.isEnabled = false
|
||||
}
|
||||
val intent = Intent(mContext, LiveActivityV3::class.java)
|
||||
intent.putExtra(ConstantString.JumpActivity, isLiveJump)
|
||||
intent.putExtra(ConstantString.Pet, this)
|
||||
@@ -621,6 +648,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
if (isLimitClick()) return
|
||||
mViewBinding.apply {
|
||||
when (v!!) {
|
||||
homeMapRefreshBtn -> {
|
||||
@@ -644,6 +672,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
|
||||
homeMapLiveBtn -> {
|
||||
if (!isCanLive) {
|
||||
showToast(R.string.txt_live_works_cellular, gravity = Gravity.CENTER)
|
||||
return
|
||||
}
|
||||
// locationPermissionsTip()
|
||||
goLive(true)
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
if (isCanExecuteCameraCallBack) {
|
||||
//现在围栏控件改成随地图移动,只需要执行一次
|
||||
isCanExecuteCameraCallBack = false
|
||||
mapOkAndDistancePointLatLng()
|
||||
mapOkAndDistancePointLatLng(500)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
mFencesCircleView.postDelayed({
|
||||
isMapZoomReady = true
|
||||
restoreEditFences()
|
||||
}, 1000)
|
||||
}, 500)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -155,11 +155,10 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
/**
|
||||
* 地图准备好计算距离
|
||||
*/
|
||||
fun mapOkAndDistancePointLatLng(delayMillis: Long = 1000) {
|
||||
fun mapOkAndDistancePointLatLng(delayMillis: Long) {
|
||||
if (mFencesBean.startDrag) return
|
||||
if (delayMillis == 0L) {
|
||||
val arrayOfDistance = getLatLngAndCalDistance()
|
||||
if (mFencesBean.startDrag) return
|
||||
mOnActivityCallBack?.calculationDistance(arrayOfDistance)
|
||||
} else {
|
||||
//延时计算距离,防止围栏没画好/地图摄像头移动中
|
||||
@@ -177,11 +176,17 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
|
||||
return when (mFencesBean.fenceShapeType) {
|
||||
ConstantInt.CircleShapeType -> {
|
||||
var centrePointX = 0
|
||||
var startPointX = 0
|
||||
//手机坐标点转换为经纬度
|
||||
val centreLatLng = mFencesCircleView.getCircleCentrePoint()
|
||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
||||
val startLatLng = mFencesCircleView.getCircleLineStartPoint()
|
||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
||||
val centreLatLng = mFencesCircleView.getCircleCentrePoint().let {
|
||||
centrePointX = it.x
|
||||
mGoogleMap!!.projection.fromScreenLocation(it)
|
||||
}
|
||||
val startLatLng = mFencesCircleView.getCircleLineStartPoint().let {
|
||||
startPointX = it.x
|
||||
mGoogleMap!!.projection.fromScreenLocation(it)
|
||||
}
|
||||
val endLatLng = mFencesCircleView.getCircleLineEndPoint()
|
||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
||||
LogUtil.e("GoogleMap,setOnCameraIdleListener 监听回调")
|
||||
@@ -192,6 +197,11 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
endLatLng.latitude,
|
||||
endLatLng.longitude
|
||||
)
|
||||
// if (distance.toInt() < 50) {
|
||||
// LogUtil.e("xxxxxxxxx$distance")
|
||||
// mFencesCircleView.mLimitRadius = abs(centrePointX - startPointX).toFloat()
|
||||
// return arrayOf("50")
|
||||
// }
|
||||
mFencesBean.apply {
|
||||
latitudeCenter = centreLatLng.latitude
|
||||
longitudeCenter = centreLatLng.longitude
|
||||
@@ -202,6 +212,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
}
|
||||
arrayOf(
|
||||
Utils.formatDecimal(distance, 2)
|
||||
// distance.toInt().toString()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -332,7 +343,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
* 还原圆形围栏
|
||||
*/
|
||||
private fun restoreCircleFences() {
|
||||
if (null==mGoogleMap)return
|
||||
if (null == mGoogleMap) return
|
||||
mFencesBean.apply {
|
||||
mFencesCircleView.let {
|
||||
it.visibility = View.VISIBLE
|
||||
@@ -375,7 +386,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
* 还原矩形围栏大小
|
||||
*/
|
||||
private fun restoreRectFences() {
|
||||
if (null==mGoogleMap)return
|
||||
if (null == mGoogleMap) return
|
||||
mFencesBean.apply {
|
||||
mFencesRectView.let {
|
||||
it.visibility = View.VISIBLE
|
||||
@@ -414,7 +425,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
||||
* 还原多边形围栏大小
|
||||
*/
|
||||
private fun restorePolygonFences() {
|
||||
if (null==mGoogleMap)return
|
||||
if (null == mGoogleMap) return
|
||||
mFencesBean.apply {
|
||||
mFencesPolygonView.let {
|
||||
it.visibility = View.VISIBLE
|
||||
|
||||
@@ -315,7 +315,7 @@ class MapViewModel : ViewModel() {
|
||||
val gpsValue =
|
||||
if (isTimeoutReport || it.gpsSignal == ConstantInt.NoSignal || it.powerSwitch == ConstantInt.Type0 || it.powerSwitch == ConstantInt.Type2 || it.inWifiZone == ConstantInt.Type1) {
|
||||
menuType = ConstantInt.Close
|
||||
context.getString(R.string.txt_no_signal)
|
||||
context.getString(R.string.txt_weak_signal)
|
||||
} else if (it.gpsSignal > ConstantInt.WeakSignal) {
|
||||
context.getString(R.string.txt_strong_signal)
|
||||
} else {
|
||||
@@ -449,11 +449,11 @@ class MapViewModel : ViewModel() {
|
||||
)
|
||||
it.text = context.getString(R.string.txt_charging)
|
||||
ViewUtil.instance.viewShow(closeBtn)
|
||||
} else if (batteryLevel <= ConstantInt.LowBattery30) {
|
||||
} else if (batteryLevel <= ConstantInt.LowBattery20) {
|
||||
val lowBattery =
|
||||
if (batteryLevel <= ConstantInt.LowBattery10) ConstantInt.LowBattery10
|
||||
else if (batteryLevel <= ConstantInt.LowBattery20) ConstantInt.LowBattery20
|
||||
else ConstantInt.LowBattery30
|
||||
// else if (batteryLevel <= ConstantInt.LowBattery20) ConstantInt.LowBattery20
|
||||
else ConstantInt.LowBattery20
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
||||
R.drawable.icon_low_battery_image, 0, 0, 0
|
||||
)
|
||||
|
||||
@@ -6,8 +6,9 @@ package com.abbidot.tracker.widget
|
||||
* @description:
|
||||
*/
|
||||
interface OnCircleViewScaleClickListener {
|
||||
fun circleScaleClick()
|
||||
fun circleScaleEndClick()
|
||||
fun circleStartDragClick()
|
||||
fun circleScalingClick()
|
||||
fun circleEndDragClick()
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ class FencesCircleView : View {
|
||||
//最外面的圆半径
|
||||
private var mMaxCircleRadius = 0f
|
||||
|
||||
//限制圆的半径
|
||||
var mLimitRadius = 0f
|
||||
|
||||
//中心坐标点
|
||||
private var mCentreX = 0f
|
||||
private var mCentreY = 0f
|
||||
@@ -243,7 +246,7 @@ class FencesCircleView : View {
|
||||
/**
|
||||
* 设置默认的半径
|
||||
*/
|
||||
fun initDefaultRadius(dp: Int = 68) {
|
||||
fun initDefaultRadius(dp: Int = 100) {
|
||||
if (dp <= 0) return
|
||||
setCircleRadius(dp)
|
||||
}
|
||||
@@ -364,12 +367,15 @@ class FencesCircleView : View {
|
||||
val y = event.y
|
||||
if (isScale) {
|
||||
val transformX = x - mOldX
|
||||
val circleRadius = mMaxCircleRadius + transformX
|
||||
//限制缩放不能太小
|
||||
if (mMaxCircleRadius + transformX < mLocationBitmap!!.height / 2f) {
|
||||
if (mLimitRadius == 0f && circleRadius < mLocationBitmap!!.height / 2f) {
|
||||
// if (circleRadius < mLimitRadius || circleRadius < mLocationBitmap!!.height / 2f) {
|
||||
return true
|
||||
}
|
||||
mMaxCircleRadius += transformX
|
||||
mMaxCircleRadius = circleRadius
|
||||
mOldX = x
|
||||
mScaleClickListener?.circleScalingClick()
|
||||
invalidate()
|
||||
return true
|
||||
} else if (isDrag) {
|
||||
@@ -386,7 +392,7 @@ class FencesCircleView : View {
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if (isScale) {
|
||||
mScaleClickListener?.circleScaleClick()
|
||||
mScaleClickListener?.circleScaleEndClick()
|
||||
isScale = false
|
||||
} else if (isDrag) {
|
||||
mScaleClickListener?.circleEndDragClick()
|
||||
|
||||
11
app/src/main/res/drawable/icon_gray_cir_ring.xml
Normal file
11
app/src/main/res/drawable/icon_gray_cir_ring.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="22dp"
|
||||
android:height="22dp"
|
||||
android:viewportWidth="22"
|
||||
android:viewportHeight="22">
|
||||
<path
|
||||
android:strokeWidth="1"
|
||||
android:pathData="M11,11m-10.5,0a10.5,10.5 0,1 1,21 0a10.5,10.5 0,1 1,-21 0"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="@color/grey_color"/>
|
||||
</vector>
|
||||
15
app/src/main/res/drawable/shape38_gray_alpha_circle_bg.xml
Normal file
15
app/src/main/res/drawable/shape38_gray_alpha_circle_bg.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/white_color1" />
|
||||
<corners android:radius="@dimen/dp_38" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/permission_no_check_color" />
|
||||
<corners android:radius="@dimen/dp_38" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -3,13 +3,13 @@
|
||||
<item android:state_pressed="false">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/yellow_color30" />
|
||||
<corners android:radius="@dimen/dp_38"/>
|
||||
<corners android:radius="@dimen/dp_38" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="true">
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="@color/btn_yellow_color" />
|
||||
<corners android:radius="@dimen/dp_38"/>
|
||||
<corners android:radius="@dimen/dp_38" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="@color/black70" />
|
||||
<solid android:color="@color/main_back" />
|
||||
<corners android:radius="@dimen/dp_40" />
|
||||
</shape>
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
layout="@layout/layout_data_board_item"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/dp_16" />
|
||||
|
||||
<include
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
android:id="@+id/btn_next_delete_tracker1"
|
||||
style="@style/my_RoundRect_Button_style"
|
||||
android:layout_weight="1"
|
||||
android:text="@string/register_txt_next"
|
||||
android:text="@string/txt_delete"
|
||||
app:qmui_radius="@dimen/dp_24"
|
||||
app:typeface="@string/roboto_bold_font" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
@@ -36,14 +36,16 @@
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_36" />
|
||||
android:layout_marginBottom="@dimen/dp_36"
|
||||
android:visibility="gone" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_edit_wifi_zone_map_type_btn"
|
||||
style="@style/map_image_white_btn_style"
|
||||
android:layout_above="@id/iv_edit_wifi_zone_refresh_btn"
|
||||
android:layout_alignEnd="@id/iv_edit_wifi_zone_refresh_btn"
|
||||
android:layout_marginBottom="@dimen/dp_12"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginEnd="@dimen/dp_12"
|
||||
android:layout_marginBottom="@dimen/dp_36"
|
||||
android:background="@drawable/shape_white_circle_bg" />
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@id/ll_more_active_time_calories"
|
||||
android:layout_alignStart="@id/more_active_time_view"
|
||||
android:layout_alignEnd="@id/more_active_time_view"
|
||||
@@ -310,7 +311,7 @@
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:drawableStart="@drawable/icon_active_time"
|
||||
android:drawablePadding="@dimen/dp_6"
|
||||
android:text="@string/txt_total_data"
|
||||
android:text="@string/txt_total_time"
|
||||
android:textSize="@dimen/textSize14"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
|
||||
@@ -351,6 +352,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/shape8_white_gray_bg"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="@dimen/dp_12"
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="@dimen/dp_58"
|
||||
android:background="@drawable/shape_white_alpha_circle_bg"
|
||||
android:background="@drawable/shape38_green_alpha_circle_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="@dimen/dp_36"
|
||||
android:paddingVertical="@dimen/dp_6"
|
||||
|
||||
@@ -86,23 +86,26 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/home_map_refresh_btn"
|
||||
android:background="@drawable/shape_white_alpha_circle_bg"
|
||||
android:background="@drawable/shape38_gray_alpha_circle_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="@dimen/dp_14"
|
||||
android:paddingVertical="@dimen/dp_16"
|
||||
android:visibility="invisible">
|
||||
android:paddingVertical="@dimen/dp_16">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_home_map_live_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/icon_black_cir_ring"
|
||||
android:background="@drawable/icon_gray_cir_ring"
|
||||
android:padding="@dimen/dp_6"
|
||||
android:src="@drawable/icon_red_dot" />
|
||||
android:src="@drawable/icon_red_dot"
|
||||
android:tint="@color/grey_color" />
|
||||
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_home_map_live_title"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="@string/txt_live"
|
||||
android:textColor="@color/grey_color"
|
||||
android:textSize="@dimen/textSize12"
|
||||
android:textStyle="bold" />
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
@@ -138,6 +136,7 @@
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_my_tracker_v2_link_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/rl_my_tracker_v2_device"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_6"
|
||||
@@ -15,6 +15,7 @@
|
||||
<com.abbidot.tracker.widget.TypefaceTextView
|
||||
android:id="@+id/tv_device_battery_info"
|
||||
style="@style/my_TextView_style_v2"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:background="@drawable/shape8_white_bg"
|
||||
android:drawableStart="@drawable/icon_low_battery_image"
|
||||
android:drawablePadding="@dimen/dp_4"
|
||||
@@ -26,9 +27,10 @@
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal|bottom"
|
||||
android:src="@drawable/icon_white_trigon" />
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
android:paddingHorizontal="@dimen/dp_18"
|
||||
android:paddingVertical="@dimen/dp_8"
|
||||
android:text="@string/app_name"
|
||||
android:textColor="@color/white"
|
||||
android:textColor="@color/tab_select"
|
||||
android:textSize="15dp"
|
||||
app:typeface="@string/roboto_regular_font" />
|
||||
@@ -1053,5 +1053,9 @@
|
||||
<string name="txt_powered_off">Powered off</string>
|
||||
<string name="txt_near">Near %s</string>
|
||||
<string name="txt_charging">Charging</string>
|
||||
<string name="txt_total_time">Total Time</string>
|
||||
<string name="txt_live_works_cellular">Live works on cellular only</string>
|
||||
<string name="txt_unbind_device">Unbind Device</string>
|
||||
<string name="txt_edit_profile">Edit Profile</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user