Commit dc3983ed authored by wanglei's avatar wanglei

...

parent a465abc7
...@@ -6,7 +6,7 @@ package com.base.locationsharewhite.bean ...@@ -6,7 +6,7 @@ package com.base.locationsharewhite.bean
data class ViewingBean( data class ViewingBean(
val device: String, val device: String,
val nickname: String, val nickname: String,
val status: Int = -1, val status: Int = -1,//1可见,0不可见
var locatDate: LocationData? = null, var locatDate: LocationData? = null,
) )
......
...@@ -97,6 +97,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -97,6 +97,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
binding.rvViewing.adapter = adapter binding.rvViewing.adapter = adapter
} }
private fun cancelGetLocationJob() {
currentViewingBean = null
getLocationJob?.cancel()
getLocationJob = null
friendMarker?.remove()
}
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private fun startGetLocationJob() { private fun startGetLocationJob() {
getLocationJob?.cancel() getLocationJob?.cancel()
...@@ -121,6 +128,10 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -121,6 +128,10 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
} }
} }
} }
if (currentViewingBean == null) {
friendMarker?.remove()
friendMarker = null
}
delay(10 * 1000L) delay(10 * 1000L)
} }
} }
...@@ -142,6 +153,8 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -142,6 +153,8 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
runOnUiThread { runOnUiThread {
if (it.isEmpty()) { if (it.isEmpty()) {
showFriendGuideOrNoFriend() showFriendGuideOrNoFriend()
adapter.submitList(listOf())
cancelGetLocationJob()
} else { } else {
binding.llFriendsGuide.visibility = View.GONE binding.llFriendsGuide.visibility = View.GONE
binding.llNoFriend.visibility = View.GONE binding.llNoFriend.visibility = View.GONE
...@@ -280,6 +293,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea ...@@ -280,6 +293,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
val friendAvatar = LayoutInflater.from(this).inflate(R.layout.avatar_friend, null) val friendAvatar = LayoutInflater.from(this).inflate(R.layout.avatar_friend, null)
LogEx.logDebug(TAG, "initViewingBeanMarker locatDate ${locatDate.latitude} ${locatDate.longitude}") LogEx.logDebug(TAG, "initViewingBeanMarker locatDate ${locatDate.latitude} ${locatDate.longitude}")
friendMarker = map?.addLocationMarker(friendAvatar, latLng, viewingBean.nickname) friendMarker = map?.addLocationMarker(friendAvatar, latLng, viewingBean.nickname)
changeMarkerZIndex(false)
} }
setViewingBeanLocation(latLng, resetZoom) setViewingBeanLocation(latLng, resetZoom)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment