aboutsummaryrefslogtreecommitdiff
path: root/src/github/daneren2005
diff options
context:
space:
mode:
authordaneren2005 <daneren2005@gmail.com>2013-08-08 16:42:30 -0700
committerdaneren2005 <daneren2005@gmail.com>2013-08-08 16:42:30 -0700
commitb3410982212a91ad48b44121ac0a018a6632699e (patch)
tree613902030040b9a9a5f22c66767906de2b9fd948 /src/github/daneren2005
parent8c348fea68a1803dee25cbc2f79d1f23a6ec9f4b (diff)
downloaddsub-b3410982212a91ad48b44121ac0a018a6632699e.tar.gz
dsub-b3410982212a91ad48b44121ac0a018a6632699e.tar.bz2
dsub-b3410982212a91ad48b44121ac0a018a6632699e.zip
Turn RemoteController into abstract class instead of interface
Diffstat (limited to 'src/github/daneren2005')
-rw-r--r--src/github/daneren2005/dsub/service/RemoteController.java46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/github/daneren2005/dsub/service/RemoteController.java b/src/github/daneren2005/dsub/service/RemoteController.java
index 789881b1..ec44cdaa 100644
--- a/src/github/daneren2005/dsub/service/RemoteController.java
+++ b/src/github/daneren2005/dsub/service/RemoteController.java
@@ -19,14 +19,44 @@
package github.daneren2005.dsub.service;
-public interface RemoteController {
- void start();
- void stop();
+public class RemoteController {
+ protected DownloadServiceImpl downloadService;
+ private VolumeToast volumeToast;
- void updatePlaylist();
- void changePosition(int seconds);
- void changeTrack(int index, DownloadFile song);
- void setVolume(float gain);
+ public abstract void start();
+ public abstract void stop();
- int getRemotePosition();
+ public abstract public abstract void updatePlaylist();
+ public abstract void changePosition(int seconds);
+ public abstract void changeTrack(int index, DownloadFile song);
+ public abstract void setVolume(float gain);
+
+ public abstract int getRemotePosition();
+
+ protected VolumeToast getVolumeToast() {
+ if(volumeToast == null) {
+ volumeToast == new VolumeToast(downloadService);
+ }
+ return volumeToast;
+ }
+
+ private static class VolumeToast extends Toast {
+ private final ProgressBar progressBar;
+
+ public VolumeToast(Context context) {
+ super(context);
+ setDuration(Toast.LENGTH_SHORT);
+ LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View view = inflater.inflate(R.layout.jukebox_volume, null);
+ progressBar = (ProgressBar) view.findViewById(R.id.jukebox_volume_progress_bar);
+
+ setView(view);
+ setGravity(Gravity.TOP, 0, 0);
+ }
+
+ public void setVolume(float volume) {
+ progressBar.setProgress(Math.round(100 * volume));
+ show();
+ }
+ }
}