[Android] Fix history clean menu appearance
Nicolas Pomepuy
git at videolan.org
Mon Jul 29 16:37:10 CEST 2019
vlc-android | branch: 3.2.x | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Fri Jul 26 13:03:26 2019 +0200| [4729705c8ec10d21e75d57c0209afd124c3b6f39] | committer: Geoffrey Métais
Fix history clean menu appearance
(cherry picked from commit 99c33ae0a7c944d0823bfe5a5fc4109710bbe4cd)
> https://code.videolan.org/videolan/vlc-android/commit/4729705c8ec10d21e75d57c0209afd124c3b6f39
---
vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
index 075d0550c..2e4896017 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.kt
@@ -52,6 +52,7 @@ private const val TAG = "VLC/HistoryFragment"
@ExperimentalCoroutinesApi
class HistoryFragment : MediaBrowserFragment<HistoryModel>(), IRefreshable, IHistory, SwipeRefreshLayout.OnRefreshListener, IEventsHandler {
+ private lateinit var cleanMenuItem: MenuItem
private lateinit var multiSelectHelper: MultiSelectHelper<AbstractMediaWrapper>
private val historyAdapter: HistoryAdapter = HistoryAdapter(this)
@@ -67,6 +68,9 @@ class HistoryFragment : MediaBrowserFragment<HistoryModel>(), IRefreshable, IHis
list?.let {
historyAdapter.update(it)
updateEmptyView()
+ if (::cleanMenuItem.isInitialized) {
+ cleanMenuItem.isVisible = !isEmpty()
+ }
}
})
viewModel.loading.observe(this, Observer {
@@ -100,7 +104,8 @@ class HistoryFragment : MediaBrowserFragment<HistoryModel>(), IRefreshable, IHis
}
override fun onPrepareOptionsMenu(menu: Menu) {
- menu.findItem(R.id.ml_menu_clean).isVisible = !isEmpty()
+ cleanMenuItem = menu.findItem(R.id.ml_menu_clean)
+ cleanMenuItem.isVisible = !isEmpty()
super.onPrepareOptionsMenu(menu)
}
More information about the Android
mailing list