mirror of
https://github.com/clangen/musikcube.git
synced 2024-11-19 11:10:52 +00:00
Fixed volume buttons on main screen to behave like hardware volume
buttons.
This commit is contained in:
parent
d9c2154cda
commit
fe33340935
@ -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());
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user