Commit 644e7dc7 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

prefix interfaces name with I and use one file per interface

parent 4a77e56f
......@@ -47,7 +47,7 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class AudioBrowserActivity extends Activity implements Sortable {
public class AudioBrowserActivity extends Activity implements ISortable {
public final static String TAG = "VLC/AudioBrowserActivity";
private FlingViewGroup mFlingViewGroup;
......
......@@ -34,7 +34,7 @@ import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
public class AudioPlayerActivity extends Activity implements AudioPlayer {
public class AudioPlayerActivity extends Activity implements IAudioPlayer {
public final static String TAG = "VLC/AudioPlayerActivity";
private ImageView mCover;
......
......@@ -23,8 +23,6 @@ package org.videolan.vlc.android;
import java.util.ArrayList;
import java.util.List;
import org.videolan.vlc.android.AudioPlayer.AudioPlayerControl;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
......@@ -36,14 +34,14 @@ import android.os.RemoteException;
import android.preference.PreferenceManager;
import android.util.Log;
public class AudioServiceController implements AudioPlayerControl {
public class AudioServiceController implements IAudioPlayerControl {
public static final String TAG = "VLC/AudioServiceContoller";
private static AudioServiceController mInstance;
private static boolean mIsBound = false;
private IAudioService mAudioServiceBinder;
private ServiceConnection mAudioServiceConnection;
private ArrayList<AudioPlayer> mAudioPlayer;
private ArrayList<IAudioPlayer> mAudioPlayer;
private IAudioServiceCallback mCallback = new IAudioServiceCallback.Stub() {
@Override
public void update() throws RemoteException {
......@@ -52,7 +50,7 @@ public class AudioServiceController implements AudioPlayerControl {
};
private AudioServiceController() {
mAudioPlayer = new ArrayList<AudioPlayer>();
mAudioPlayer = new ArrayList<IAudioPlayer>();
}
public static AudioServiceController getInstance() {
......@@ -163,7 +161,7 @@ public class AudioServiceController implements AudioPlayerControl {
* Add a AudioPlayer
* @param ap
*/
public void addAudioPlayer(AudioPlayer ap) {
public void addAudioPlayer(IAudioPlayer ap) {
mAudioPlayer.add(ap);
}
......@@ -171,7 +169,7 @@ public class AudioServiceController implements AudioPlayerControl {
* Remove AudioPlayer from list
* @param ap
*/
public void removeAudioPlayer(AudioPlayer ap) {
public void removeAudioPlayer(IAudioPlayer ap) {
if (mAudioPlayer.contains(ap)) {
mAudioPlayer.remove(ap);
}
......@@ -181,7 +179,7 @@ public class AudioServiceController implements AudioPlayerControl {
* Update all AudioPlayer
*/
private void updateAudioPlayer() {
for (AudioPlayer player : mAudioPlayer)
for (IAudioPlayer player : mAudioPlayer)
player.update();
}
......
/*****************************************************************************
* IAudioPlayer.java
*****************************************************************************
* Copyright © 2011-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.android;
public interface IAudioPlayer {
public void update();
}
/*****************************************************************************
* AudioPlayer.java
* IAudioPlayer.java
*****************************************************************************
* Copyright © 2011-2012 VLC authors and VideoLAN
*
......@@ -22,48 +22,42 @@ package org.videolan.vlc.android;
import android.graphics.Bitmap;
public interface AudioPlayer {
public interface IAudioPlayerControl {
String getTitle();
public void update();
String getArtist();
public interface AudioPlayerControl {
String getTitle();
String getAlbum();
String getArtist();
Bitmap getCover();
String getAlbum();
int getLength();
Bitmap getCover();
int getTime();
int getLength();
boolean hasMedia();
int getTime();
boolean hasNext();
boolean hasMedia();
boolean hasPrevious();
boolean hasNext();
void play();
boolean hasPrevious();
void pause();
void play();
boolean isPlaying();
void pause();
void next();
boolean isPlaying();
void previous();
void next();
void shuffle();
void previous();
boolean isShuffling();
void shuffle();
void setRepeatType(RepeatType t);
boolean isShuffling();
void setRepeatType(RepeatType t);
RepeatType getRepeatType();
void detectHeadset(boolean enable);
}
RepeatType getRepeatType();
void detectHeadset(boolean enable);
}
/*****************************************************************************
* Sortable.java
* ISortable.java
*****************************************************************************
* Copyright © 2012 VLC authors and VideoLAN
*
......@@ -20,6 +20,6 @@
package org.videolan.vlc.android;
public interface Sortable {
public interface ISortable {
public void sortBy(int sortby);
}
......@@ -204,8 +204,8 @@ public class MainActivity extends TabActivity {
if (!(activity instanceof ActivityGroup))
break;
activity = ((ActivityGroup) activity).getCurrentActivity();
if (activity instanceof Sortable)
((Sortable) activity).sortBy(item.getItemId() == R.id.ml_menu_sortby_name
if (activity instanceof ISortable)
((ISortable) activity).sortBy(item.getItemId() == R.id.ml_menu_sortby_name
? VideoListAdapter.SORT_BY_TITLE
: VideoListAdapter.SORT_BY_LENGTH);
break;
......
......@@ -33,7 +33,7 @@ import android.view.View;
import android.widget.LinearLayout;
import android.widget.ListView;
public class VideoListActivity extends ListActivity implements Sortable {
public class VideoListActivity extends ListActivity implements ISortable {
private LinearLayout mNoFileLayout;
private LinearLayout mLoadFileLayout;
......
......@@ -20,8 +20,9 @@
package org.videolan.vlc.android.widget;
import org.videolan.vlc.android.AudioPlayer;
import org.videolan.vlc.android.AudioPlayerActivity;
import org.videolan.vlc.android.IAudioPlayer;
import org.videolan.vlc.android.IAudioPlayerControl;
import org.videolan.vlc.android.R;
import android.content.Context;
......@@ -39,10 +40,10 @@ import android.widget.LinearLayout;
import android.widget.SeekBar;
import android.widget.TextView;
public class AudioMiniPlayer extends LinearLayout implements AudioPlayer {
public class AudioMiniPlayer extends LinearLayout implements IAudioPlayer {
public static final String TAG = "VLC/AudioMiniPlayer";
private AudioPlayerControl mAudioPlayerControl;
private IAudioPlayerControl mAudioPlayerControl;
private String lastTitle;
private TextView mTitle;
......@@ -144,7 +145,7 @@ public class AudioMiniPlayer extends LinearLayout implements AudioPlayer {
super.onCreateContextMenu(menu);
}
public void setAudioPlayerControl(AudioPlayerControl control) {
public void setAudioPlayerControl(IAudioPlayerControl control) {
mAudioPlayerControl = control;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment