1.新增一键定位功能
2.g30隐藏直播按钮,g40显示直播按钮 3.map页雷达按钮增加显示蓝牙连接状态
This commit is contained in:
@@ -30,7 +30,7 @@ android {
|
||||
targetSdkVersion 35
|
||||
versionCode 2110
|
||||
// versionName "2.1.10"
|
||||
versionName "2.1.10-Beta6"
|
||||
versionName "2.1.10-Beta9"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
||||
|
||||
@@ -36,9 +36,10 @@ data class MapDeviceBean(
|
||||
var startTime: String,
|
||||
var endTime: String,
|
||||
var deviceType: Int,
|
||||
var canShowBattery: Boolean,
|
||||
var isCloseBattery: Boolean,
|
||||
var isCloseMsg: Boolean
|
||||
var notifyLocationFail: Boolean,
|
||||
var canShowBattery: Boolean,//是否可以显示电池提示布局
|
||||
var isCloseBattery: Boolean,//是否关闭电池提示
|
||||
var isCloseMsg: Boolean //是否关闭消息提示
|
||||
) : Parcelable {
|
||||
constructor() : this(
|
||||
"",
|
||||
@@ -73,6 +74,7 @@ data class MapDeviceBean(
|
||||
1,
|
||||
false,
|
||||
false,
|
||||
false,
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1409,4 +1409,11 @@ interface INetworkService {
|
||||
@Field("macID") macID: String,
|
||||
@Field("logFileUrl") logFileUrl: String
|
||||
): BaseResponse<String>
|
||||
|
||||
/**
|
||||
* 设备一键定位
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("map/setupRefreshLocation")
|
||||
suspend fun setupRefreshLocation(@Field("deviceId") deviceId: String): BaseResponse<String>
|
||||
}
|
||||
@@ -739,6 +739,13 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
service.getMapDeviceStatus(deviceId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备一键定位
|
||||
*/
|
||||
suspend fun setupRefreshLocation(deviceId: String) = getResult {
|
||||
service.setupRefreshLocation(deviceId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开关闭直播
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import android.text.TextUtils
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import androidx.activity.viewModels
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.core.view.get
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
@@ -106,6 +107,9 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
//是否检查套餐过期
|
||||
private var isCheckPackageExpire = true
|
||||
|
||||
//是否一键定位
|
||||
var isNotifyRefreshLocation = false
|
||||
|
||||
private val mFragments = mutableListOf<Fragment>(
|
||||
ActivityV2Fragment.newInstance(this),
|
||||
RouteV2Fragment.newInstance(this),
|
||||
@@ -613,6 +617,33 @@ class HomeV2Activity : BaseActivity<ActivityHomeV2Binding>(ActivityHomeV2Binding
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检测一键定位状态
|
||||
*/
|
||||
fun checkNotifyRefreshLocation(textView: AppCompatTextView) {
|
||||
textView.let {
|
||||
if (isNotifyRefreshLocation) {
|
||||
it.setText(R.string.txt_locating)
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
} else {
|
||||
getPet(false)?.let { pet ->
|
||||
it.text = pet.petName
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
||||
0, 0, R.drawable.icon_gray_down_arrow, 0
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshLocationBtnState() {
|
||||
when (mViewBinding.homeV2ViewPager2.currentItem) {
|
||||
0 -> (mFragments[0] as ActivityV2Fragment).checkNotifyLocationState()
|
||||
1 -> (mFragments[1] as RouteV2Fragment).checkNotifyLocationState()
|
||||
3 -> (mFragments[3] as PetV2Fragment).checkNotifyLocationState()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCurrentClick() {
|
||||
mChangePetDialog?.dismiss()
|
||||
}
|
||||
|
||||
@@ -183,6 +183,10 @@ class HomeMapCommonV3 @Inject constructor() : BaseMapCommon() {
|
||||
mHomeMapGoogleMapFragment?.greenRippleCircleAnim()
|
||||
}
|
||||
|
||||
fun clearRippleCircleAnim() {
|
||||
mHomeMapGoogleMapFragment?.clearRippleCircleAnim()
|
||||
}
|
||||
|
||||
fun setMarkerInfoViewOffset() {
|
||||
if (null != mHomeMapBaiduMapFragment) {
|
||||
} else if (null != mHomeMapGoogleMapFragment) {
|
||||
|
||||
@@ -162,6 +162,13 @@ class ActivityV2Fragment :
|
||||
//其他页面是否选择了宠物
|
||||
showPetNameAndHead(it.mSelectPetPosition)
|
||||
}
|
||||
checkNotifyLocationState()
|
||||
}
|
||||
}
|
||||
|
||||
fun checkNotifyLocationState() {
|
||||
getHomeV2Activity()?.apply {
|
||||
checkNotifyRefreshLocation(mViewBinding.ilHomeActivityTopPet.homeDataPetNameSmall)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -319,7 +326,11 @@ class ActivityV2Fragment :
|
||||
|
||||
btnHomeMoreSleep -> goActivityNeedPet(MoreSleepActivity::class.java)
|
||||
|
||||
ilHomeActivityTopPet.homeDataPetNameSmall, ilHomeActivityTopPet.homeDataPetHeadSmall.root -> getHomeV2Activity()?.selectPetDialog()
|
||||
ilHomeActivityTopPet.homeDataPetNameSmall, ilHomeActivityTopPet.homeDataPetHeadSmall.root -> {
|
||||
getHomeV2Activity()?.let {
|
||||
if (!it.isNotifyRefreshLocation) it.selectPetDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -154,6 +154,7 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun initState() {
|
||||
mViewBinding.miHomeRouteAddressView.visibility = View.GONE
|
||||
mHistoryDataMapCommon.clearAllMarker()
|
||||
@@ -228,6 +229,13 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
if (!isSelectCustomDate) get24HourTime()
|
||||
showPetNameAndHead(mSelectPetPosition)
|
||||
}
|
||||
checkNotifyLocationState()
|
||||
}
|
||||
}
|
||||
|
||||
fun checkNotifyLocationState() {
|
||||
getHomeV2Activity()?.apply {
|
||||
checkNotifyRefreshLocation(mViewBinding.ilHomeRoutePetHead.homeDataPetNameSmall)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,9 +427,11 @@ class RouteV2Fragment : BaseFragment<FragmentRouteV2Binding>(FragmentRouteV2Bind
|
||||
// mContext, NotificationV2Activity::class.java
|
||||
// )
|
||||
// )
|
||||
ilHomeRoutePetHead.homeDataPetNameSmall, ilHomeRoutePetHead.homeDataPetHeadSmall.root -> getHomeV2Activity()?.selectPetDialog(
|
||||
false
|
||||
)
|
||||
ilHomeRoutePetHead.homeDataPetNameSmall, ilHomeRoutePetHead.homeDataPetHeadSmall.root -> {
|
||||
getHomeV2Activity()?.let {
|
||||
if (!it.isNotifyRefreshLocation) it.selectPetDialog(false)
|
||||
}
|
||||
}
|
||||
|
||||
llHomeRouteCalendarFrom -> {
|
||||
getHomeV2Activity()?.getPet()?.let {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.abbidot.tracker.ui.fragment.map
|
||||
|
||||
import android.animation.AnimatorSet
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
@@ -100,6 +101,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
//是否需要gps坐标转火星坐标
|
||||
private var needGpsToGCJ02 = true
|
||||
private var mAnimatorSet: AnimatorSet? = null
|
||||
|
||||
//一键定位开始的时间戳
|
||||
private var notifyRefreshLocationTimestamp = 0L
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@@ -150,6 +155,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
homeMapRefreshBtn,
|
||||
homeMapBluetoothBtn,
|
||||
homeMapLiveBtn,
|
||||
ivHomeMapRefreshLocation,
|
||||
llHomeMapTopPet.ivTopPetBtnSmall,
|
||||
llHomeMapTopPet.homeDataPetNameSmall,
|
||||
llHomeMapTopPet.homeDataPetHeadSmall.root,
|
||||
@@ -220,32 +226,32 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
override fun liveDataObserve() {
|
||||
//获取当前宠物位置和围栏信息
|
||||
mMapViewModel.mMapDeviceLiveData.observe(this) {
|
||||
mMapViewModel.apply {
|
||||
mMapDeviceLiveData.observe(this@MapV3Fragment) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
val data = it.getOrNull()
|
||||
data?.apply {
|
||||
mMapDeviceBean?.let { m ->
|
||||
data.isCloseMsg = m.isCloseMsg
|
||||
data.isCloseBattery = m.isCloseBattery
|
||||
data.canShowBattery = m.canShowBattery
|
||||
}
|
||||
mMapDeviceBean = data
|
||||
setMapData(data)
|
||||
mMapViewModel.setDeviceStateAndWarningData(
|
||||
mContext!!,
|
||||
getHomeV2Activity()?.getPet(),
|
||||
data,
|
||||
mViewBinding.ilHomeMapDeviceMsg.root,
|
||||
mViewBinding.ilHomeMapDeviceMsg.tvDeviceMsgContent,
|
||||
mViewBinding.ilHomeMapDeviceMsg.ivDeviceMsgCloseBtn,
|
||||
mDeviceStateList,
|
||||
mDeviceStateAdapter
|
||||
)
|
||||
it.getOrNull()?.let { data ->
|
||||
dealMapData(data)
|
||||
}
|
||||
}
|
||||
}, showLoading = false, isRequestErrorTip = false)
|
||||
}
|
||||
mRefreshLocationLiveData.observe(this@MapV3Fragment) {
|
||||
dealRequestResult(it, object : GetResultCallback {
|
||||
override fun onResult(any: Any) {
|
||||
mMapViewModel.updateMillisInFuture(0.05f)
|
||||
}
|
||||
|
||||
override fun onErrorCode() {
|
||||
stopRefreshLocation()
|
||||
}
|
||||
|
||||
override fun onRequestError(exceptionCode: String?) {
|
||||
stopRefreshLocation()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
mCountDownTimerViewModel.mCountDownEndLiveData.observe(this) {
|
||||
mCountDownTimerViewModel.isStartCountDown = true
|
||||
@@ -317,6 +323,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
getHomeV2Activity()?.getPet(false)?.apply {
|
||||
if (trackBle.mac == macID) {
|
||||
if (trackBle.conState == ConState.CONNECTED) {
|
||||
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_online)
|
||||
mMapDeviceBean?.let {
|
||||
//连接上蓝牙,关机不显示
|
||||
if (it.powerSwitch == ConstantInt.Type0) {
|
||||
@@ -345,9 +352,11 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
//隐藏蓝牙nearby
|
||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_offline)
|
||||
//蓝牙断开就重新获取服务器数据,蓝牙数据上报断开
|
||||
updateMapDeviceStatus()
|
||||
}
|
||||
setRefreshLocationBtnState()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,6 +371,66 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
// }
|
||||
}
|
||||
|
||||
private fun dealMapData(data: MapDeviceBean) {
|
||||
mMapDeviceBean?.let { m ->
|
||||
data.notifyLocationFail = m.notifyLocationFail
|
||||
data.isCloseMsg = m.isCloseMsg
|
||||
data.isCloseBattery = m.isCloseBattery
|
||||
data.canShowBattery = m.canShowBattery
|
||||
}
|
||||
mMapDeviceBean = data
|
||||
|
||||
getHomeV2Activity()?.apply {
|
||||
if (isNotifyRefreshLocation) {
|
||||
if (data.liveFlag == 0) {
|
||||
stopRefreshLocation()
|
||||
setMapData(data)
|
||||
mMapViewModel.setDeviceStateAndWarningData(
|
||||
mContext,
|
||||
getPet(),
|
||||
data,
|
||||
mViewBinding.ilHomeMapDeviceMsg.root,
|
||||
mViewBinding.ilHomeMapDeviceMsg.tvDeviceMsgContent,
|
||||
mViewBinding.ilHomeMapDeviceMsg.ivDeviceMsgCloseBtn,
|
||||
mDeviceStateList,
|
||||
mDeviceStateAdapter
|
||||
)
|
||||
} else {
|
||||
//60秒超时
|
||||
// val isRefreshTimeOut =
|
||||
// (System.currentTimeMillis() - notifyRefreshLocationTimestamp) / 1000 >= 0
|
||||
// if (isRefreshTimeOut) {
|
||||
// stopRefreshLocation()
|
||||
// mMapDeviceBean!!.notifyLocationFail = true
|
||||
// mMapDeviceBean!!.isCloseBattery = false
|
||||
// mMapDeviceBean!!.canShowBattery = true
|
||||
// mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
||||
// mMapViewModel.setMapDeviceBattery(
|
||||
// mContext,
|
||||
// mMapDeviceBean!!,
|
||||
// it.root,
|
||||
// it.tvDeviceBatteryInfo,
|
||||
// it.ivDeviceCloseBtn
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
setMapData(data)
|
||||
mMapViewModel.setDeviceStateAndWarningData(
|
||||
mContext,
|
||||
getPet(),
|
||||
data,
|
||||
mViewBinding.ilHomeMapDeviceMsg.root,
|
||||
mViewBinding.ilHomeMapDeviceMsg.tvDeviceMsgContent,
|
||||
mViewBinding.ilHomeMapDeviceMsg.ivDeviceMsgCloseBtn,
|
||||
mDeviceStateList,
|
||||
mDeviceStateAdapter
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新蓝牙上报的数据
|
||||
*/
|
||||
@@ -517,8 +586,11 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
//隐藏蓝牙nearby
|
||||
mViewBinding.ilHomeMapDeviceMsg.root.visibility = View.GONE
|
||||
mViewBinding.homeMapLiveBtn.visibility = View.GONE
|
||||
mViewBinding.ivHomeMapBleConState.setImageResource(R.drawable.icon_map_offline)
|
||||
mViewBinding.llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
|
||||
isCanLive = false
|
||||
setRefreshLocationBtnState()
|
||||
|
||||
ViewUtil.instance.selectPetDialogShow(
|
||||
mContext,
|
||||
@@ -586,6 +658,24 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
private fun setRefreshLocationBtnState() {
|
||||
getHomeV2Activity()?.apply {
|
||||
getPet(false)?.let { pet ->
|
||||
mViewBinding.ivHomeMapRefreshLocation.let {
|
||||
val tintColor = if (SRBleUtil.instance.isMacConnect(pet.macID) || !isCanLive) {
|
||||
it.setBackgroundResource(R.drawable.shape_light_yellow_circle_bg)
|
||||
R.color.grey_color
|
||||
} else {
|
||||
it.setBackgroundResource(R.drawable.shape_yellow_circle_bg)
|
||||
R.color.select_color3
|
||||
}
|
||||
it.imageTintList =
|
||||
ColorStateList.valueOf(ContextCompat.getColor(mContext, tintColor))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setLiveBtnState(canLive: Boolean) {
|
||||
mViewBinding.apply {
|
||||
ViewUtil.instance.viewShow(homeMapLiveBtn)
|
||||
@@ -619,19 +709,22 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
private fun setMapDeviceBean(mapDeviceBean: MapDeviceBean) {
|
||||
mapDeviceBean.apply {
|
||||
val share = MMKVUtil.getInt(MMKVKey.Shared)
|
||||
mViewBinding.homeMapLiveBtn.visibility = if (share != ConstantInt.NoShare) {
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
isCanLive =
|
||||
!(Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||
mViewBinding.homeMapLiveBtn.visibility =
|
||||
if (share != ConstantInt.NoShare || deviceType == ConstantInt.Type1) {
|
||||
View.GONE
|
||||
} else {
|
||||
if (liveFlag == ConstantInt.Type1) View.GONE
|
||||
else {
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
isCanLive =
|
||||
!(Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||
setLiveBtnState(isCanLive)
|
||||
View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
setRefreshLocationBtnState()
|
||||
|
||||
mViewBinding.ilHomeMapDeviceBatteryLayout.let {
|
||||
mMapViewModel.setMapDeviceBattery(
|
||||
mContext!!, mapDeviceBean, it.root, it.tvDeviceBatteryInfo, it.ivDeviceCloseBtn
|
||||
@@ -720,6 +813,69 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始通知一键定位
|
||||
*/
|
||||
private fun notifyRefreshLocation() {
|
||||
getHomeV2Activity()?.apply {
|
||||
getPet()?.let { pet ->
|
||||
if (SRBleUtil.instance.isMacConnect(pet.macID)) {
|
||||
showToast(R.string.txt_pet_close, gravity = Gravity.CENTER)
|
||||
} else if (!isCanLive) {
|
||||
showToast(R.string.txt_locate_works, gravity = Gravity.CENTER)
|
||||
} else if (!isNotifyRefreshLocation) {
|
||||
isNotifyRefreshLocation = true
|
||||
isMoveCamera = true
|
||||
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.let {
|
||||
it.setText(R.string.txt_locating)
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0)
|
||||
}
|
||||
notifyRefreshLocationTimestamp = System.currentTimeMillis()
|
||||
mHomeMapCommon.greenRippleCircleAnim()
|
||||
mViewBinding.ivHomeMapRefreshLocation.let {
|
||||
it.isEnabled = false
|
||||
it.imageTintList = ColorStateList.valueOf(
|
||||
ContextCompat.getColor(
|
||||
mContext, R.color.grey_color
|
||||
)
|
||||
)
|
||||
mAnimatorSet = ViewUtil.instance.viewRotationAnimator(it, true)
|
||||
}
|
||||
mMapViewModel.stopGetData()
|
||||
mMapViewModel.setupRefreshLocation(pet.deviceId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun stopRefreshLocation() {
|
||||
getHomeV2Activity()?.apply {
|
||||
if (isNotifyRefreshLocation) {
|
||||
isNotifyRefreshLocation = false
|
||||
mHomeMapCommon.clearRippleCircleAnim()
|
||||
mViewBinding.ivHomeMapRefreshLocation.let {
|
||||
it.isEnabled = true
|
||||
it.imageTintList = ColorStateList.valueOf(
|
||||
ContextCompat.getColor(
|
||||
mContext, R.color.select_color3
|
||||
)
|
||||
)
|
||||
mAnimatorSet?.cancel()
|
||||
}
|
||||
getPet(false)?.let { pet ->
|
||||
mMapViewModel.updateMillisInFuture(0.35f)
|
||||
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.let {
|
||||
it.text = pet.petName
|
||||
it.setCompoundDrawablesWithIntrinsicBounds(
|
||||
0, 0, R.drawable.icon_gray_down_arrow, 0
|
||||
)
|
||||
}
|
||||
}
|
||||
refreshLocationBtnState()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
if (isLimitClick()) return
|
||||
mViewBinding.apply {
|
||||
@@ -753,9 +909,17 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
goLive(true)
|
||||
}
|
||||
|
||||
ivHomeMapRefreshLocation -> notifyRefreshLocation()
|
||||
llHomeMapTopPet.ivTopPetBtnSmall -> showMapTypeDialog()
|
||||
homeMapBluetoothBtn -> checkPermissions(1)
|
||||
llHomeMapTopPet.homeDataPetNameSmall, llHomeMapTopPet.homeDataPetHeadSmall.root -> getHomeV2Activity()?.selectPetDialog()
|
||||
llHomeMapTopPet.homeDataPetNameSmall, llHomeMapTopPet.homeDataPetHeadSmall.root -> {
|
||||
getHomeV2Activity()?.let {
|
||||
if (!it.isNotifyRefreshLocation) {
|
||||
getHomeV2Activity()?.selectPetDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ilHomeMapDeviceBatteryLayout.ivDeviceCloseBtn -> {
|
||||
mMapDeviceBean?.isCloseBattery = true
|
||||
llHomeMapDeviceBatteryLayout.visibility = View.INVISIBLE
|
||||
|
||||
@@ -229,7 +229,7 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
mGoogleMap?.let {
|
||||
if (null == mRippleCircle) {
|
||||
mRippleCircle = it.addCircle(
|
||||
CircleOptions().center(this)
|
||||
CircleOptions().center(toGCJ02LatLon(this))
|
||||
.radius(mRippleCircleRadius * mRippleCirclePercent)
|
||||
.strokeWidth(AppUtils.dpToPx(2).toFloat())
|
||||
.fillColor(ContextCompat.getColor(mContext!!, R.color.black10))
|
||||
@@ -253,7 +253,7 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
mRippleCirclePercent = it.animatedValue as Float / 100.0
|
||||
mRippleCircle?.apply {
|
||||
mPetLatLng?.let { petLatLng ->
|
||||
center = petLatLng
|
||||
center = toGCJ02LatLon(petLatLng)
|
||||
radius = mRippleCircleRadius * mRippleCirclePercent
|
||||
}
|
||||
}
|
||||
@@ -261,6 +261,10 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
repeatMode = ValueAnimator.RESTART
|
||||
repeatCount = ValueAnimator.INFINITE
|
||||
}
|
||||
} else {
|
||||
mValueAnimator?.apply {
|
||||
if (!isRunning) start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +295,7 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
for (i in 0 until trackList.size) {
|
||||
trackList[i].apply {
|
||||
val latLng = LatLng(latitude, longitude)
|
||||
latLngList.add(latLng)
|
||||
latLngList.add(toGCJ02LatLon(latLng))
|
||||
if (i == trackList.size - 1) {
|
||||
// addUserAndPetLine(latLng)
|
||||
refreshPetCurrentLocation(latLng, needMoveCamera = isMoveCamera)
|
||||
@@ -319,6 +323,7 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
* 直播开始之后,改变绿色波纹动画
|
||||
*/
|
||||
fun greenRippleCircleAnim() {
|
||||
if (null == mRippleCircle) addRippleCircle()
|
||||
mRippleCircle?.apply {
|
||||
//一像素对应几米
|
||||
val pxDis = 2.0.pow(15.5 - getGoogleMapZoom())
|
||||
@@ -329,8 +334,14 @@ class HomeMapGoogleMapFragmentV3 : BaseGoogleMapFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
fun clearRippleCircleAnim() {
|
||||
mValueAnimator?.cancel()
|
||||
mRippleCircle?.remove()
|
||||
mRippleCircle = null
|
||||
}
|
||||
|
||||
override fun onDetach() {
|
||||
super.onDetach()
|
||||
mValueAnimator?.cancel()
|
||||
clearRippleCircleAnim()
|
||||
}
|
||||
}
|
||||
@@ -143,6 +143,13 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
||||
(mFragments[1] as HomeTrackFragment).getPetTrackerInfoData()
|
||||
}
|
||||
}
|
||||
checkNotifyLocationState()
|
||||
}
|
||||
|
||||
fun checkNotifyLocationState() {
|
||||
getHomeV2Activity()?.apply {
|
||||
checkNotifyRefreshLocation(mViewBinding.ilHomePetTopBar.homeDataPetNameSmall)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
@@ -207,7 +214,12 @@ class PetV2Fragment : BaseFragment<FragmentPetV2Binding>(FragmentPetV2Binding::i
|
||||
override fun onClick(v: View?) {
|
||||
mViewBinding.apply {
|
||||
when (v!!) {
|
||||
ilHomePetTopBar.homeDataPetNameSmall, ilHomePetTopBar.homeDataPetHeadSmall.root -> getHomeV2Activity()?.selectPetDialog()
|
||||
ilHomePetTopBar.homeDataPetNameSmall, ilHomePetTopBar.homeDataPetHeadSmall.root -> {
|
||||
getHomeV2Activity()?.let {
|
||||
if (!it.isNotifyRefreshLocation) it.selectPetDialog()
|
||||
}
|
||||
}
|
||||
|
||||
ilHomePetTopBar.ivTopPetBtnSmall -> startActivity(
|
||||
Intent(mContext, NotificationV2Activity::class.java)
|
||||
)
|
||||
|
||||
@@ -29,6 +29,7 @@ import kotlinx.coroutines.launch
|
||||
class MapViewModel : ViewModel() {
|
||||
|
||||
val mMapDeviceLiveData = MutableLiveData<Result<MapDeviceBean>>()
|
||||
val mRefreshLocationLiveData = MutableLiveData<Result<String>>()
|
||||
private var mCountDownTimer: CountDownTimer? = null
|
||||
|
||||
//几分钟倒计时(min)
|
||||
@@ -37,6 +38,13 @@ class MapViewModel : ViewModel() {
|
||||
|
||||
var mDeviceMsgType = ConstantInt.SpecialType
|
||||
|
||||
fun setupRefreshLocation(deviceId: String) {
|
||||
viewModelScope.launch {
|
||||
val result = NetworkApi.setupRefreshLocation(deviceId)
|
||||
mRefreshLocationLiveData.value = result
|
||||
}
|
||||
}
|
||||
|
||||
fun getMapDeviceStatus(deviceId: String, isNeedCountDown: Boolean = true) {
|
||||
viewModelScope.launch {
|
||||
stopGetData()
|
||||
@@ -51,7 +59,7 @@ class MapViewModel : ViewModel() {
|
||||
* 更新刷新时间
|
||||
*/
|
||||
fun updateMillisInFuture(refreshMin: Float) {
|
||||
if (refreshMin <= 0 || mRefreshDataMin == refreshMin) return
|
||||
if (refreshMin <= 0) return
|
||||
mRefreshDataMin = refreshMin
|
||||
countDownGetData(mDeviceId)
|
||||
}
|
||||
@@ -432,7 +440,7 @@ class MapViewModel : ViewModel() {
|
||||
mapDeviceBean: MapDeviceBean,
|
||||
rootView: ViewGroup,
|
||||
batteryText: TypefaceTextView,
|
||||
closeBtn: AppCompatImageView
|
||||
closeBtn: AppCompatImageView //可关闭按钮
|
||||
) {
|
||||
mapDeviceBean.apply {
|
||||
if (isCloseBattery) return@apply
|
||||
|
||||
BIN
app/src/main/res/drawable-xhdpi/icon_weak_gps_image.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/icon_weak_gps_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 297 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_weak_gps_image.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_weak_gps_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 424 B |
BIN
app/src/main/res/drawable-xxxhdpi/icon_weak_gps_image.png
Normal file
BIN
app/src/main/res/drawable-xxxhdpi/icon_weak_gps_image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 497 B |
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item >
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/light_yellow_color" />
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="false">
|
||||
<item android:state_enabled="true" android:state_pressed="false">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/yellow_color30" />
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/white" />
|
||||
@@ -12,4 +12,10 @@
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape android:shape="oval">
|
||||
<solid android:color="@color/light_yellow_color" />
|
||||
<stroke android:width="@dimen/dp_1" android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -66,30 +66,46 @@
|
||||
android:visibility="invisible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/home_map_bluetooth_btn"
|
||||
style="@style/map_image_white_btn_style"
|
||||
android:id="@+id/iv_home_map_refresh_location"
|
||||
style="@style/map_image_yellow_btn_style"
|
||||
android:layout_above="@id/il_home_map_pet_location"
|
||||
android:layout_alignEnd="@id/rv_home_map_device_state"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_map_bluetooth" />
|
||||
android:layout_marginBottom="@dimen/dp_18"
|
||||
android:tint="@color/grey_color" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/home_map_refresh_btn"
|
||||
style="@style/map_image_yellow_btn_style"
|
||||
android:layout_above="@id/home_map_bluetooth_btn"
|
||||
android:layout_alignEnd="@id/home_map_bluetooth_btn"
|
||||
android:layout_above="@id/iv_home_map_refresh_location"
|
||||
android:layout_alignEnd="@id/iv_home_map_refresh_location"
|
||||
android:layout_marginBottom="@dimen/dp_8" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/home_map_bluetooth_btn"
|
||||
style="@style/map_image_white_btn_style"
|
||||
android:layout_alignBottom="@id/iv_home_map_refresh_location"
|
||||
android:padding="@dimen/dp_8"
|
||||
android:src="@drawable/icon_map_bluetooth" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_home_map_ble_con_state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/home_map_bluetooth_btn"
|
||||
android:layout_alignEnd="@id/home_map_bluetooth_btn"
|
||||
android:src="@drawable/icon_map_offline" />
|
||||
|
||||
<androidx.appcompat.widget.LinearLayoutCompat
|
||||
android:id="@+id/home_map_live_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/home_map_refresh_btn"
|
||||
android:layout_above="@id/home_map_bluetooth_btn"
|
||||
android:layout_marginBottom="@dimen/dp_8"
|
||||
android:background="@drawable/shape38_gray_alpha_circle_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="@dimen/dp_14"
|
||||
android:paddingVertical="@dimen/dp_16">
|
||||
android:paddingVertical="@dimen/dp_16"
|
||||
android:visibility="gone">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/iv_home_map_live_image"
|
||||
|
||||
@@ -375,4 +375,5 @@
|
||||
<color name="blue_color">#26A8FF</color>
|
||||
<color name="line_stroke_color">#077B4A</color>
|
||||
<color name="rote_line_color">#00C478</color>
|
||||
<color name="light_yellow_color">#F9FFE8</color>
|
||||
</resources>
|
||||
@@ -1058,7 +1058,6 @@
|
||||
<string name="txt_tracker_offline">Tracker Offline. Unable to proceed.</string>
|
||||
<string name="txt_tracker_live">Live stream in progress. Settings unavailable.</string>
|
||||
<string name="txt_abnormity">Operation failed. Please try again.</string>
|
||||
|
||||
<string name="txt_per_day">/day</string>
|
||||
<string name="txt_renewal_day">Renewal: $%s/%s day on %s</string>
|
||||
<string name="txt_day_unit">/day x%s</string>
|
||||
@@ -1069,5 +1068,8 @@
|
||||
<string name="txt_auto_subscription_years">(Renew at $%s/%s years thereafter)</string>
|
||||
<string name="txt_auto_subscription_months">(Renew at $%s/%s months thereafter)</string>
|
||||
<string name="txt_tone">Tone</string>
|
||||
<string name="txt_locate_works">Locate works on cellular only</string>
|
||||
<string name="txt_pet_close">Pet is close, try Radar</string>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user