Commit dc3983ed authored by wanglei's avatar wanglei

...

parent a465abc7
......@@ -6,7 +6,7 @@ package com.base.locationsharewhite.bean
data class ViewingBean(
val device: String,
val nickname: String,
val status: Int = -1,
val status: Int = -1,//1可见,0不可见
var locatDate: LocationData? = null,
)
......
......@@ -97,6 +97,13 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
binding.rvViewing.adapter = adapter
}
private fun cancelGetLocationJob() {
currentViewingBean = null
getLocationJob?.cancel()
getLocationJob = null
friendMarker?.remove()
}
@SuppressLint("NotifyDataSetChanged")
private fun startGetLocationJob() {
getLocationJob?.cancel()
......@@ -121,6 +128,10 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
}
}
}
if (currentViewingBean == null) {
friendMarker?.remove()
friendMarker = null
}
delay(10 * 1000L)
}
}
......@@ -142,6 +153,8 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
runOnUiThread {
if (it.isEmpty()) {
showFriendGuideOrNoFriend()
adapter.submitList(listOf())
cancelGetLocationJob()
} else {
binding.llFriendsGuide.visibility = View.GONE
binding.llNoFriend.visibility = View.GONE
......@@ -280,6 +293,7 @@ class LocationMapActivity : BaseActivity<ActivityLocationMapBinding>(), OnMapRea
val friendAvatar = LayoutInflater.from(this).inflate(R.layout.avatar_friend, null)
LogEx.logDebug(TAG, "initViewingBeanMarker locatDate ${locatDate.latitude} ${locatDate.longitude}")
friendMarker = map?.addLocationMarker(friendAvatar, latLng, viewingBean.nickname)
changeMarkerZIndex(false)
}
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