[Android] Handle search button on TV

Geoffrey Métais git at videolan.org
Thu Jul 9 16:07:48 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Jul  9 16:07:27 2015 +0200| [11fb0486aa44ef3976aafc5004330c3e51cda503] | committer: Geoffrey Métais

Handle search button on TV

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

 .../src/org/videolan/vlc/gui/PlaybackServiceActivity.java   |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java b/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
index 179e84e..529d9d0 100644
--- a/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/PlaybackServiceActivity.java
@@ -33,10 +33,12 @@ import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.support.annotation.MainThread;
+import android.view.KeyEvent;
 
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.VLCApplication;
+import org.videolan.vlc.gui.tv.SearchActivity;
 import org.videolan.vlc.util.WeakHandler;
 
 import java.util.ArrayList;
@@ -84,6 +86,15 @@ public abstract class PlaybackServiceActivity extends Activity implements Playba
         mHelper.onStop();
     }
 
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        if (keyCode == KeyEvent.KEYCODE_SEARCH){
+            startActivity(new Intent(this, SearchActivity.class));
+            return true;
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
     public Helper getHelper() {
         return mHelper;
     }



More information about the Android mailing list