[Android] Move RepeatType into PlaybackService

Thomas Guillem git at videolan.org
Wed May 27 17:58:03 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed May 27 17:57:35 2015 +0200| [c27f31a5370dcf79eb248b6b12867211d592a717] | committer: Thomas Guillem

Move RepeatType into PlaybackService

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

 .../src/org/videolan/vlc/PlaybackService.java      |    7 +++++-
 .../videolan/vlc/PlaybackServiceController.java    |    9 +++----
 .../src/org/videolan/vlc/audio/RepeatType.java     |   26 --------------------
 .../org/videolan/vlc/gui/audio/AudioPlayer.java    |    8 +++---
 .../vlc/interfaces/IAudioPlayerControl.java        |    6 ++---
 .../gui/tv/audioplayer/AudioPlayerActivity.java    |   16 ++++++------
 6 files changed, 25 insertions(+), 47 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/PlaybackService.java b/vlc-android/src/org/videolan/vlc/PlaybackService.java
index 2f06f79..1294576 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackService.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackService.java
@@ -61,7 +61,6 @@ import org.videolan.libvlc.LibVLC;
 import org.videolan.libvlc.LibVlcUtil;
 import org.videolan.libvlc.Media;
 import org.videolan.libvlc.MediaPlayer;
-import org.videolan.vlc.audio.RepeatType;
 import org.videolan.vlc.gui.MainActivity;
 import org.videolan.vlc.gui.AudioPlayerContainerActivity;
 import org.videolan.vlc.gui.audio.AudioUtil;
@@ -156,6 +155,12 @@ public class PlaybackService extends Service {
         return VLCInstance.getMainMediaPlayer();
     }
 
