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
|
targetSdkVersion 35
|
||||||
versionCode 2101
|
versionCode 2101
|
||||||
// versionName "2.1.1"
|
// versionName "2.1.1"
|
||||||
versionName "2.1.1-Beta9"
|
versionName "2.1.1-Beta10"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
@@ -102,6 +102,7 @@ android {
|
|||||||
zipAlignEnabled false
|
zipAlignEnabled false
|
||||||
// 设置混淆
|
// 设置混淆
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
signingConfig signingConfigs.debug
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
15
app/proguard-rules.pro
vendored
15
app/proguard-rules.pro
vendored
@@ -18,4 +18,17 @@
|
|||||||
|
|
||||||
# If you keep the line number information, uncomment this to
|
# If you keep the line number information, uncomment this to
|
||||||
# hide the original source file name.
|
# hide the original source file name.
|
||||||
#-renamesourcefileattribute SourceFile
|
#-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 batteryTextView = holder!!.getTextView(R.id.iv_item_my_tracker_v2_battery)
|
||||||
val trackerImageView = holder.getImageView(R.id.iv_item_my_tracker_v2_device)
|
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 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 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 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 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)
|
val petName = holder.getTextView(R.id.tv_my_tracker_v2_pet_name)
|
||||||
|
|
||||||
holder.getImageView(R.id.iv_my_tracker_v2_share).apply {
|
holder.getImageView(R.id.iv_my_tracker_v2_share).apply {
|
||||||
@@ -79,10 +81,14 @@ class MyTrackerV2Adapter(
|
|||||||
trackerName.visibility = View.GONE
|
trackerName.visibility = View.GONE
|
||||||
addTrackerLayout.visibility = View.VISIBLE
|
addTrackerLayout.visibility = View.VISIBLE
|
||||||
|
|
||||||
addPetLayout.visibility = View.VISIBLE
|
petAddLayout.visibility = View.GONE
|
||||||
|
addPetLayout.visibility = View.GONE
|
||||||
|
linkImage.visibility = View.GONE
|
||||||
petHead.visibility = View.GONE
|
petHead.visibility = View.GONE
|
||||||
petName.visibility = View.GONE
|
petName.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
petAddLayout.visibility = View.VISIBLE
|
||||||
|
linkImage.visibility = View.VISIBLE
|
||||||
if (TextUtils.isEmpty(item.deviceOutId)) {
|
if (TextUtils.isEmpty(item.deviceOutId)) {
|
||||||
addTrackerLayout.visibility = View.VISIBLE
|
addTrackerLayout.visibility = View.VISIBLE
|
||||||
batteryTextView.visibility = View.GONE
|
batteryTextView.visibility = View.GONE
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import androidx.viewbinding.ViewBinding
|
|||||||
import com.abbidot.baselibrary.util.LogUtil
|
import com.abbidot.baselibrary.util.LogUtil
|
||||||
import com.abbidot.tracker.R
|
import com.abbidot.tracker.R
|
||||||
import com.abbidot.tracker.constant.GetResultCallback
|
import com.abbidot.tracker.constant.GetResultCallback
|
||||||
|
import com.abbidot.tracker.util.Util
|
||||||
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
import com.qmuiteam.qmui.alpha.QMUIAlphaButton
|
||||||
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
import com.qmuiteam.qmui.alpha.QMUIAlphaImageButton
|
||||||
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
|
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog
|
||||||
@@ -35,7 +36,7 @@ abstract class BaseFragment<T : ViewBinding>(
|
|||||||
var mLoadingDialog: QMUITipDialog? = null
|
var mLoadingDialog: QMUITipDialog? = null
|
||||||
|
|
||||||
//防止某个时间执行多次
|
//防止某个时间执行多次
|
||||||
var mLimitExecutionTime = 0L
|
private var mLimitExecutionTime = 0L
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
* Fragment中嵌套子Fragment时,如果父Fragment被销毁而子Fragment未被销毁,会导致子Fragment的视图不再显示
|
||||||
@@ -151,6 +152,18 @@ abstract class BaseFragment<T : ViewBinding>(
|
|||||||
(activity as BaseActivity<*>).launchActivity(activityResultLauncher, intent)
|
(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 rectEndDragClick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun circleScaleClick() {
|
override fun circleScaleEndClick() {
|
||||||
mFencesMapCommon.refreshDistance()
|
mFencesMapCommon.refreshDistance()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun circleStartDragClick() {
|
override fun circleStartDragClick() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun circleScalingClick() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
override fun circleEndDragClick() {
|
override fun circleEndDragClick() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,10 @@ package com.abbidot.tracker.ui.activity
|
|||||||
import android.bluetooth.BluetoothAdapter
|
import android.bluetooth.BluetoothAdapter
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
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.text.TextUtils
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@@ -66,6 +70,7 @@ import dagger.hilt.android.AndroidEntryPoint
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* v2版主页
|
* v2版主页
|
||||||
*/
|
*/
|
||||||
@@ -139,7 +144,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
}, 1)
|
}, 1)
|
||||||
|
|
||||||
//解决异常 https://blog.csdn.net/w_lin/article/details/123872656
|
//解决异常 https://blog.csdn.net/w_lin/article/details/123872656
|
||||||
it.isSaveEnabled=false
|
it.isSaveEnabled = false
|
||||||
|
|
||||||
edgeToEdgeAdapterBars(it)
|
edgeToEdgeAdapterBars(it)
|
||||||
}
|
}
|
||||||
@@ -163,8 +168,29 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
MMKVUtil.putBoolean(MMKVKey.isCrash, false)
|
MMKVUtil.putBoolean(MMKVKey.isCrash, false)
|
||||||
showToast(R.string.txt_show_crash)
|
showToast(R.string.txt_show_crash)
|
||||||
mCountdownType = ConstantInt.Type0
|
mCountdownType = ConstantInt.Type0
|
||||||
mCountDownTimerViewModel.startCountDown(6)
|
mCountDownTimerViewModel.startCountDown(5)
|
||||||
} else {
|
} 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()
|
mBleListenerReceiver = BluetoothMonitorReceiver()
|
||||||
val intentFilter = IntentFilter()
|
val intentFilter = IntentFilter()
|
||||||
@@ -174,7 +200,7 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
|||||||
|
|
||||||
checkPermissions()
|
checkPermissions()
|
||||||
|
|
||||||
mDataViewModel.getHomeBindPetList(this)
|
mDataViewModel.getHomeBindPetList(this@HomeV2Activity)
|
||||||
|
|
||||||
//设置bugly的用户id
|
//设置bugly的用户id
|
||||||
CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email))
|
CrashReport.setUserId(MMKVUtil.getString(MMKVKey.Email))
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class MoreActivityActivity :
|
|||||||
|
|
||||||
private val mDataDetailViewModel: DataDetailViewModel by viewModels()
|
private val mDataDetailViewModel: DataDetailViewModel by viewModels()
|
||||||
|
|
||||||
private var mCalenderDialog: ShowCalenderDialog? = null
|
// private var mCalenderDialog: ShowCalenderDialog? = null
|
||||||
private lateinit var mMonthsAbbr: Array<String>
|
private lateinit var mMonthsAbbr: Array<String>
|
||||||
|
|
||||||
private var mPetBean: PetBean? = null
|
private var mPetBean: PetBean? = null
|
||||||
|
|||||||
@@ -125,12 +125,14 @@ class AddPairedSuccessActivity :
|
|||||||
override fun onResult(any: Any) {
|
override fun onResult(any: Any) {
|
||||||
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
|
MMKVUtil.putInt(MMKVKey.isBindDevice, ConstantInt.isBind)
|
||||||
XEventBus.post(EventName.RefreshDevice)
|
XEventBus.post(EventName.RefreshDevice)
|
||||||
if (isFirstBind) {
|
|
||||||
mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
||||||
// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
|
// if (isFirstBind) {
|
||||||
// intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
// mUserProfileViewModel.updateMeasureUnit(ConstantInt.Type1)
|
||||||
// startActivityFinish(intent)
|
//// val intent = Intent(mContext, FirstSetPetTypeActivity::class.java)
|
||||||
} else finish()
|
//// intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||||
|
//// startActivityFinish(intent)
|
||||||
|
// } else finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onRequestError(exceptionCode: String?) {
|
override fun onRequestError(exceptionCode: String?) {
|
||||||
@@ -202,11 +204,14 @@ class AddPairedSuccessActivity :
|
|||||||
showToast(R.string.txt_bind_success, isFinish = true)
|
showToast(R.string.txt_bind_success, isFinish = true)
|
||||||
mViewBinding.root.postDelayed({
|
mViewBinding.root.postDelayed({
|
||||||
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.isBind)
|
MMKVUtil.putInt(MMKVKey.isBindPet, ConstantInt.isBind)
|
||||||
mPetBean?.apply {
|
if (isFirstBind) {
|
||||||
val intent = Intent(mContext, AddWifiPowerZone1Activity::class.java)
|
mPetBean?.apply {
|
||||||
intent.putExtra(ConstantString.Pet, this)
|
val intent =
|
||||||
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
Intent(mContext, AddWifiPowerZone1Activity::class.java)
|
||||||
startActivity(intent)
|
intent.putExtra(ConstantString.Pet, this)
|
||||||
|
intent.putExtra(ConstantString.isFirstBind, isFirstBind)
|
||||||
|
startActivity(intent)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1500)
|
}, 1500)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,37 @@
|
|||||||
package com.abbidot.tracker.ui.activity.device
|
package com.abbidot.tracker.ui.activity.device
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.graphics.Typeface
|
||||||
import android.view.View
|
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.R
|
||||||
import com.abbidot.tracker.base.BaseActivity
|
import com.abbidot.tracker.base.BaseActivity
|
||||||
|
import com.abbidot.tracker.base.BaseDialog
|
||||||
import com.abbidot.tracker.bean.DeviceBean
|
import com.abbidot.tracker.bean.DeviceBean
|
||||||
|
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.databinding.ActivityDeleteTracker1Binding
|
import com.abbidot.tracker.databinding.ActivityDeleteTracker1Binding
|
||||||
|
import com.abbidot.tracker.dialog.CommonDialog1
|
||||||
import com.abbidot.tracker.util.Util
|
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 :
|
class DeleteTracker1Activity :
|
||||||
BaseActivity<ActivityDeleteTracker1Binding>(ActivityDeleteTracker1Binding::inflate) {
|
BaseActivity<ActivityDeleteTracker1Binding>(ActivityDeleteTracker1Binding::inflate) {
|
||||||
|
|
||||||
|
private val mTrackerSetViewModel: TrackerSetViewModel by viewModels()
|
||||||
|
|
||||||
private var mDeviceBean: DeviceBean? = null
|
private var mDeviceBean: DeviceBean? = null
|
||||||
private var isOnlyBindOneDevice = false
|
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?) {
|
override fun onClick(v: View?) {
|
||||||
|
if (isLimitClick()) return
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
btnCancelDeleteTracker1 -> finish()
|
btnCancelDeleteTracker1 -> finish()
|
||||||
btnNextDeleteTracker1 -> {
|
btnNextDeleteTracker1 -> {
|
||||||
Intent(mContext, DeleteTracker2Activity::class.java).let {
|
sureDeleteDevice()
|
||||||
it.putExtra(ConstantString.DeviceInfo, mDeviceBean)
|
// Intent(mContext, DeleteTracker2Activity::class.java).let {
|
||||||
it.putExtra(ConstantString.isCheck, isOnlyBindOneDevice)
|
// it.putExtra(ConstantString.DeviceInfo, mDeviceBean)
|
||||||
startActivityFinish(it)
|
// it.putExtra(ConstantString.isCheck, isOnlyBindOneDevice)
|
||||||
}
|
// startActivityFinish(it)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -398,31 +398,35 @@ class MyTrackerV2Activity :
|
|||||||
val device = mMyTrackerAdapter.getData()[pos]
|
val device = mMyTrackerAdapter.getData()[pos]
|
||||||
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
when (position) {
|
deleteDevice(device)
|
||||||
0 -> if (null == device.pet) deleteDevice(device)
|
// when (position) {
|
||||||
else getUnAssignDeviceData()
|
// 0 -> if (null == device.pet) deleteDevice(device)
|
||||||
|
// else getUnAssignDeviceData()
|
||||||
1 -> if (!isOnlyBindOneDevice) unAssignDeviceDialogTips(device)
|
//
|
||||||
else deleteDevice(device)
|
// 1 -> if (!isOnlyBindOneDevice) unAssignDeviceDialogTips(device)
|
||||||
|
// else deleteDevice(device)
|
||||||
2 -> deleteDevice(device)
|
//
|
||||||
}
|
// 2 -> deleteDevice(device)
|
||||||
}, title = device.deviceOutId).apply {
|
// }
|
||||||
if (null == device.pet) {
|
}).apply {
|
||||||
addItem(
|
if (!isOnlyBindOneDevice) {
|
||||||
getString(R.string.txt_delete) + " ${device.deviceOutId}"
|
addItem(getString(R.string.txt_unbind_device))
|
||||||
)
|
|
||||||
} 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}"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
// 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()
|
}.build().show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,54 +436,56 @@ class MyTrackerV2Activity :
|
|||||||
fun showPetBottomSheetMenu(pos: Int) {
|
fun showPetBottomSheetMenu(pos: Int) {
|
||||||
mCurrentBeanOption = pos
|
mCurrentBeanOption = pos
|
||||||
val device = mMyTrackerAdapter.getData()[pos]
|
val device = mMyTrackerAdapter.getData()[pos]
|
||||||
var petName = ""
|
// var petName = ""
|
||||||
device.pet?.let {
|
// device.pet?.let {
|
||||||
petName = it.petName
|
// petName = it.petName
|
||||||
}
|
// }
|
||||||
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
ViewUtil.instance.showBottomSheetList(mContext, { dialog, itemView, position, tag ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
when (position) {
|
goEditPet(device)
|
||||||
0 -> {
|
// when (position) {
|
||||||
//关联其他宠物
|
// 0 -> {
|
||||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
// //关联其他宠物
|
||||||
getUnAssignPetData()
|
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||||
} else {
|
// getUnAssignPetData()
|
||||||
//编辑
|
// } else {
|
||||||
goEditPet(device)
|
// //编辑
|
||||||
}
|
// goEditPet(device)
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
1 -> {
|
//
|
||||||
//有绑定对应的设备
|
// 1 -> {
|
||||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
// //有绑定对应的设备
|
||||||
//只有最后一对设备,只有编辑
|
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||||
if (isOnlyBindOneDevice) goEditPet(device)
|
// //只有最后一对设备,只有编辑
|
||||||
//解绑宠物
|
// if (isOnlyBindOneDevice) goEditPet(device)
|
||||||
else unAssignDeviceDialogTips(device)
|
// //解绑宠物
|
||||||
} else {
|
// else unAssignDeviceDialogTips(device)
|
||||||
//删除
|
// } else {
|
||||||
deletePetDialogTips(device)
|
// //删除
|
||||||
}
|
// deletePetDialogTips(device)
|
||||||
}
|
// }
|
||||||
//编辑
|
// }
|
||||||
2 -> goEditPet(device)
|
// //编辑
|
||||||
3 -> deletePetDialogTips(device)
|
// 2 -> goEditPet(device)
|
||||||
}
|
// 3 -> deletePetDialogTips(device)
|
||||||
}, title = petName).apply {
|
// }
|
||||||
|
}).apply {
|
||||||
|
addItem(getString(R.string.txt_edit_profile))
|
||||||
//有绑定对应的设备
|
//有绑定对应的设备
|
||||||
if (!TextUtils.isEmpty(device.deviceOutId)) {
|
// if (!TextUtils.isEmpty(device.deviceOutId)) {
|
||||||
addItem(getString(R.string.txt_assign_other_pet))
|
// addItem(getString(R.string.txt_assign_other_pet))
|
||||||
if (!isOnlyBindOneDevice) addItem(
|
// if (!isOnlyBindOneDevice) addItem(
|
||||||
String.format(getString(R.string.txt_unassign_other), petName)
|
// String.format(getString(R.string.txt_unassign_other), petName)
|
||||||
)
|
// )
|
||||||
addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
// addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||||
if (!isOnlyBindOneDevice) addItem(
|
// if (!isOnlyBindOneDevice) addItem(
|
||||||
getString(R.string.txt_delete) + " $petName"
|
// getString(R.string.txt_delete) + " $petName"
|
||||||
)
|
// )
|
||||||
} else {
|
// } else {
|
||||||
addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
// addItem(getString(R.string.pet_manage_detail_edit) + " $petName")
|
||||||
addItem(getString(R.string.txt_delete) + " $petName")
|
// addItem(getString(R.string.txt_delete) + " $petName")
|
||||||
}
|
// }
|
||||||
}.build().show()
|
}.build().show()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,22 +519,30 @@ class MyTrackerV2Activity :
|
|||||||
* 删除设备
|
* 删除设备
|
||||||
*/
|
*/
|
||||||
private fun deleteDevice(device: DeviceBean) {
|
private fun deleteDevice(device: DeviceBean) {
|
||||||
ViewUtil.instance.showDialog(
|
Intent(mContext, DeleteTracker1Activity::class.java).let {
|
||||||
mContext, getString(R.string.txt_delete_tips), object : BaseDialog.OnDialogOkListener {
|
it.putExtra(ConstantString.DeviceInfo, device)
|
||||||
override fun onOkClick(dialog: BaseDialog<*>) {
|
val isUnbindLastOne = if (isOnlyBindOneDevice && null == device.pet) {
|
||||||
dialog.dismiss()
|
false
|
||||||
Intent(mContext, DeleteTracker1Activity::class.java).let {
|
} else isOnlyBindOneDevice
|
||||||
it.putExtra(ConstantString.DeviceInfo, device)
|
it.putExtra(ConstantString.isCheck, isUnbindLastOne)
|
||||||
val isUnbindLastOne = if (isOnlyBindOneDevice && null == device.pet) {
|
startActivity(it)
|
||||||
false
|
}
|
||||||
} else isOnlyBindOneDevice
|
// ViewUtil.instance.showDialog(
|
||||||
it.putExtra(ConstantString.isCheck, isUnbindLastOne)
|
// mContext, getString(R.string.txt_delete_tips), object : BaseDialog.OnDialogOkListener {
|
||||||
startActivity(it)
|
// override fun onOkClick(dialog: BaseDialog<*>) {
|
||||||
}
|
// dialog.dismiss()
|
||||||
// mTrackerSetViewModel.unbindDevice(this@MyTrackerV2Activity, device.deviceId)
|
// Intent(mContext, DeleteTracker1Activity::class.java).let {
|
||||||
}
|
// it.putExtra(ConstantString.DeviceInfo, device)
|
||||||
}, okTextResId = R.string.txt_sure
|
// 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)
|
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun circleScaleClick() {
|
override fun circleScaleEndClick() {
|
||||||
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -807,6 +807,10 @@ open class AddAndEditFencesZoneBaseActivity :
|
|||||||
mFencesBean.startDrag = true
|
mFencesBean.startDrag = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun circleScalingClick() {
|
||||||
|
// mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||||
|
}
|
||||||
|
|
||||||
override fun circleEndDragClick() {
|
override fun circleEndDragClick() {
|
||||||
mFencesBean.startDrag = false
|
mFencesBean.startDrag = false
|
||||||
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
mFencesMapCommon.calculateDistanceAndGetPointLatLng(delayMillis = 0)
|
||||||
@@ -878,6 +882,7 @@ open class AddAndEditFencesZoneBaseActivity :
|
|||||||
override fun calculationDistance(distances: Array<String>) {
|
override fun calculationDistance(distances: Array<String>) {
|
||||||
if (mFencesBean.startDrag) return
|
if (mFencesBean.startDrag) return
|
||||||
LogUtil.e("选点计算距离返回${distances.toList()}")
|
LogUtil.e("选点计算距离返回${distances.toList()}")
|
||||||
|
if (distances[0].toDouble() <= 0) return
|
||||||
when (mFencesBean.fenceShapeType) {
|
when (mFencesBean.fenceShapeType) {
|
||||||
ConstantInt.CircleShapeType -> {
|
ConstantInt.CircleShapeType -> {
|
||||||
mFencesBean.radius = Utils.roundOffToInt(distances[0].toDouble())
|
mFencesBean.radius = Utils.roundOffToInt(distances[0].toDouble())
|
||||||
|
|||||||
@@ -103,15 +103,14 @@ class PreviewFencesZoneActivity :
|
|||||||
mCurrentFences?.apply {
|
mCurrentFences?.apply {
|
||||||
deviceId = mCurrentDeviceId
|
deviceId = mCurrentDeviceId
|
||||||
}
|
}
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
ivPreviewFencesRefreshBtn, mShowCenterLocationType
|
// ivPreviewFencesRefreshBtn, mShowCenterLocationType
|
||||||
)
|
// )
|
||||||
val duration = 2500L
|
val duration = 600L
|
||||||
YoYo.with(Techniques.FadeIn).duration(duration).onEnd {
|
YoYo.with(Techniques.FadeIn).duration(duration).onEnd {
|
||||||
ivPreviewFencesMapSwitchBtn.visibility = View.VISIBLE
|
ivPreviewFencesMapSwitchBtn.visibility = View.VISIBLE
|
||||||
ivPreviewFencesRefreshBtn.visibility = View.VISIBLE
|
// ivPreviewFencesRefreshBtn.visibility = View.VISIBLE
|
||||||
}.playOn(rlPreviewFencesInfoLayout)
|
}.playOn(rlPreviewFencesInfoLayout)
|
||||||
// ViewUtil.instance.viewShowFadeInAnimation(rlPreviewFencesInfoLayout, duration)
|
|
||||||
|
|
||||||
setOnClickListenerViews(
|
setOnClickListenerViews(
|
||||||
btnPreviewFencesEdit,
|
btnPreviewFencesEdit,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.abbidot.tracker.ui.activity.device.wifi
|
package com.abbidot.tracker.ui.activity.device.wifi
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
@@ -70,6 +71,7 @@ class EditWifiPowerZoneActivity :
|
|||||||
|
|
||||||
override fun getTopBar() = mViewBinding.editPowerZoneTopBar.titleTopBar
|
override fun getTopBar() = mViewBinding.editPowerZoneTopBar.titleTopBar
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
override fun initData() {
|
override fun initData() {
|
||||||
super.initData()
|
super.initData()
|
||||||
setTopBarTitle(R.string.txt_edit_power_zone)
|
setTopBarTitle(R.string.txt_edit_power_zone)
|
||||||
@@ -91,9 +93,9 @@ class EditWifiPowerZoneActivity :
|
|||||||
|
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
ilWifiNameInputLayout.tvInputNameTitle.text = getString(R.string.txt_zone_name)
|
ilWifiNameInputLayout.tvInputNameTitle.text = getString(R.string.txt_zone_name)
|
||||||
ViewUtil.instance.setMapSwitchLocationButtonImage(
|
// ViewUtil.instance.setMapSwitchLocationButtonImage(
|
||||||
ivEditWifiZoneRefreshBtn, mShowCenterLocationType
|
// ivEditWifiZoneRefreshBtn, mShowCenterLocationType
|
||||||
)
|
// )
|
||||||
setOnClickListenerViews(
|
setOnClickListenerViews(
|
||||||
ivEditWifiZoneRefreshBtn,
|
ivEditWifiZoneRefreshBtn,
|
||||||
btnSaveWifiZone,
|
btnSaveWifiZone,
|
||||||
@@ -101,6 +103,10 @@ class EditWifiPowerZoneActivity :
|
|||||||
btnCancelWifiZone,
|
btnCancelWifiZone,
|
||||||
ilEditPowerZoneBluetoothTips.trbBleConnectState
|
ilEditPowerZoneBluetoothTips.trbBleConnectState
|
||||||
)
|
)
|
||||||
|
rvEditWifiZoneType.setOnTouchListener { v, _ ->
|
||||||
|
v?.let { hideInputMethod(it) }
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
setListData()
|
setListData()
|
||||||
|
|
||||||
@@ -112,7 +118,7 @@ class EditWifiPowerZoneActivity :
|
|||||||
add(R.id.fc_edit_power_zone_map_fragment, mFragment)
|
add(R.id.fc_edit_power_zone_map_fragment, mFragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
setListenKeyboardChange()
|
setListenKeyboardChange(600)
|
||||||
|
|
||||||
if (null != mBleTrackDeviceBean) {
|
if (null != mBleTrackDeviceBean) {
|
||||||
ilEditPowerZoneBluetoothTips.trbBleConnectState.let {
|
ilEditPowerZoneBluetoothTips.trbBleConnectState.let {
|
||||||
@@ -205,12 +211,12 @@ class EditWifiPowerZoneActivity :
|
|||||||
*/
|
*/
|
||||||
private fun mapLoadOk() {
|
private fun mapLoadOk() {
|
||||||
mWiFiZoneBean.apply {
|
mWiFiZoneBean.apply {
|
||||||
mEditZoneMapCommon.setShowWifiLocation(latitude, longitude, isEdit)
|
mEditZoneMapCommon.setShowWifiLocation(latitude, longitude, false)
|
||||||
mPetBean?.let {
|
// mPetBean?.let {
|
||||||
mEditZoneMapCommon.setPetLatLon(
|
// mEditZoneMapCommon.setPetLatLon(
|
||||||
it.imgurl, it.petType, mPetCurrentLat, mPetCurrentLon
|
// it.imgurl, it.petType, mPetCurrentLat, mPetCurrentLon
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,9 +297,11 @@ class EditWifiPowerZoneActivity :
|
|||||||
mSelectTypeShadeAdapter = SelectFencesTypeCardShadeAdapter(mContext, typeList).apply {
|
mSelectTypeShadeAdapter = SelectFencesTypeCardShadeAdapter(mContext, typeList).apply {
|
||||||
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
setOnItemClickListener(object : BaseRecyclerAdapter.OnItemClickListener {
|
||||||
override fun onItemClick(itemView: View?, pos: Int) {
|
override fun onItemClick(itemView: View?, pos: Int) {
|
||||||
|
hideInputMethod(mViewBinding.root)
|
||||||
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
ViewUtil.instance.updateDataBeanOnlySelectedItem(
|
||||||
mSelectTypeShadeAdapter, typeList, pos
|
mSelectTypeShadeAdapter, typeList, pos
|
||||||
)
|
)
|
||||||
|
if (mWiFiZoneBean.type == pos + 1) return
|
||||||
mWiFiZoneBean.type = pos + 1
|
mWiFiZoneBean.type = pos + 1
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
ilWifiNameInputLayout.let {
|
ilWifiNameInputLayout.let {
|
||||||
@@ -450,6 +458,7 @@ class EditWifiPowerZoneActivity :
|
|||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
if (isLimitClick()) return
|
if (isLimitClick()) return
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
|
hideInputMethod(root)
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
ivEditWifiZoneRefreshBtn -> {
|
ivEditWifiZoneRefreshBtn -> {
|
||||||
mWiFiZoneBean.let {
|
mWiFiZoneBean.let {
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ class FencesAddEditMapCommon : BaseMapCommon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun calculateDistanceAndGetPointLatLng(
|
fun calculateDistanceAndGetPointLatLng(
|
||||||
activity: BaseActivity<*>? = null, delayMillis: Long = 1000
|
activity: BaseActivity<*>? = null, delayMillis: Long = 600
|
||||||
) {
|
) {
|
||||||
activity?.showLoading(true)
|
activity?.showLoading(true)
|
||||||
if (null != mFencesGoogleMapFragment) {
|
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.HomeV2Activity
|
||||||
import com.abbidot.tracker.ui.activity.data.MoreActivityActivity
|
import com.abbidot.tracker.ui.activity.data.MoreActivityActivity
|
||||||
import com.abbidot.tracker.ui.activity.data.MoreSleepActivity
|
import com.abbidot.tracker.ui.activity.data.MoreSleepActivity
|
||||||
import com.abbidot.tracker.util.Util
|
|
||||||
import com.abbidot.tracker.util.ViewUtil
|
import com.abbidot.tracker.util.ViewUtil
|
||||||
import com.abbidot.tracker.vm.DataViewModel
|
import com.abbidot.tracker.vm.DataViewModel
|
||||||
import com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout
|
import com.qmuiteam.qmui.widget.pullRefreshLayout.QMUIPullRefreshLayout
|
||||||
@@ -59,6 +58,12 @@ class ActivityV2Fragment :
|
|||||||
svHomeActivityScroll, WindowInsetsCompat.Type.statusBars()
|
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 {
|
ilSportActiveLayout.let {
|
||||||
it.root.background =
|
it.root.background =
|
||||||
ContextCompat.getDrawable(mContext!!, R.drawable.shape8_gray_yellow_bg)
|
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")
|
String.format(getString(R.string.txt_min_unit_lower), "0/$goal")
|
||||||
ilSportDistanceLayout.let {
|
ilSportDistanceLayout.let {
|
||||||
it.tvSportDataContent.text = "0"
|
it.tvSportDataContent.text = "0"
|
||||||
it.tvSportDataUnit.text = Util.getMetricUnits(mContext!!, ConstantInt.Type4)
|
// it.tvSportDataUnit.text = Util.getMetricUnits(mContext!!, ConstantInt.Type4)
|
||||||
}
|
}
|
||||||
ilSportCaloriesLayout.let {
|
ilSportCaloriesLayout.let {
|
||||||
it.ivSportDataType.setImageResource(R.drawable.icon_calories)
|
it.ivSportDataType.setImageResource(R.drawable.icon_calories)
|
||||||
@@ -189,11 +194,15 @@ class ActivityV2Fragment :
|
|||||||
String.format(getString(R.string.txt_update_time), updateTime)
|
String.format(getString(R.string.txt_update_time), updateTime)
|
||||||
|
|
||||||
homeDataBean.activeTime?.let {
|
homeDataBean.activeTime?.let {
|
||||||
|
|
||||||
ViewUtil.instance.viewNumberValueAnimator(
|
ViewUtil.instance.viewNumberValueAnimator(
|
||||||
ilSportDistanceLayout.tvSportDataContent,
|
ilSportDistanceLayout.tvSportDataContent, 0, it.activeTime / 60
|
||||||
0,
|
|
||||||
Util.metricConvertUnits(it.distance.toFloat(), ConstantInt.Type4, 2)
|
|
||||||
)
|
)
|
||||||
|
// ViewUtil.instance.viewNumberValueAnimator(
|
||||||
|
// ilSportDistanceLayout.tvSportDataContent,
|
||||||
|
// 0,
|
||||||
|
// Util.metricConvertUnits(it.distance.toFloat(), ConstantInt.Type4, 2)
|
||||||
|
// )
|
||||||
ViewUtil.instance.viewNumberValueAnimator(
|
ViewUtil.instance.viewNumberValueAnimator(
|
||||||
ilSportCaloriesLayout.tvSportDataContent, 0, it.calories
|
ilSportCaloriesLayout.tvSportDataContent, 0, it.calories
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -437,12 +437,11 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
llHomeRouteCalendarFrom -> {
|
llHomeRouteCalendarFrom -> {
|
||||||
getHomeV2Activity()?.getPet()?.let {
|
getHomeV2Activity()?.getPet()?.let {
|
||||||
//防止执行多次弹窗
|
//防止执行多次弹窗
|
||||||
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
if (isLimitClick()) {
|
||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
||||||
mRechargeBackType = it.availableOrder
|
mRechargeBackType = it.availableOrder
|
||||||
mLimitExecutionTime = System.currentTimeMillis()
|
|
||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -466,12 +465,11 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
|||||||
llHomeRouteCalendarTo -> {
|
llHomeRouteCalendarTo -> {
|
||||||
getHomeV2Activity()?.getPet()?.let {
|
getHomeV2Activity()?.getPet()?.let {
|
||||||
//防止执行多次弹窗
|
//防止执行多次弹窗
|
||||||
if (Util.isTimeLimit(mLimitExecutionTime)) {
|
if (isLimitClick()) {
|
||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
if (Util.checkPackageLimit(getHomeV2Activity()!!, it.deviceId)) {
|
||||||
mRechargeBackType = it.availableOrder
|
mRechargeBackType = it.availableOrder
|
||||||
mLimitExecutionTime = System.currentTimeMillis()
|
|
||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ class HomeTrackFragment :
|
|||||||
it.colorRedId = R.color.orange_color3
|
it.colorRedId = R.color.orange_color3
|
||||||
it.menuValue =
|
it.menuValue =
|
||||||
if (isTimeoutReport || gpsSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1) {
|
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) {
|
} else if (gpsSignal > ConstantInt.WeakSignal) {
|
||||||
it.colorRedId = R.color.blue_color1
|
it.colorRedId = R.color.blue_color1
|
||||||
getString(R.string.txt_strong_signal)
|
getString(R.string.txt_strong_signal)
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ package com.abbidot.tracker.ui.fragment.map
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.res.ColorStateList
|
||||||
import android.graphics.Typeface
|
import android.graphics.Typeface
|
||||||
import android.location.LocationManager
|
import android.location.LocationManager
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.core.view.WindowInsetsCompat
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.fragment.app.commit
|
import androidx.fragment.app.commit
|
||||||
@@ -87,6 +90,9 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
//地图类型,标准和卫星地图
|
//地图类型,标准和卫星地图
|
||||||
private var mMapType = ConstantInt.Type0
|
private var mMapType = ConstantInt.Type0
|
||||||
|
|
||||||
|
//是否可用直播
|
||||||
|
private var isCanLive = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(context: Context) = MapV3Fragment().apply {
|
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()
|
val showFence = Util.getShowFenceSp()
|
||||||
//检测直播页面有没有修改围栏显示
|
//检测直播页面有没有修改围栏显示
|
||||||
if (isShowFence != showFence) {
|
if (isShowFence != showFence) {
|
||||||
@@ -467,6 +468,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
|
|
||||||
//隐藏蓝牙nearby
|
//隐藏蓝牙nearby
|
||||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||||
|
mViewBinding.homeMapLiveBtn.visibility = View.GONE
|
||||||
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||||
mViewBinding.ilHomeMapPetLocation.root.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) {
|
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
||||||
mapDeviceBean.apply {
|
mapDeviceBean.apply {
|
||||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||||
mViewBinding.homeMapLiveBtn.visibility =
|
isCanLive =
|
||||||
if (Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1) View.GONE
|
!(Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||||
else View.VISIBLE
|
setLiveBtnState(isCanLive)
|
||||||
|
|
||||||
mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
||||||
mMapViewModel.setMapDeviceBattery(
|
mMapViewModel.setMapDeviceBattery(
|
||||||
@@ -601,11 +633,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
private fun goLive(isLiveJump: Boolean) {
|
private fun goLive(isLiveJump: Boolean) {
|
||||||
getHomeV2Activity()?.apply {
|
getHomeV2Activity()?.apply {
|
||||||
getPet()?.apply {
|
getPet()?.apply {
|
||||||
if (isLiveJump) {
|
|
||||||
mViewBinding.homeMapLiveBtn.isEnabled = false
|
|
||||||
} else {
|
|
||||||
mViewBinding.homeMapBluetoothBtn.isEnabled = false
|
|
||||||
}
|
|
||||||
val intent = Intent(mContext, LiveActivityV3::class.java)
|
val intent = Intent(mContext, LiveActivityV3::class.java)
|
||||||
intent.putExtra(ConstantString.JumpActivity, isLiveJump)
|
intent.putExtra(ConstantString.JumpActivity, isLiveJump)
|
||||||
intent.putExtra(ConstantString.Pet, this)
|
intent.putExtra(ConstantString.Pet, this)
|
||||||
@@ -621,6 +648,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
|
if (isLimitClick()) return
|
||||||
mViewBinding.apply {
|
mViewBinding.apply {
|
||||||
when (v!!) {
|
when (v!!) {
|
||||||
homeMapRefreshBtn -> {
|
homeMapRefreshBtn -> {
|
||||||
@@ -644,6 +672,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
|||||||
}
|
}
|
||||||
|
|
||||||
homeMapLiveBtn -> {
|
homeMapLiveBtn -> {
|
||||||
|
if (!isCanLive) {
|
||||||
|
showToast(R.string.txt_live_works_cellular, gravity = Gravity.CENTER)
|
||||||
|
return
|
||||||
|
}
|
||||||
// locationPermissionsTip()
|
// locationPermissionsTip()
|
||||||
goLive(true)
|
goLive(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
if (isCanExecuteCameraCallBack) {
|
if (isCanExecuteCameraCallBack) {
|
||||||
//现在围栏控件改成随地图移动,只需要执行一次
|
//现在围栏控件改成随地图移动,只需要执行一次
|
||||||
isCanExecuteCameraCallBack = false
|
isCanExecuteCameraCallBack = false
|
||||||
mapOkAndDistancePointLatLng()
|
mapOkAndDistancePointLatLng(500)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
mFencesCircleView.postDelayed({
|
mFencesCircleView.postDelayed({
|
||||||
isMapZoomReady = true
|
isMapZoomReady = true
|
||||||
restoreEditFences()
|
restoreEditFences()
|
||||||
}, 1000)
|
}, 500)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -155,11 +155,10 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
/**
|
/**
|
||||||
* 地图准备好计算距离
|
* 地图准备好计算距离
|
||||||
*/
|
*/
|
||||||
fun mapOkAndDistancePointLatLng(delayMillis: Long = 1000) {
|
fun mapOkAndDistancePointLatLng(delayMillis: Long) {
|
||||||
if (mFencesBean.startDrag) return
|
if (mFencesBean.startDrag) return
|
||||||
if (delayMillis == 0L) {
|
if (delayMillis == 0L) {
|
||||||
val arrayOfDistance = getLatLngAndCalDistance()
|
val arrayOfDistance = getLatLngAndCalDistance()
|
||||||
if (mFencesBean.startDrag) return
|
|
||||||
mOnActivityCallBack?.calculationDistance(arrayOfDistance)
|
mOnActivityCallBack?.calculationDistance(arrayOfDistance)
|
||||||
} else {
|
} else {
|
||||||
//延时计算距离,防止围栏没画好/地图摄像头移动中
|
//延时计算距离,防止围栏没画好/地图摄像头移动中
|
||||||
@@ -177,11 +176,17 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
|
|
||||||
return when (mFencesBean.fenceShapeType) {
|
return when (mFencesBean.fenceShapeType) {
|
||||||
ConstantInt.CircleShapeType -> {
|
ConstantInt.CircleShapeType -> {
|
||||||
|
var centrePointX = 0
|
||||||
|
var startPointX = 0
|
||||||
//手机坐标点转换为经纬度
|
//手机坐标点转换为经纬度
|
||||||
val centreLatLng = mFencesCircleView.getCircleCentrePoint()
|
val centreLatLng = mFencesCircleView.getCircleCentrePoint().let {
|
||||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
centrePointX = it.x
|
||||||
val startLatLng = mFencesCircleView.getCircleLineStartPoint()
|
mGoogleMap!!.projection.fromScreenLocation(it)
|
||||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
}
|
||||||
|
val startLatLng = mFencesCircleView.getCircleLineStartPoint().let {
|
||||||
|
startPointX = it.x
|
||||||
|
mGoogleMap!!.projection.fromScreenLocation(it)
|
||||||
|
}
|
||||||
val endLatLng = mFencesCircleView.getCircleLineEndPoint()
|
val endLatLng = mFencesCircleView.getCircleLineEndPoint()
|
||||||
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
.let { mGoogleMap!!.projection.fromScreenLocation(it) }
|
||||||
LogUtil.e("GoogleMap,setOnCameraIdleListener 监听回调")
|
LogUtil.e("GoogleMap,setOnCameraIdleListener 监听回调")
|
||||||
@@ -192,6 +197,11 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
endLatLng.latitude,
|
endLatLng.latitude,
|
||||||
endLatLng.longitude
|
endLatLng.longitude
|
||||||
)
|
)
|
||||||
|
// if (distance.toInt() < 50) {
|
||||||
|
// LogUtil.e("xxxxxxxxx$distance")
|
||||||
|
// mFencesCircleView.mLimitRadius = abs(centrePointX - startPointX).toFloat()
|
||||||
|
// return arrayOf("50")
|
||||||
|
// }
|
||||||
mFencesBean.apply {
|
mFencesBean.apply {
|
||||||
latitudeCenter = centreLatLng.latitude
|
latitudeCenter = centreLatLng.latitude
|
||||||
longitudeCenter = centreLatLng.longitude
|
longitudeCenter = centreLatLng.longitude
|
||||||
@@ -202,6 +212,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
}
|
}
|
||||||
arrayOf(
|
arrayOf(
|
||||||
Utils.formatDecimal(distance, 2)
|
Utils.formatDecimal(distance, 2)
|
||||||
|
// distance.toInt().toString()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -332,7 +343,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
* 还原圆形围栏
|
* 还原圆形围栏
|
||||||
*/
|
*/
|
||||||
private fun restoreCircleFences() {
|
private fun restoreCircleFences() {
|
||||||
if (null==mGoogleMap)return
|
if (null == mGoogleMap) return
|
||||||
mFencesBean.apply {
|
mFencesBean.apply {
|
||||||
mFencesCircleView.let {
|
mFencesCircleView.let {
|
||||||
it.visibility = View.VISIBLE
|
it.visibility = View.VISIBLE
|
||||||
@@ -375,7 +386,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
* 还原矩形围栏大小
|
* 还原矩形围栏大小
|
||||||
*/
|
*/
|
||||||
private fun restoreRectFences() {
|
private fun restoreRectFences() {
|
||||||
if (null==mGoogleMap)return
|
if (null == mGoogleMap) return
|
||||||
mFencesBean.apply {
|
mFencesBean.apply {
|
||||||
mFencesRectView.let {
|
mFencesRectView.let {
|
||||||
it.visibility = View.VISIBLE
|
it.visibility = View.VISIBLE
|
||||||
@@ -414,7 +425,7 @@ class FencesAddEditGoogleMapFragment : BaseGoogleMapFragment() {
|
|||||||
* 还原多边形围栏大小
|
* 还原多边形围栏大小
|
||||||
*/
|
*/
|
||||||
private fun restorePolygonFences() {
|
private fun restorePolygonFences() {
|
||||||
if (null==mGoogleMap)return
|
if (null == mGoogleMap) return
|
||||||
mFencesBean.apply {
|
mFencesBean.apply {
|
||||||
mFencesPolygonView.let {
|
mFencesPolygonView.let {
|
||||||
it.visibility = View.VISIBLE
|
it.visibility = View.VISIBLE
|
||||||
|
|||||||
@@ -315,7 +315,7 @@ class MapViewModel : ViewModel() {
|
|||||||
val gpsValue =
|
val gpsValue =
|
||||||
if (isTimeoutReport || it.gpsSignal == ConstantInt.NoSignal || it.powerSwitch == ConstantInt.Type0 || it.powerSwitch == ConstantInt.Type2 || it.inWifiZone == ConstantInt.Type1) {
|
if (isTimeoutReport || it.gpsSignal == ConstantInt.NoSignal || it.powerSwitch == ConstantInt.Type0 || it.powerSwitch == ConstantInt.Type2 || it.inWifiZone == ConstantInt.Type1) {
|
||||||
menuType = ConstantInt.Close
|
menuType = ConstantInt.Close
|
||||||
context.getString(R.string.txt_no_signal)
|
context.getString(R.string.txt_weak_signal)
|
||||||
} else if (it.gpsSignal > ConstantInt.WeakSignal) {
|
} else if (it.gpsSignal > ConstantInt.WeakSignal) {
|
||||||
context.getString(R.string.txt_strong_signal)
|
context.getString(R.string.txt_strong_signal)
|
||||||
} else {
|
} else {
|
||||||
@@ -449,11 +449,11 @@ class MapViewModel : ViewModel() {
|
|||||||
)
|
)
|
||||||
it.text = context.getString(R.string.txt_charging)
|
it.text = context.getString(R.string.txt_charging)
|
||||||
ViewUtil.instance.viewShow(closeBtn)
|
ViewUtil.instance.viewShow(closeBtn)
|
||||||
} else if (batteryLevel <= ConstantInt.LowBattery30) {
|
} else if (batteryLevel <= ConstantInt.LowBattery20) {
|
||||||
val lowBattery =
|
val lowBattery =
|
||||||
if (batteryLevel <= ConstantInt.LowBattery10) ConstantInt.LowBattery10
|
if (batteryLevel <= ConstantInt.LowBattery10) ConstantInt.LowBattery10
|
||||||
else if (batteryLevel <= ConstantInt.LowBattery20) ConstantInt.LowBattery20
|
// else if (batteryLevel <= ConstantInt.LowBattery20) ConstantInt.LowBattery20
|
||||||
else ConstantInt.LowBattery30
|
else ConstantInt.LowBattery20
|
||||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
it.setCompoundDrawablesWithIntrinsicBounds(
|
||||||
R.drawable.icon_low_battery_image, 0, 0, 0
|
R.drawable.icon_low_battery_image, 0, 0, 0
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ package com.abbidot.tracker.widget
|
|||||||
* @description:
|
* @description:
|
||||||
*/
|
*/
|
||||||
interface OnCircleViewScaleClickListener {
|
interface OnCircleViewScaleClickListener {
|
||||||
fun circleScaleClick()
|
fun circleScaleEndClick()
|
||||||
fun circleStartDragClick()
|
fun circleStartDragClick()
|
||||||
|
fun circleScalingClick()
|
||||||
fun circleEndDragClick()
|
fun circleEndDragClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ class FencesCircleView : View {
|
|||||||
//最外面的圆半径
|
//最外面的圆半径
|
||||||
private var mMaxCircleRadius = 0f
|
private var mMaxCircleRadius = 0f
|
||||||
|
|
||||||
|
//限制圆的半径
|
||||||
|
var mLimitRadius = 0f
|
||||||
|
|
||||||
//中心坐标点
|
//中心坐标点
|
||||||
private var mCentreX = 0f
|
private var mCentreX = 0f
|
||||||
private var mCentreY = 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
|
if (dp <= 0) return
|
||||||
setCircleRadius(dp)
|
setCircleRadius(dp)
|
||||||
}
|
}
|
||||||
@@ -364,12 +367,15 @@ class FencesCircleView : View {
|
|||||||
val y = event.y
|
val y = event.y
|
||||||
if (isScale) {
|
if (isScale) {
|
||||||
val transformX = x - mOldX
|
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
|
return true
|
||||||
}
|
}
|
||||||
mMaxCircleRadius += transformX
|
mMaxCircleRadius = circleRadius
|
||||||
mOldX = x
|
mOldX = x
|
||||||
|
mScaleClickListener?.circleScalingClick()
|
||||||
invalidate()
|
invalidate()
|
||||||
return true
|
return true
|
||||||
} else if (isDrag) {
|
} else if (isDrag) {
|
||||||
@@ -386,7 +392,7 @@ class FencesCircleView : View {
|
|||||||
|
|
||||||
MotionEvent.ACTION_UP -> {
|
MotionEvent.ACTION_UP -> {
|
||||||
if (isScale) {
|
if (isScale) {
|
||||||
mScaleClickListener?.circleScaleClick()
|
mScaleClickListener?.circleScaleEndClick()
|
||||||
isScale = false
|
isScale = false
|
||||||
} else if (isDrag) {
|
} else if (isDrag) {
|
||||||
mScaleClickListener?.circleEndDragClick()
|
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">
|
<item android:state_pressed="false">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/yellow_color30" />
|
<solid android:color="@color/yellow_color30" />
|
||||||
<corners android:radius="@dimen/dp_38"/>
|
<corners android:radius="@dimen/dp_38" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
<item android:state_pressed="true">
|
<item android:state_pressed="true">
|
||||||
<shape android:shape="rectangle">
|
<shape android:shape="rectangle">
|
||||||
<solid android:color="@color/btn_yellow_color" />
|
<solid android:color="@color/btn_yellow_color" />
|
||||||
<corners android:radius="@dimen/dp_38"/>
|
<corners android:radius="@dimen/dp_38" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</selector>
|
</selector>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:shape="rectangle">
|
android:shape="rectangle">
|
||||||
<solid android:color="@color/black70" />
|
<solid android:color="@color/main_back" />
|
||||||
<corners android:radius="@dimen/dp_40" />
|
<corners android:radius="@dimen/dp_40" />
|
||||||
</shape>
|
</shape>
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
layout="@layout/layout_data_board_item"
|
layout="@layout/layout_data_board_item"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginTop="@dimen/dp_16" />
|
android:layout_marginTop="@dimen/dp_16" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
|
|||||||
@@ -123,7 +123,7 @@
|
|||||||
android:id="@+id/btn_next_delete_tracker1"
|
android:id="@+id/btn_next_delete_tracker1"
|
||||||
style="@style/my_RoundRect_Button_style"
|
style="@style/my_RoundRect_Button_style"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:text="@string/register_txt_next"
|
android:text="@string/txt_delete"
|
||||||
app:qmui_radius="@dimen/dp_24"
|
app:qmui_radius="@dimen/dp_24"
|
||||||
app:typeface="@string/roboto_bold_font" />
|
app:typeface="@string/roboto_bold_font" />
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|||||||
@@ -36,14 +36,16 @@
|
|||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginEnd="@dimen/dp_12"
|
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
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/iv_edit_wifi_zone_map_type_btn"
|
android:id="@+id/iv_edit_wifi_zone_map_type_btn"
|
||||||
style="@style/map_image_white_btn_style"
|
style="@style/map_image_white_btn_style"
|
||||||
android:layout_above="@id/iv_edit_wifi_zone_refresh_btn"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignEnd="@id/iv_edit_wifi_zone_refresh_btn"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_marginBottom="@dimen/dp_12"
|
android:layout_marginEnd="@dimen/dp_12"
|
||||||
|
android:layout_marginBottom="@dimen/dp_36"
|
||||||
android:background="@drawable/shape_white_circle_bg" />
|
android:background="@drawable/shape_white_circle_bg" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,7 @@
|
|||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_below="@id/ll_more_active_time_calories"
|
android:layout_below="@id/ll_more_active_time_calories"
|
||||||
android:layout_alignStart="@id/more_active_time_view"
|
android:layout_alignStart="@id/more_active_time_view"
|
||||||
android:layout_alignEnd="@id/more_active_time_view"
|
android:layout_alignEnd="@id/more_active_time_view"
|
||||||
@@ -310,7 +311,7 @@
|
|||||||
style="@style/my_TextView_style_v2"
|
style="@style/my_TextView_style_v2"
|
||||||
android:drawableStart="@drawable/icon_active_time"
|
android:drawableStart="@drawable/icon_active_time"
|
||||||
android:drawablePadding="@dimen/dp_6"
|
android:drawablePadding="@dimen/dp_6"
|
||||||
android:text="@string/txt_total_data"
|
android:text="@string/txt_total_time"
|
||||||
android:textSize="@dimen/textSize14"
|
android:textSize="@dimen/textSize14"
|
||||||
app:typeface="@string/roboto_regular_font" />
|
app:typeface="@string/roboto_regular_font" />
|
||||||
|
|
||||||
@@ -351,6 +352,7 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_8"
|
android:layout_marginTop="@dimen/dp_8"
|
||||||
|
android:visibility="gone"
|
||||||
android:background="@drawable/shape8_white_gray_bg"
|
android:background="@drawable/shape8_white_gray_bg"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingHorizontal="@dimen/dp_12"
|
android:paddingHorizontal="@dimen/dp_12"
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginBottom="@dimen/dp_58"
|
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:orientation="vertical"
|
||||||
android:paddingHorizontal="@dimen/dp_36"
|
android:paddingHorizontal="@dimen/dp_36"
|
||||||
android:paddingVertical="@dimen/dp_6"
|
android:paddingVertical="@dimen/dp_6"
|
||||||
|
|||||||
@@ -86,23 +86,26 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@id/home_map_refresh_btn"
|
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:orientation="vertical"
|
||||||
android:paddingHorizontal="@dimen/dp_14"
|
android:paddingHorizontal="@dimen/dp_14"
|
||||||
android:paddingVertical="@dimen/dp_16"
|
android:paddingVertical="@dimen/dp_16">
|
||||||
android:visibility="invisible">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_home_map_live_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="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: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
|
<com.abbidot.tracker.widget.TypefaceTextView
|
||||||
|
android:id="@+id/tv_home_map_live_title"
|
||||||
style="@style/my_TextView_style_v2"
|
style="@style/my_TextView_style_v2"
|
||||||
android:layout_marginTop="@dimen/dp_2"
|
android:layout_marginTop="@dimen/dp_2"
|
||||||
android:text="@string/txt_live"
|
android:text="@string/txt_live"
|
||||||
|
android:textColor="@color/grey_color"
|
||||||
android:textSize="@dimen/textSize12"
|
android:textSize="@dimen/textSize12"
|
||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
@@ -138,6 +136,7 @@
|
|||||||
android:textStyle="bold" />
|
android:textStyle="bold" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
android:id="@+id/iv_my_tracker_v2_link_image"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@id/rl_my_tracker_v2_device"
|
android:layout_alignTop="@id/rl_my_tracker_v2_device"
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
<androidx.appcompat.widget.LinearLayoutCompat
|
<FrameLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/dp_6"
|
android:layout_marginTop="@dimen/dp_6"
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<com.abbidot.tracker.widget.TypefaceTextView
|
<com.abbidot.tracker.widget.TypefaceTextView
|
||||||
android:id="@+id/tv_device_battery_info"
|
android:id="@+id/tv_device_battery_info"
|
||||||
style="@style/my_TextView_style_v2"
|
style="@style/my_TextView_style_v2"
|
||||||
|
android:layout_marginBottom="@dimen/dp_8"
|
||||||
android:background="@drawable/shape8_white_bg"
|
android:background="@drawable/shape8_white_bg"
|
||||||
android:drawableStart="@drawable/icon_low_battery_image"
|
android:drawableStart="@drawable/icon_low_battery_image"
|
||||||
android:drawablePadding="@dimen/dp_4"
|
android:drawablePadding="@dimen/dp_4"
|
||||||
@@ -26,9 +27,10 @@
|
|||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center_horizontal|bottom"
|
||||||
android:src="@drawable/icon_white_trigon" />
|
android:src="@drawable/icon_white_trigon" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
|
|||||||
@@ -7,6 +7,6 @@
|
|||||||
android:paddingHorizontal="@dimen/dp_18"
|
android:paddingHorizontal="@dimen/dp_18"
|
||||||
android:paddingVertical="@dimen/dp_8"
|
android:paddingVertical="@dimen/dp_8"
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/tab_select"
|
||||||
android:textSize="15dp"
|
android:textSize="15dp"
|
||||||
app:typeface="@string/roboto_regular_font" />
|
app:typeface="@string/roboto_regular_font" />
|
||||||
@@ -1053,5 +1053,9 @@
|
|||||||
<string name="txt_powered_off">Powered off</string>
|
<string name="txt_powered_off">Powered off</string>
|
||||||
<string name="txt_near">Near %s</string>
|
<string name="txt_near">Near %s</string>
|
||||||
<string name="txt_charging">Charging</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>
|
</resources>
|
||||||
Reference in New Issue
Block a user