修改首次绑定,未定到位时,不显示宠物,显示用户位置

This commit is contained in:
yezhiqiu
2026-02-03 15:26:31 +08:00
parent 9854b7b90d
commit 8788613dd2
4 changed files with 32 additions and 6 deletions

View File

@@ -190,6 +190,10 @@ class HomeMapCommonV3 @Inject constructor() : BaseMapCommon() {
} }
} }
fun getUserGoogleLatLng(): LatLng? {
return mHomeMapGoogleMapFragment?.mUserLatLng
}
// fun getAddressShowMarkerInfoWindow(historyDataBean: HistoryDataBean) { // fun getAddressShowMarkerInfoWindow(historyDataBean: HistoryDataBean) {
// if (null != mHomeMapBaiduMapFragment) { // if (null != mHomeMapBaiduMapFragment) {
// mHomeMapBaiduMapFragment!!.showMarkerInfoWindow(historyDataBean) // mHomeMapBaiduMapFragment!!.showMarkerInfoWindow(historyDataBean)

View File

@@ -44,6 +44,7 @@ import com.abbidot.tracker.ui.common.map.HomeMapCommonV3
import com.abbidot.tracker.util.Util import com.abbidot.tracker.util.Util
import com.abbidot.tracker.util.ViewUtil import com.abbidot.tracker.util.ViewUtil
import com.abbidot.tracker.util.bluetooth.SRBleUtil import com.abbidot.tracker.util.bluetooth.SRBleUtil
import com.abbidot.tracker.vm.CountDownTimerViewModel
import com.abbidot.tracker.vm.FencesMapViewModel import com.abbidot.tracker.vm.FencesMapViewModel
import com.abbidot.tracker.vm.MapViewModel import com.abbidot.tracker.vm.MapViewModel
import com.clj.fastble.BleManager import com.clj.fastble.BleManager
@@ -62,6 +63,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
private val mFencesMapViewModel: FencesMapViewModel by viewModels() private val mFencesMapViewModel: FencesMapViewModel by viewModels()
private val mMapViewModel: MapViewModel by viewModels() private val mMapViewModel: MapViewModel by viewModels()
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
private lateinit var mLocationManager: LocationManager private lateinit var mLocationManager: LocationManager
@@ -166,7 +168,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
// (mActivity as FragmentActivity).supportFragmentManager.commit { // (mActivity as FragmentActivity).supportFragmentManager.commit {
// add(R.id.fc_home_map_fragment, mFragment) // add(R.id.fc_home_map_fragment, mFragment)
// } // }
locationPermissionsTip(1) locationPermissionsTip(1)
} }
@@ -240,6 +241,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
}, showLoading = false, isRequestErrorTip = false) }, showLoading = false, isRequestErrorTip = false)
} }
mCountDownTimerViewModel.mCountDownEndLiveData.observe(this) {
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.text =
getHomeV2Activity()?.getPet()?.petName
}
//删除围栏通知 //删除围栏通知
XEventBus.observe(this, EventName.DeleteFences) { XEventBus.observe(this, EventName.DeleteFences) {
updateMapDeviceStatus() updateMapDeviceStatus()
@@ -527,16 +532,31 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
//设置循环查询时间间隔 30秒 //设置循环查询时间间隔 30秒
mMapViewModel.updateMillisInFuture(0.5f) mMapViewModel.updateMillisInFuture(0.5f)
if (latitude == 0.0 && longitude == 0.0) {
mHomeMapCommon.clearMarker()
isMoveCamera = true
mHomeMapCommon.getUserGoogleLatLng()?.let {
mHomeMapCommon.refreshPetCurrentLocation(
it.latitude, it.longitude, isMoveCamera
)
}
mCountDownTimerViewModel.startCountDown(30)
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.setText(R.string.txt_locating)
mViewBinding.ilHomeMapPetLocation.root.visibility = View.INVISIBLE
} else {
// mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.text =
// getHomeV2Activity()?.getPet()?.petName
// mCountDownTimerViewModel.stopCountDown()
mHomeMapCommon.refreshPetCurrentLocation(latitude, longitude, isMoveCamera)
isMoveCamera = false
}
mHomeMapCommon.startRefreshUserLocation()
if (isShowFence) { if (isShowFence) {
fences?.let { fences -> fences?.let { fences ->
mFencesMapViewModel.setFencesData(mContext!!, fences, mFragment) mFencesMapViewModel.setFencesData(mContext!!, fences, mFragment)
} }
} }
mHomeMapCommon.refreshPetCurrentLocation(latitude, longitude, isMoveCamera)
mHomeMapCommon.startRefreshUserLocation()
isMoveCamera = false
} }
} }

View File

@@ -56,6 +56,7 @@ class GeoCoderViewModel : ViewModel() {
* @param showDetailAddress 是否显示最详细的地址 * @param showDetailAddress 是否显示最详细的地址
*/ */
fun getLatLonAddress(latitude: Double, longitude: Double, showDetailAddress: Boolean = true) { fun getLatLonAddress(latitude: Double, longitude: Double, showDetailAddress: Boolean = true) {
if (latitude == 0.0 && longitude == 0.0) return
isShowDetailAddress = showDetailAddress isShowDetailAddress = showDetailAddress

View File

@@ -1068,5 +1068,6 @@
<string name="txt_day_unit">/day x%s</string> <string name="txt_day_unit">/day x%s</string>
<string name="txt_location_tip">"ABBIDOT APP collects location data,The route and distance between the current location and the device can be calculated."</string> <string name="txt_location_tip">"ABBIDOT APP collects location data,The route and distance between the current location and the device can be calculated."</string>
<string name="txt_auto_subscription_day">(Renew at $%s per %s day thereafter)</string> <string name="txt_auto_subscription_day">(Renew at $%s per %s day thereafter)</string>
<string name="txt_locating">Locating&#8230;</string>
</resources> </resources>