aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/github/daneren2005/dsub/service/ChromeCastController.java2
-rw-r--r--src/github/daneren2005/dsub/service/DownloadService.java7
-rw-r--r--src/github/daneren2005/dsub/service/JukeboxController.java4
-rw-r--r--src/github/daneren2005/dsub/service/RemoteController.java28
4 files changed, 3 insertions, 38 deletions
diff --git a/src/github/daneren2005/dsub/service/ChromeCastController.java b/src/github/daneren2005/dsub/service/ChromeCastController.java
index 7568fe4d..0c8f38a6 100644
--- a/src/github/daneren2005/dsub/service/ChromeCastController.java
+++ b/src/github/daneren2005/dsub/service/ChromeCastController.java
@@ -203,7 +203,6 @@ public class ChromeCastController extends RemoteController {
public void setVolume(int volume) {
gain = volume / 10.0;
- getVolumeToast().setVolume((float) gain);
try {
Cast.CastApi.setVolume(apiClient, gain);
} catch(Exception e) {
@@ -217,7 +216,6 @@ public class ChromeCastController extends RemoteController {
gain = Math.max(gain, 0.0);
gain = Math.min(gain, 1.0);
- getVolumeToast().setVolume((float) gain);
try {
Cast.CastApi.setVolume(apiClient, gain);
} catch(Exception e) {
diff --git a/src/github/daneren2005/dsub/service/DownloadService.java b/src/github/daneren2005/dsub/service/DownloadService.java
index 9a9b5a57..aa7e8bbf 100644
--- a/src/github/daneren2005/dsub/service/DownloadService.java
+++ b/src/github/daneren2005/dsub/service/DownloadService.java
@@ -1275,11 +1275,8 @@ public class DownloadService extends Service {
}
public void updateRemoteVolume(boolean up) {
- if(remoteState == RemoteControlState.JUKEBOX_SERVER) {
- mediaRouter.getSelectedRoute().requestUpdateVolume(up ? 1 : -1);
- } else {
- remoteController.updateVolume(up);
- }
+ AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
+ audioManager.adjustVolume(up ? AudioManager.ADJUST_RAISE : AudioManager.ADJUST_LOWER, AudioManager.FLAG_SHOW_UI);
}
public void startRemoteScan() {
diff --git a/src/github/daneren2005/dsub/service/JukeboxController.java b/src/github/daneren2005/dsub/service/JukeboxController.java
index da1538be..e9d7cbc8 100644
--- a/src/github/daneren2005/dsub/service/JukeboxController.java
+++ b/src/github/daneren2005/dsub/service/JukeboxController.java
@@ -127,7 +127,6 @@ public class JukeboxController extends RemoteController {
public void setVolume(int volume) {
gain = volume / 10.0f;
- getVolumeToast().setVolume(gain);
tasks.remove(SetGain.class);
tasks.add(new SetGain(gain));
}
@@ -137,8 +136,7 @@ public class JukeboxController extends RemoteController {
gain += delta;
gain = Math.max(gain, 0.0f);
gain = Math.min(gain, 1.0f);
-
- getVolumeToast().setVolume(gain);
+
tasks.remove(SetGain.class);
tasks.add(new SetGain(gain));
}
diff --git a/src/github/daneren2005/dsub/service/RemoteController.java b/src/github/daneren2005/dsub/service/RemoteController.java
index d5a4d8df..89d4f4fd 100644
--- a/src/github/daneren2005/dsub/service/RemoteController.java
+++ b/src/github/daneren2005/dsub/service/RemoteController.java
@@ -36,7 +36,6 @@ import github.daneren2005.dsub.domain.RemoteStatus;
public abstract class RemoteController {
private static final String TAG = RemoteController.class.getSimpleName();
protected DownloadService downloadService;
- private VolumeToast volumeToast;
public abstract void create(boolean playing, int seconds);
public abstract void start();
@@ -93,31 +92,4 @@ public abstract class RemoteController {
queue.clear();
}
}
-
- protected VolumeToast getVolumeToast() {
- if(volumeToast == null) {
- volumeToast = new VolumeToast(downloadService);
- }
- return volumeToast;
- }
-
- protected 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();
- }
- }
}