[Android] RemoteControlClientReceiver: Remove redundant check

Ludovic Fauvet git at videolan.org
Thu Nov 1 13:30:21 CET 2012


vlc-ports/android | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Oct 31 10:57:22 2012 +0100| [d18fe163775ae716c6f776d4193a61d2693ddaea] | committer: Ludovic Fauvet

RemoteControlClientReceiver: Remove redundant check

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

 .../videolan/vlc/RemoteControlClientReceiver.java  |   46 ++++++++++----------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
index 9a07b1e..3df95b1 100644
--- a/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
+++ b/vlc-android/src/org/videolan/vlc/RemoteControlClientReceiver.java
@@ -44,32 +44,30 @@ public class RemoteControlClientReceiver extends BroadcastReceiver {
             return;
 
         if(action.equalsIgnoreCase(Intent.ACTION_MEDIA_BUTTON)) {
-            if (intent.getAction().equals(Intent.ACTION_MEDIA_BUTTON)) {
-                KeyEvent keyEvent = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT);
-                if (keyEvent.getAction() != KeyEvent.ACTION_DOWN)
-                    return;
+            KeyEvent keyEvent = (KeyEvent) intent.getExtras().get(Intent.EXTRA_KEY_EVENT);
+            if (keyEvent.getAction() != KeyEvent.ACTION_DOWN)
+                return;
 
-                Intent i = null;
-                switch (keyEvent.getKeyCode()) {
-                    case KeyEvent.KEYCODE_HEADSETHOOK:
-                    case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-                    case KeyEvent.KEYCODE_MEDIA_PLAY:
-                    case KeyEvent.KEYCODE_MEDIA_PAUSE:
-                        i = new Intent(AudioService.ACTION_WIDGET_PLAY);
-                        break;
-                    case KeyEvent.KEYCODE_MEDIA_STOP:
-                        i = new Intent(AudioService.ACTION_WIDGET_STOP);
-                        break;
-                    case KeyEvent.KEYCODE_MEDIA_NEXT:
-                        i = new Intent(AudioService.ACTION_WIDGET_FORWARD);
-                        break;
-                    case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
-                        i = new Intent(AudioService.ACTION_WIDGET_BACKWARD);
-                        break;
-                }
-                if(i != null)
-                    context.sendBroadcast(i);
+            Intent i = null;
+            switch (keyEvent.getKeyCode()) {
+                case KeyEvent.KEYCODE_HEADSETHOOK:
+                case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+                case KeyEvent.KEYCODE_MEDIA_PLAY:
+                case KeyEvent.KEYCODE_MEDIA_PAUSE:
+                    i = new Intent(AudioService.ACTION_WIDGET_PLAY);
+                    break;
+                case KeyEvent.KEYCODE_MEDIA_STOP:
+                    i = new Intent(AudioService.ACTION_WIDGET_STOP);
+                    break;
+                case KeyEvent.KEYCODE_MEDIA_NEXT:
+                    i = new Intent(AudioService.ACTION_WIDGET_FORWARD);
+                    break;
+                case KeyEvent.KEYCODE_MEDIA_PREVIOUS:
+                    i = new Intent(AudioService.ACTION_WIDGET_BACKWARD);
+                    break;
             }
+            if(i != null)
+                context.sendBroadcast(i);
         }
     }
 }



More information about the Android mailing list