[Android] Do not filter DOWN remote input events
Geoffrey Métais
git at videolan.org
Fri Mar 30 16:51:30 CEST 2018
vlc-android | branch: 3.0.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Tue Mar 27 11:13:03 2018 +0200| [7b6bccf54991b605aef4ba4298812194266439e0] | committer: Geoffrey Métais
Do not filter DOWN remote input events
Close #526
(cherry picked from commit d533f129667e649de7d7ccfb015652a6992ffea1)
> https://code.videolan.org/videolan/vlc-android/commit/7b6bccf54991b605aef4ba4298812194266439e0
---
vlc-android/src/org/videolan/vlc/PlaybackService.java | 11 +++++------
.../src/org/videolan/vlc/RemoteControlClientReceiver.java | 6 ++----
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 44c18d9e6..92931f089 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -115,8 +115,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
private static final int SHOW_TOAST = 1;
private static final int END_MEDIASESSION = 2;
- private static final int DELAY_DOUBLE_CLICK = 800;
- private static final int DELAY_LONG_CLICK = 1000;
+ private static final long DELAY_DOUBLE_CLICK = 800L;
+ private static final long DELAY_LONG_CLICK = 1000L;
public interface Callback {
void update();
@@ -803,8 +803,8 @@ public class PlaybackService extends MediaBrowserServiceCompat{
}
private final class MediaSessionCallback extends MediaSessionCompat.Callback {
- private long mHeadsetDownTime = 0;
- private long mHeadsetUpTime = 0;
+ private long mHeadsetDownTime = 0L;
+ private long mHeadsetUpTime = 0L;
@Override
public boolean onMediaButtonEvent(Intent mediaButtonEvent) {
@@ -817,8 +817,7 @@ public class PlaybackService extends MediaBrowserServiceCompat{
final long time = SystemClock.uptimeMillis();
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
- if (event.getRepeatCount() <= 0)
- mHeadsetDownTime = time;
+ if (event.getRepeatCount() <= 0) mHeadsetDownTime = time;
if (!hasMedia()) {
loadLastAudioPlaylist();
return true;
diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
index 2981db338..65302b48e 100644
--- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
+++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
@@ -49,8 +49,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
if (event != null && action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
if (event.getKeyCode() != KeyEvent.KEYCODE_HEADSETHOOK &&
- event.getKeyCode() != KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE &&
- event.getAction() != KeyEvent.ACTION_DOWN) {
+ event.getKeyCode() != KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE) {
super.onReceive(context, intent);
return;
}
@@ -103,8 +102,7 @@ public class RemoteControlClientReceiver extends MediaButtonReceiver {
break;
}
- if (isOrderedBroadcast())
- abortBroadcast();
+ if (isOrderedBroadcast()) abortBroadcast();
if (i != null) {
Util.startService(context, i);
return;
More information about the Android
mailing list