Fixing missing cleanUp on RecyclerView
This commit is contained in:
parent
9781656c1d
commit
72e2951c3e
|
@ -35,7 +35,7 @@ data class LocationSharingArgs(
|
|||
|
||||
@AndroidEntryPoint
|
||||
class LocationSharingActivity : VectorBaseActivity<ActivityLocationSharingBinding>() {
|
||||
|
||||
// TODO fix leak of mapTilerView
|
||||
override fun getBinding() = ActivityLocationSharingBinding.inflate(layoutInflater)
|
||||
|
||||
override fun initUiAndData() {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package im.vector.app.features.location.live.map
|
||||
|
||||
import android.content.Context
|
||||
import com.airbnb.epoxy.EpoxyController
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.date.DateFormatKind
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.mapbox.mapboxsdk.style.layers.Property
|
|||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.extensions.addChildFragment
|
||||
import im.vector.app.core.extensions.cleanup
|
||||
import im.vector.app.core.extensions.configureWith
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
|
@ -110,10 +111,11 @@ class LiveLocationMapViewFragment @Inject constructor() : VectorBaseFragment<Fra
|
|||
setupMap()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
override fun onDestroyView() {
|
||||
onSymbolClickListener?.let { symbolManager?.removeClickListener(it) }
|
||||
bottomSheetController.callback = null
|
||||
super.onDestroy()
|
||||
views.liveLocationBottomSheetRecyclerView.cleanup()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
private fun setupMap() {
|
||||
|
|
|
@ -79,15 +79,12 @@ abstract class LiveLocationUserItem : VectorEpoxyModel<LiveLocationUserItem.Hold
|
|||
}
|
||||
}
|
||||
|
||||
stopTimer(holder)
|
||||
holder.timer = CountUpTimer(1000).apply {
|
||||
tickListener = object : CountUpTimer.TickListener {
|
||||
override fun onTick(milliseconds: Long) {
|
||||
holder.itemLastUpdatedAtTextView.text = getFormattedLastUpdatedAt(locationUpdateTimeMillis)
|
||||
}
|
||||
holder.timer.tickListener = object : CountUpTimer.TickListener {
|
||||
override fun onTick(milliseconds: Long) {
|
||||
holder.itemLastUpdatedAtTextView.text = getFormattedLastUpdatedAt(locationUpdateTimeMillis)
|
||||
}
|
||||
resume()
|
||||
}
|
||||
holder.timer.resume()
|
||||
|
||||
holder.view.setOnClickListener { callback?.onUserSelected(matrixItem.id) }
|
||||
}
|
||||
|
@ -98,8 +95,7 @@ abstract class LiveLocationUserItem : VectorEpoxyModel<LiveLocationUserItem.Hold
|
|||
}
|
||||
|
||||
private fun stopTimer(holder: Holder) {
|
||||
holder.timer?.stop()
|
||||
holder.timer = null
|
||||
holder.timer.stop()
|
||||
}
|
||||
|
||||
private fun getFormattedLastUpdatedAt(locationUpdateTimeMillis: Long?): String {
|
||||
|
@ -111,7 +107,7 @@ abstract class LiveLocationUserItem : VectorEpoxyModel<LiveLocationUserItem.Hold
|
|||
}
|
||||
|
||||
class Holder : VectorEpoxyHolder() {
|
||||
var timer: CountUpTimer? = null
|
||||
val timer: CountUpTimer = CountUpTimer(1000)
|
||||
val itemUserAvatarImageView by bind<ImageView>(R.id.itemUserAvatarImageView)
|
||||
val itemUserDisplayNameTextView by bind<TextView>(R.id.itemUserDisplayNameTextView)
|
||||
val itemRemainingTimeTextView by bind<TextView>(R.id.itemRemainingTimeTextView)
|
||||
|
|
Loading…
Reference in New Issue