修改首次绑定,未定到位时,不显示宠物,显示用户位置
This commit is contained in:
@@ -190,6 +190,10 @@ class HomeMapCommonV3 @Inject constructor() : BaseMapCommon() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getUserGoogleLatLng(): LatLng? {
|
||||
return mHomeMapGoogleMapFragment?.mUserLatLng
|
||||
}
|
||||
|
||||
// fun getAddressShowMarkerInfoWindow(historyDataBean: HistoryDataBean) {
|
||||
// if (null != mHomeMapBaiduMapFragment) {
|
||||
// mHomeMapBaiduMapFragment!!.showMarkerInfoWindow(historyDataBean)
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.abbidot.tracker.ui.common.map.HomeMapCommonV3
|
||||
import com.abbidot.tracker.util.Util
|
||||
import com.abbidot.tracker.util.ViewUtil
|
||||
import com.abbidot.tracker.util.bluetooth.SRBleUtil
|
||||
import com.abbidot.tracker.vm.CountDownTimerViewModel
|
||||
import com.abbidot.tracker.vm.FencesMapViewModel
|
||||
import com.abbidot.tracker.vm.MapViewModel
|
||||
import com.clj.fastble.BleManager
|
||||
@@ -62,6 +63,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
|
||||
private val mFencesMapViewModel: FencesMapViewModel by viewModels()
|
||||
private val mMapViewModel: MapViewModel by viewModels()
|
||||
private val mCountDownTimerViewModel: CountDownTimerViewModel by viewModels()
|
||||
|
||||
private lateinit var mLocationManager: LocationManager
|
||||
|
||||
@@ -166,7 +168,6 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
// (mActivity as FragmentActivity).supportFragmentManager.commit {
|
||||
// add(R.id.fc_home_map_fragment, mFragment)
|
||||
// }
|
||||
|
||||
locationPermissionsTip(1)
|
||||
}
|
||||
|
||||
@@ -240,6 +241,10 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}, showLoading = false, isRequestErrorTip = false)
|
||||
}
|
||||
|
||||
mCountDownTimerViewModel.mCountDownEndLiveData.observe(this) {
|
||||
mViewBinding.llHomeMapTopPet.homeDataPetNameSmall.text =
|
||||
getHomeV2Activity()?.getPet()?.petName
|
||||
}
|
||||
//删除围栏通知
|
||||
XEventBus.observe(this, EventName.DeleteFences) {
|
||||
updateMapDeviceStatus()
|
||||
@@ -527,16 +532,31 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
//设置循环查询时间间隔 30秒
|
||||
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) {
|
||||
fences?.let { fences ->
|
||||
mFencesMapViewModel.setFencesData(mContext!!, fences, mFragment)
|
||||
}
|
||||
}
|
||||
|
||||
mHomeMapCommon.refreshPetCurrentLocation(latitude, longitude, isMoveCamera)
|
||||
mHomeMapCommon.startRefreshUserLocation()
|
||||
|
||||
isMoveCamera = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ class GeoCoderViewModel : ViewModel() {
|
||||
* @param showDetailAddress 是否显示最详细的地址
|
||||
*/
|
||||
fun getLatLonAddress(latitude: Double, longitude: Double, showDetailAddress: Boolean = true) {
|
||||
if (latitude == 0.0 && longitude == 0.0) return
|
||||
|
||||
isShowDetailAddress = showDetailAddress
|
||||
|
||||
|
||||
@@ -1068,5 +1068,6 @@
|
||||
<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_auto_subscription_day">(Renew at $%s per %s day thereafter)</string>
|
||||
<string name="txt_locating">Locating…</string>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user