Remove appbar offset listener when call log is unbound.
This commit is contained in:
parent
7f1227ee19
commit
d0baf1dc95
1 changed files with 10 additions and 2 deletions
|
@ -80,8 +80,13 @@ class CallLogFragment : Fragment(R.layout.call_log_fragment), CallLogAdapter.Cal
|
||||||
private val TAG = Log.tag(CallLogFragment::class.java)
|
private val TAG = Log.tag(CallLogFragment::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var filterViewOffsetChangeListener: AppBarLayout.OnOffsetChangedListener? = null
|
||||||
|
|
||||||
private val viewModel: CallLogViewModel by activityViewModels()
|
private val viewModel: CallLogViewModel by activityViewModels()
|
||||||
private val binding: CallLogFragmentBinding by ViewBinderDelegate(CallLogFragmentBinding::bind)
|
private val binding: CallLogFragmentBinding by ViewBinderDelegate(CallLogFragmentBinding::bind) {
|
||||||
|
binding.recyclerCoordinatorAppBar.removeOnOffsetChangedListener(filterViewOffsetChangeListener)
|
||||||
|
}
|
||||||
|
|
||||||
private val disposables = LifecycleDisposable()
|
private val disposables = LifecycleDisposable()
|
||||||
private val callLogContextMenu = CallLogContextMenu(this, this)
|
private val callLogContextMenu = CallLogContextMenu(this, this)
|
||||||
private val callLogActionMode = CallLogActionMode(CallLogActionModeCallback())
|
private val callLogActionMode = CallLogActionMode(CallLogActionModeCallback())
|
||||||
|
@ -328,11 +333,14 @@ class CallLogFragment : Fragment(R.layout.call_log_fragment), CallLogAdapter.Cal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.recyclerCoordinatorAppBar.addOnOffsetChangedListener { layout: AppBarLayout, verticalOffset: Int ->
|
filterViewOffsetChangeListener = AppBarLayout.OnOffsetChangedListener {
|
||||||
|
layout: AppBarLayout, verticalOffset: Int ->
|
||||||
val progress = 1 - verticalOffset.toFloat() / -layout.height
|
val progress = 1 - verticalOffset.toFloat() / -layout.height
|
||||||
binding.pullView.onUserDrag(progress)
|
binding.pullView.onUserDrag(progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.recyclerCoordinatorAppBar.addOnOffsetChangedListener(filterViewOffsetChangeListener)
|
||||||
|
|
||||||
if (viewModel.filterSnapshot != CallLogFilter.ALL) {
|
if (viewModel.filterSnapshot != CallLogFilter.ALL) {
|
||||||
binding.root.doAfterNextLayout {
|
binding.root.doAfterNextLayout {
|
||||||
binding.pullView.openImmediate()
|
binding.pullView.openImmediate()
|
||||||
|
|
Loading…
Add table
Reference in a new issue