[Android] Hide options menu on TV

Geoffrey Métais git at videolan.org
Thu May 24 18:12:22 CEST 2018


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu May 24 18:11:27 2018 +0200| [d4840a57c0d5f7a475132bcd9a4f13a0ab14377a] | committer: Geoffrey Métais

Hide options menu on TV

> https://code.videolan.org/videolan/vlc-android/commit/d4840a57c0d5f7a475132bcd9a4f13a0ab14377a
---

 vlc-android/src/org/videolan/vlc/gui/ContentActivity.java         | 5 ++---
 .../src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java    | 8 +-------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
index f60087a45..d5bc7519e 100644
--- a/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/ContentActivity.java
@@ -90,6 +90,7 @@ public class ContentActivity extends AudioPlayerContainerActivity implements Sea
 
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
+        if (AndroidDevices.isAndroidTv) return false;
         if (getSupportFragmentManager().findFragmentById(R.id.fragment_placeholder) instanceof AboutFragment)
             return true;
         getMenuInflater().inflate(R.menu.activity_option, menu);
@@ -103,9 +104,7 @@ public class ContentActivity extends AudioPlayerContainerActivity implements Sea
             mSearchView.setQueryHint(getString(R.string.search_list_hint));
             mSearchView.setOnQueryTextListener(this);
             searchItem.setOnActionExpandListener(this);
-        }
-        else
-            menu.findItem(R.id.ml_menu_filter).setVisible(false);
+        } else menu.findItem(R.id.ml_menu_filter).setVisible(false);
         menu.findItem(R.id.ml_menu_renderers).setVisible(showRenderers);
         menu.findItem(R.id.ml_menu_renderers).setIcon(!RendererDelegate.INSTANCE.hasRenderer() ? R.drawable.ic_am_renderer_normal_w : R.drawable.ic_am_renderer_on_w);
         return super.onCreateOptionsMenu(menu);
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
index 8ceeb4326..42a39cc58 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/MediaBrowserFragment.java
@@ -38,7 +38,6 @@ import android.support.v7.app.AppCompatActivity;
 import android.support.v7.view.ActionMode;
 import android.view.ContextMenu;
 import android.view.Menu;
-import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 
@@ -85,7 +84,7 @@ public abstract class MediaBrowserFragment<T extends BaseModel> extends Fragment
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         mMediaLibrary = VLCApplication.getMLInstance();
-        setHasOptionsMenu(true);
+        setHasOptionsMenu(!AndroidDevices.isAndroidTv);
     }
 
     @Override
@@ -221,11 +220,6 @@ public abstract class MediaBrowserFragment<T extends BaseModel> extends Fragment
         startActivity(i);
     }
 
-    @Override
-    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        super.onCreateOptionsMenu(menu, inflater);
-    }
-
     @Override
     public void onPrepareOptionsMenu(Menu menu) {
         super.onPrepareOptionsMenu(menu);



More information about the Android mailing list