[Android] Workaround for LG Firmware bug with menu button

Geoffrey Métais git at videolan.org
Tue Mar 3 10:17:39 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar  3 09:58:53 2015 +0100| [c4ade9fe04eb244dde2eb4f4994ba3789f93f5f0] | committer: Geoffrey Métais

Workaround for LG Firmware bug with menu button

Found here: https://code.google.com/p/android/issues/detail?id=78154

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

 NEWS                                                   |    2 ++
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java |   13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/NEWS b/NEWS
index 10f14a9..6884ebd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 Changes between 1.1.2 and 1.1.3-git:
 --------------------------------
 
+Main Application:
+ * Fix LG bug with menu button
 
 Changes between 1.1.1 and 1.1.2:
 --------------------------------
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 49545a6..9aa6c9c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -733,6 +733,12 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
     // Note. onKeyDown will not occur while moving within a list
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
+        //Filter for LG devices, see https://code.google.com/p/android/issues/detail?id=78154
+        if ((keyCode == KeyEvent.KEYCODE_MENU) &&
+                (Build.VERSION.SDK_INT <= 16) &&
+                (Build.MANUFACTURER.compareTo("LGE") == 0)) {
+            return true;
+        }
         if (mFocusedPrior == 0)
             setMenuFocusDown(true, 0);
         if (getCurrentFocus() != null)
@@ -744,6 +750,13 @@ public class MainActivity extends ActionBarActivity implements OnItemClickListen
     @TargetApi(Build.VERSION_CODES.HONEYCOMB)
     @Override
     public boolean onKeyUp(int keyCode, KeyEvent event) {
+        //Filter for LG devices, see https://code.google.com/p/android/issues/detail?id=78154
+        if ((keyCode == KeyEvent.KEYCODE_MENU) &&
+                (Build.VERSION.SDK_INT <= 16) &&
+                (Build.MANUFACTURER.compareTo("LGE") == 0)) {
+            openOptionsMenu();
+            return true;
+        }
 		View v = getCurrentFocus();
         if (v == null)
             return super.onKeyUp(keyCode, event);



More information about the Android mailing list