+    public static enum RepeatType {
+        None,
+        Once,
+        All
+    }
+
     @Override
     public void onCreate() {
         super.onCreate();
diff --git a/vlc-android/src/org/videolan/vlc/PlaybackServiceController.java b/vlc-android/src/org/videolan/vlc/PlaybackServiceController.java
index 8857548..60dd62f 100644
--- a/vlc-android/src/org/videolan/vlc/PlaybackServiceController.java
+++ b/vlc-android/src/org/videolan/vlc/PlaybackServiceController.java
@@ -31,7 +31,6 @@ import android.os.RemoteException;
 import android.preference.PreferenceManager;
 import android.util.Log;
 
-import org.videolan.vlc.audio.RepeatType;
 import org.videolan.vlc.interfaces.IAudioPlayer;
 import org.videolan.vlc.interfaces.IAudioPlayerControl;
 import org.videolan.vlc.interfaces.IAudioService;
@@ -500,7 +499,7 @@ public class PlaybackServiceController implements IAudioPlayerControl {
     }
 
     @Override
-    public void setRepeatType(RepeatType t) {
+    public void setRepeatType(PlaybackService.RepeatType t) {
         remoteProcedureCall(mAudioServiceBinder, Void.class, (Void)null, "setRepeatType",
                 new Class<?>[] { int.class },
                 new Object[] { t.ordinal() } );
@@ -512,9 +511,9 @@ public class PlaybackServiceController implements IAudioPlayerControl {
     }
 
     @Override
-    public RepeatType getRepeatType() {
-        return RepeatType.values()[
-            remoteProcedureCall(mAudioServiceBinder, int.class, RepeatType.None.ordinal(), "getRepeatType", null, null)
+    public PlaybackService.RepeatType getRepeatType() {
+        return PlaybackService.RepeatType.values()[
+            remoteProcedureCall(mAudioServiceBinder, int.class, PlaybackService.RepeatType.None.ordinal(), "getRepeatType", null, null)
         ];
     }
 
diff --git a/vlc-android/src/org/videolan/vlc/audio/RepeatType.java b/vlc-android/src/org/videolan/vlc/audio/RepeatType.java
deleted file mode 100644
index e44f9e4..0000000
--- a/vlc-android/src/org/videolan/vlc/audio/RepeatType.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*****************************************************************************
- * RepeatType.java
- *****************************************************************************
- * Copyright © 2012 VLC authors and VideoLAN
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-package org.videolan.vlc.audio;
-
-public enum RepeatType {
-    None,
-    Once,
-    All
-}
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
index 037374f..f13510d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayer.java
@@ -51,10 +51,10 @@ import android.widget.TextView;
 import android.widget.ViewSwitcher;
 
 import org.videolan.vlc.MediaWrapper;
+import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.PlaybackServiceController;
 import org.videolan.vlc.R;
 import org.videolan.vlc.VLCApplication;
-import org.videolan.vlc.audio.RepeatType;
 import org.videolan.vlc.gui.AudioPlayerContainerActivity;
 import org.videolan.vlc.gui.PreferencesActivity;
 import org.videolan.vlc.gui.audio.widget.CoverMediaSwitcher;
@@ -474,14 +474,14 @@ public class AudioPlayer extends Fragment implements IAudioPlayer, View.OnClickL
     public void onRepeatClick(View view) {
         switch (mAudioController.getRepeatType()) {
             case None:
-                mAudioController.setRepeatType(RepeatType.All);
+                mAudioController.setRepeatType(PlaybackService.RepeatType.All);
                 break;
             case All:
-                mAudioController.setRepeatType(RepeatType.Once);
+                mAudioController.setRepeatType(PlaybackService.RepeatType.Once);
                 break;
             default:
             case Once:
-                mAudioController.setRepeatType(RepeatType.None);
+                mAudioController.setRepeatType(PlaybackService.RepeatType.None);
                 break;
         }
         update();
diff --git a/vlc-android/src/org/videolan/vlc/interfaces/IAudioPlayerControl.java b/vlc-android/src/org/videolan/vlc/interfaces/IAudioPlayerControl.java
index 41f36b2..025a832 100644
--- a/vlc-android/src/org/videolan/vlc/interfaces/IAudioPlayerControl.java
+++ b/vlc-android/src/org/videolan/vlc/interfaces/IAudioPlayerControl.java
@@ -20,7 +20,7 @@
 
 package org.videolan.vlc.interfaces;
 
-import org.videolan.vlc.audio.RepeatType;
+import org.videolan.vlc.PlaybackService;
 
 import android.graphics.Bitmap;
 
@@ -69,9 +69,9 @@ public interface IAudioPlayerControl {
 
     boolean isShuffling();
 
-    void setRepeatType(RepeatType t);
+    void setRepeatType(PlaybackService.RepeatType t);
 
-    RepeatType getRepeatType();
+    PlaybackService.RepeatType getRepeatType();
 
     void detectHeadset(boolean enable);
 
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 1422f25..0614a11 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
@@ -25,9 +25,9 @@ import java.util.Collections;
 
 import org.videolan.vlc.MediaLibrary;
 import org.videolan.vlc.MediaWrapper;
+import org.videolan.vlc.PlaybackService;
 import org.videolan.vlc.PlaybackServiceController;
 import org.videolan.vlc.R;
-import org.videolan.vlc.audio.RepeatType;
 import org.videolan.vlc.gui.DividerItemDecoration;
 import org.videolan.vlc.gui.audio.AudioUtil;
 import org.videolan.vlc.gui.audio.MediaComparators;
@@ -282,15 +282,15 @@ public class AudioPlayerActivity extends Activity implements PlaybackServiceCont
     }
 
     private void updateRepeatMode() {
-        RepeatType type = mAudioController.getRepeatType();
-        if (type == RepeatType.None){
-            mAudioController.setRepeatType(RepeatType.All);
+        PlaybackService.RepeatType type = mAudioController.getRepeatType();
+        if (type == PlaybackService.RepeatType.None){
+            mAudioController.setRepeatType(PlaybackService.RepeatType.All);
             mRepeat.setImageResource(R.drawable.ic_repeat_on);
-        } else if (type == RepeatType.All) {
-            mAudioController.setRepeatType(RepeatType.Once);
+        } else if (type == PlaybackService.RepeatType.All) {
+            mAudioController.setRepeatType(PlaybackService.RepeatType.Once);
             mRepeat.setImageResource(R.drawable.ic_repeat_one);
-        } else if (type == RepeatType.Once) {
-            mAudioController.setRepeatType(RepeatType.None);
+        } else if (type == PlaybackService.RepeatType.Once) {
+            mAudioController.setRepeatType(PlaybackService.RepeatType.None);
             mRepeat.setImageResource(R.drawable.ic_repeat);
         }
     }



More information about the Android mailing list