[Android] Prevent crash on Android 2.x

Geoffrey Métais git at videolan.org
Tue Nov 4 17:59:53 CET 2014


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Nov  4 17:48:22 2014 +0100| [3c3890938c8e013edb817eaaa9ab0b3ad65ef72d] | committer: Geoffrey Métais

Prevent crash on Android 2.x

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

 vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java |    3 ++-
 vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java       |    4 +++-
 vlc-android/src/org/videolan/vlc/gui/MainActivity.java          |    6 +++---
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
index 5bf6037..b46096d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/DirectoryViewFragment.java
@@ -104,7 +104,8 @@ public class DirectoryViewFragment extends ListFragment implements IRefreshable,
         listView.setNextFocusUpId(R.id.ml_menu_search);
         listView.setNextFocusLeftId(android.R.id.list);
         listView.setNextFocusRightId(android.R.id.list);
-        listView.setNextFocusForwardId(android.R.id.list);
+        if (LibVlcUtil.isHoneycombOrLater())
+            listView.setNextFocusForwardId(android.R.id.list);
         focusHelper(mDirectoryAdapter.getCount() == 0);
         listView.requestFocus();
         listView.setOnItemLongClickListener(new OnItemLongClickListener() {
diff --git a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
index b32814c..a9d0fe3 100644
--- a/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/HistoryFragment.java
@@ -21,6 +21,7 @@
 package org.videolan.vlc.gui;
 
 import org.videolan.libvlc.LibVLC;
+import org.videolan.libvlc.LibVlcUtil;
 import org.videolan.vlc.R;
 import org.videolan.vlc.audio.AudioServiceController;
 import org.videolan.vlc.interfaces.IRefreshable;
@@ -75,7 +76,8 @@ public class HistoryFragment extends ListFragment implements IRefreshable {
         listView.setNextFocusUpId(R.id.ml_menu_search);
         listView.setNextFocusLeftId(android.R.id.list);
         listView.setNextFocusRightId(android.R.id.list);
-        listView.setNextFocusForwardId(android.R.id.list);
+        if (LibVlcUtil.isHoneycombOrLater())
+            listView.setNextFocusForwardId(android.R.id.list);
         focusHelper(mHistoryAdapter.getCount() == 0);
         listView.requestFocus();
         registerForContextMenu(listView);
diff --git a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
index 649eb16..d07db27 100644
--- a/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/MainActivity.java
@@ -772,15 +772,15 @@ public class MainActivity extends ActionBarActivity {
             (v.getNextFocusDownId() == -1) &&
             (v.getNextFocusUpId() == -1) &&
             (v.getNextFocusLeftId() == -1) &&
-            (v.getNextFocusRightId() == -1) &&
-            (v.getNextFocusForwardId() == -1)) {
+            (v.getNextFocusRightId() == -1)) {
             mActionBarIconId = Util.generateViewId();
             v.setId(mActionBarIconId);
             v.setNextFocusUpId(mActionBarIconId);
             v.setNextFocusDownId(mActionBarIconId);
             v.setNextFocusLeftId(mActionBarIconId);
             v.setNextFocusRightId(R.id.ml_menu_search);
-            v.setNextFocusForwardId(mActionBarIconId);
+            if (LibVlcUtil.isHoneycombOrLater())
+                v.setNextFocusForwardId(mActionBarIconId);
             findViewById(R.id.ml_menu_search).setNextFocusLeftId(
                 mActionBarIconId);
         }



More information about the Android mailing list