[Android] Add STOP media button in TV audio player

Geoffrey Métais git at videolan.org
Fri Jul 17 15:43:34 CEST 2015


vlc-ports/android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Jul 17 15:43:00 2015 +0200| [794878ca28435f6a5796b0ff1f708a27623c2680] | committer: Geoffrey Métais

Add STOP media button in TV audio player

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

 .../videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java   |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
index ed91140..ff011df 100644
--- a/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
+++ b/vlc-android/tv/src/org/videolan/vlc/gui/tv/audioplayer/AudioPlayerActivity.java
@@ -199,6 +199,9 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
             case KeyEvent.KEYCODE_SPACE:
                 togglePlayPause();
                 return true;
+            case KeyEvent.KEYCODE_MEDIA_STOP:
+                pause();
+                return true;
             case KeyEvent.KEYCODE_F:
             case KeyEvent.KEYCODE_BUTTON_R1:
             case KeyEvent.KEYCODE_MEDIA_NEXT:
@@ -356,6 +359,11 @@ public class AudioPlayerActivity extends BaseTvActivity implements PlaybackServi
             mService.play();
     }
 
+    private void pause() {
+        if (mService != null && mService.isPlaying())
+            mService.pause();
+    }
+
     private void selectNext() {
         if (mAdapter.getmSelectedItem() >= mAdapter.getItemCount()-1)
             return;



More information about the Android mailing list