[Android] Video Player : modify NavMenu button to be consistent with others

Alexandre Perraud git at videolan.org
Wed Nov 25 18:36:12 CET 2015


vlc-ports/android | branch: master | Alexandre Perraud <4leyx4ndre at gmail.com> | Wed Nov 25 17:14:30 2015 +0100| [ab0895158b1caf1efb97be82d47266d9438bddd6] | committer: Alexandre Perraud

Video Player : modify NavMenu button to be consistent with others

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=ab0895158b1caf1efb97be82d47266d9438bddd6
---

 .../drawable-hdpi/ic_navmenu_circle_normal_o.png   |  Bin 1548 -> 1697 bytes
 .../drawable-hdpi/ic_navmenu_circle_pressed_o.png  |  Bin 1355 -> 1541 bytes
 .../drawable-ldpi/ic_navmenu_circle_normal_o.png   |  Bin 753 -> 833 bytes
 .../drawable-ldpi/ic_navmenu_circle_pressed_o.png  |  Bin 670 -> 769 bytes
 .../drawable-mdpi/ic_navmenu_circle_normal_o.png   |  Bin 1056 -> 1203 bytes
 .../drawable-mdpi/ic_navmenu_circle_pressed_o.png  |  Bin 931 -> 1092 bytes
 .../drawable-xhdpi/ic_navmenu_circle_normal_o.png  |  Bin 2006 -> 2231 bytes
 .../drawable-xhdpi/ic_navmenu_circle_pressed_o.png |  Bin 1763 -> 2012 bytes
 vlc-android/res/layout/player_hud.xml              |   11 +++++
 vlc-android/res/menu/video_player.xml              |    7 ----
 .../vlc/gui/video/VideoPlayerActivity.java         |   42 +++++++++-----------
 11 files changed, 29 insertions(+), 31 deletions(-)

diff --git a/vlc-android/res/drawable-hdpi/ic_navmenu_circle_normal_o.png b/vlc-android/res/drawable-hdpi/ic_navmenu_circle_normal_o.png
index e1459f3..b505b68 100644
Binary files a/vlc-android/res/drawable-hdpi/ic_navmenu_circle_normal_o.png and b/vlc-android/res/drawable-hdpi/ic_navmenu_circle_normal_o.png differ
diff --git a/vlc-android/res/drawable-hdpi/ic_navmenu_circle_pressed_o.png b/vlc-android/res/drawable-hdpi/ic_navmenu_circle_pressed_o.png
index 9a524ca..fbea406 100644
Binary files a/vlc-android/res/drawable-hdpi/ic_navmenu_circle_pressed_o.png and b/vlc-android/res/drawable-hdpi/ic_navmenu_circle_pressed_o.png differ
diff --git a/vlc-android/res/drawable-ldpi/ic_navmenu_circle_normal_o.png b/vlc-android/res/drawable-ldpi/ic_navmenu_circle_normal_o.png
index 045f22f..706f7a7 100644
Binary files a/vlc-android/res/drawable-ldpi/ic_navmenu_circle_normal_o.png and b/vlc-android/res/drawable-ldpi/ic_navmenu_circle_normal_o.png differ
diff --git a/vlc-android/res/drawable-ldpi/ic_navmenu_circle_pressed_o.png b/vlc-android/res/drawable-ldpi/ic_navmenu_circle_pressed_o.png
index a7ee945..ec00962 100644
Binary files a/vlc-android/res/drawable-ldpi/ic_navmenu_circle_pressed_o.png and b/vlc-android/res/drawable-ldpi/ic_navmenu_circle_pressed_o.png differ
diff --git a/vlc-android/res/drawable-mdpi/ic_navmenu_circle_normal_o.png b/vlc-android/res/drawable-mdpi/ic_navmenu_circle_normal_o.png
index a2f38c6..2dbd86a 100644
Binary files a/vlc-android/res/drawable-mdpi/ic_navmenu_circle_normal_o.png and b/vlc-android/res/drawable-mdpi/ic_navmenu_circle_normal_o.png differ
diff --git a/vlc-android/res/drawable-mdpi/ic_navmenu_circle_pressed_o.png b/vlc-android/res/drawable-mdpi/ic_navmenu_circle_pressed_o.png
index 52b96b1..1736d97 100644
Binary files a/vlc-android/res/drawable-mdpi/ic_navmenu_circle_pressed_o.png and b/vlc-android/res/drawable-mdpi/ic_navmenu_circle_pressed_o.png differ
diff --git a/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_normal_o.png b/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_normal_o.png
index 1c70c51..e0685fd 100644
Binary files a/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_normal_o.png and b/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_normal_o.png differ
diff --git a/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_pressed_o.png b/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_pressed_o.png
index b971b57..05d3692 100644
Binary files a/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_pressed_o.png and b/vlc-android/res/drawable-xhdpi/ic_navmenu_circle_pressed_o.png differ
diff --git a/vlc-android/res/layout/player_hud.xml b/vlc-android/res/layout/player_hud.xml
index 5f7795c..2e61de6 100644
--- a/vlc-android/res/layout/player_hud.xml
+++ b/vlc-android/res/layout/player_hud.xml
@@ -118,6 +118,17 @@
             android:visibility="gone" />
 
         <ImageView
