[Android] Fix storage fragment toolbar icons not working
Nicolas Pomepuy
git at videolan.org
Tue Sep 28 07:00:19 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Sep 28 08:31:57 2021 +0200| [32a20b760b85478c60541a40311e9296e40e4d8c] | committer: Nicolas Pomepuy
Fix storage fragment toolbar icons not working
Also fixes the crash introduced in !1100
Also avoids displaying the renderer icon on the storage fragment as it's useless here
> https://code.videolan.org/videolan/vlc-android/commit/32a20b760b85478c60541a40311e9296e40e4d8c
---
application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt | 2 +-
application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt | 4 ++--
application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt | 4 ----
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
index 1f9dba8a4..9f7df1094 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/BaseFragment.kt
@@ -50,7 +50,7 @@ abstract class BaseFragment : Fragment(), ActionMode.Callback {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setHasOptionsMenu(!AndroidDevices.isAndroidTv)
+ setHasOptionsMenu(true)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
index 43f04341e..fd8b9312c 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/ContentActivity.kt
@@ -39,6 +39,7 @@ import org.videolan.vlc.PlaybackService
import org.videolan.vlc.R
import org.videolan.vlc.RendererDelegate
import org.videolan.vlc.gui.browser.ExtensionBrowser
+import org.videolan.vlc.gui.browser.MLStorageBrowserFragment
import org.videolan.vlc.gui.dialogs.RenderersDialog
import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.interfaces.Filterable
@@ -77,7 +78,6 @@ open class ContentActivity : AudioPlayerContainerActivity(), SearchView.OnQueryT
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
- if (AndroidDevices.isAndroidTv) return false
val current = currentFragment
super.onCreateOptionsMenu(menu)
if (current is AboutFragment) return true
@@ -104,7 +104,7 @@ open class ContentActivity : AudioPlayerContainerActivity(), SearchView.OnQueryT
searchItem.setOnActionExpandListener(this)
} else
menu.findItem(R.id.ml_menu_filter).isVisible = false
- menu.findItem(R.id.ml_menu_renderers).isVisible = !hideRenderers() && showRenderers && Settings.getInstance(this).getBoolean("enable_casting", true)
+ menu.findItem(R.id.ml_menu_renderers).isVisible = current !is MLStorageBrowserFragment && !hideRenderers() && showRenderers && Settings.getInstance(this).getBoolean("enable_casting", true)
menu.findItem(R.id.ml_menu_renderers).setIcon(if (!PlaybackService.hasRenderer()) R.drawable.ic_am_renderer else R.drawable.ic_am_renderer_on)
return true
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt b/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
index f7d2a6a57..ac879f08b 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/SecondaryActivity.kt
@@ -138,10 +138,6 @@ class SecondaryActivity : ContentActivity(), IDialogManager {
}
}
- override fun onCreateOptionsMenu(menu: Menu): Boolean {
- return true
- }
-
override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
menu?.findItem(R.id.ml_menu_refresh)?.isVisible = Permissions.canReadStorage(this)
return super.onPrepareOptionsMenu(menu)
More information about the Android
mailing list