[Android] Simpler search trigger

Geoffrey Métais git at videolan.org
Thu Nov 12 14:53:54 CET 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Nov 12 14:53:17 2015 +0100| [abc00bfb0d755ee323106bba78a873344579e8d2] | committer: Geoffrey Métais

Simpler search trigger

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

 .../tv/src/org/videolan/vlc/gui/tv/SearchActivity.java   |   14 +++++---------
 .../tv/src/org/videolan/vlc/gui/tv/SearchFragment.java   |   14 +++++++-------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchActivity.java b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchActivity.java
index 7a7688d..9f33781 100644
--- a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchActivity.java
+++ b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchActivity.java
@@ -20,12 +20,11 @@
  *****************************************************************************/
 package org.videolan.vlc.gui.tv;
 
-import org.videolan.vlc.R;
-
 import android.app.Activity;
 import android.os.Bundle;
 import android.support.v17.leanback.widget.SpeechRecognitionCallback;
-import android.view.KeyEvent;
+
+import org.videolan.vlc.R;
 
 public class SearchActivity extends Activity {
 
@@ -51,11 +50,8 @@ public class SearchActivity extends Activity {
     }
 
     @Override
-    public boolean onKeyDown(int keyCode, KeyEvent event) {
-        if (keyCode == KeyEvent.KEYCODE_SEARCH) {
-            mFragment.startRecognition();
-            return true;
-        }
-        return super.onKeyDown(keyCode, event);
+    public boolean onSearchRequested() {
+        mFragment.startRecognition();
+        return true;
     }
 }
diff --git a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
index e283846..e5b4176 100644
--- a/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
+++ b/vlc-android/flavors/tv/src/org/videolan/vlc/gui/tv/SearchFragment.java
@@ -20,13 +20,6 @@
  *****************************************************************************/
 package org.videolan.vlc.gui.tv;
 
-import java.util.ArrayList;
-
-import org.videolan.vlc.media.MediaLibrary;
-import org.videolan.vlc.media.MediaWrapper;
-import org.videolan.vlc.R;
-import org.videolan.vlc.VLCApplication;
-
 import android.app.Activity;
 import android.os.Bundle;
 import android.os.Handler;
@@ -41,6 +34,13 @@ import android.support.v17.leanback.widget.Row;
 import android.support.v17.leanback.widget.RowPresenter;
 import android.text.TextUtils;
 
+import org.videolan.vlc.R;
+import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.media.MediaLibrary;
+import org.videolan.vlc.media.MediaWrapper;
+
+import java.util.ArrayList;
+
 public class SearchFragment extends android.support.v17.leanback.app.SearchFragment
         implements android.support.v17.leanback.app.SearchFragment.SearchResultProvider {
 



More information about the Android mailing list