+            android:id="@+id/player_overlay_navmenu"
+            android:layout_width="0dp"
+            android:layout_height="match_parent"
+            android:layout_weight="1"
+            android:clickable="true"
+            android:src="@drawable/ic_navmenu_circle"
+            android:scaleType="center"
+            android:focusable="true"
+            android:visibility="gone" />
+
+        <ImageView
             android:id="@+id/player_overlay_adv_function"
             android:layout_width="0dp"
             android:layout_height="match_parent"
diff --git a/vlc-android/res/menu/video_player.xml b/vlc-android/res/menu/video_player.xml
deleted file mode 100644
index c02c740..0000000
--- a/vlc-android/res/menu/video_player.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:id="@+id/pl_menu_nav"
-        android:icon="@drawable/ic_navmenu_circle"
-        android:title="@string/navmenu" />
-</menu>
diff --git a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
index c81357b..9f76966 100644
--- a/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/video/VideoPlayerActivity.java
@@ -214,6 +214,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
     private ImageView mTipsBackground;
     private ImageView mPlayPause;
     private ImageView mTracks;
+    private ImageView mNavMenu;
     private ImageView mRewind;
     private ImageView mForward;
     private ImageView mAdvOptions;
@@ -397,6 +398,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
 
         mSize = (ImageView) findViewById(R.id.player_overlay_size);
 
+        mNavMenu = (ImageView) findViewById(R.id.player_overlay_navmenu);
+
         if (mSettings.getBoolean("enable_seek_buttons", false))
             initSeekButton();
 
@@ -469,30 +472,6 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         resetHudLayout();
     }
 
-    public boolean onCreateOptionsMenu(Menu menu){
-        getMenuInflater().inflate(R.menu.video_player, menu);
-        return super.onCreateOptionsMenu(menu);
-    }
-
-    public boolean onPrepareOptionsMenu(Menu menu){
-        MenuItem item = menu.findItem(R.id.pl_menu_nav);
-        if (item != null) {
-            item.setVisible(mMenuIdx >= 0 && !mIsNavMenu);
-            MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM);
-        }
-        return super.onPrepareOptionsMenu(menu);
-    }
-
-    public boolean onOptionsItemSelected(MenuItem item){
-        switch (item.getItemId()) {
-            case R.id.pl_menu_nav:
-                showNavMenu();
-                return true;
-            default:
-                return super.onOptionsItemSelected(item);
-        }
-    }
-
     @Override
     protected void onResume() {
         super.onResume();
@@ -508,6 +487,7 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         mLength.setOnClickListener(mRemainingTimeListener);
         mTime.setOnClickListener(mRemainingTimeListener);
         mSize.setOnClickListener(mSizeListener);
+        mNavMenu.setOnClickListener(mNavMenuListener);
 
         if (mIsLocked && mScreenOrientation == ActivityInfo.SCREEN_ORIENTATION_SENSOR)
             setRequestedOrientation(mScreenOrientationLock);
@@ -2270,6 +2250,14 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
         }
     };
 
+    private final OnClickListener mNavMenuListener = new OnClickListener() {
+
+        @Override
+        public void onClick(View v) {
+            showNavMenu();
+        }
+    };
+
     private void resizeVideo() {
         if (mCurrentSize < SURFACE_ORIGINAL) {
             mCurrentSize++;
@@ -2365,6 +2353,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     mRewind.setVisibility(View.VISIBLE);
                 if (mForward != null)
                     mForward.setVisibility(View.VISIBLE);
+                if (mMenuIdx >= 0 && mNavMenu != null)
+                    mNavMenu.setVisibility(View.VISIBLE);
             }
             dimStatusBar(false);
             mOverlayProgress.setVisibility(View.VISIBLE);
@@ -2397,6 +2387,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                     mRewind.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
                 if (mForward != null)
                     mForward.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
+                if (mMenuIdx >= 0 && mNavMenu != null)
+                    mNavMenu.startAnimation(AnimationUtils.loadAnimation(this, android.R.anim.fade_out));
             } else
                 mSize.setVisibility(View.INVISIBLE);
             if (mPresentation != null) {
@@ -2414,6 +2406,8 @@ public class VideoPlayerActivity extends AppCompatActivity implements IVLCVout.C
                 mRewind.setVisibility(View.INVISIBLE);
             if (mForward != null)
                 mForward.setVisibility(View.INVISIBLE);
+            if (mMenuIdx >= 0 && mNavMenu != null)
+                mNavMenu.setVisibility(View.INVISIBLE);
             mShowing = false;
             dimStatusBar(true);
         } else if (!fromUser) {



More information about the Android mailing list