Fixed volume buttons on main screen to behave like hardware volume

buttons.
This commit is contained in:
casey langen 2017-02-18 21:02:23 -08:00
parent d9c2154cda
commit fe33340935

View File

@ -203,21 +203,17 @@ public class MainActivity extends WebSocketActivityBase {
final LongPressTextView volumeUp = (LongPressTextView) findViewById(R.id.button_vol_up);
volumeUp.setOnTickListener((View view) -> {
double volume = Math.min(1.0f, model.getVolume() + 0.05);
wss.send(SocketMessage.Builder
.request(Messages.Request.SetVolume)
.addOption(TransportModel.Key.VOLUME, volume)
.addOption(Messages.Key.RELATIVE, Messages.Value.UP)
.build());
});
final LongPressTextView volumeDown = (LongPressTextView) findViewById(R.id.button_vol_down);
volumeDown.setOnTickListener((View view) -> {
double volume = Math.max(0.0f, model.getVolume() - 0.05);
wss.send(SocketMessage.Builder
.request(Messages.Request.SetVolume)
.addOption(TransportModel.Key.VOLUME, volume)
.addOption(Messages.Key.RELATIVE, Messages.Value.DOWN)
.build());
});