hide the playbackspeed button on the castplayer activity
This commit is contained in:
parent
450329a5e3
commit
1130e8ee87
|
@ -729,44 +729,50 @@ public abstract class MediaplayerActivity extends CastEnabledActivity implements
|
||||||
// BUTTON SETUP
|
// BUTTON SETUP
|
||||||
|
|
||||||
if(butPlaybackSpeed != null) {
|
if(butPlaybackSpeed != null) {
|
||||||
butPlaybackSpeed.setOnClickListener(v -> {
|
if (this instanceof AudioplayerActivity) {
|
||||||
if (controller == null) {
|
butPlaybackSpeed.setOnClickListener(v -> {
|
||||||
return;
|
if (controller == null) {
|
||||||
}
|
return;
|
||||||
if (controller.canSetPlaybackSpeed()) {
|
|
||||||
String[] availableSpeeds = UserPreferences.getPlaybackSpeedArray();
|
|
||||||
String currentSpeed = UserPreferences.getPlaybackSpeed();
|
|
||||||
|
|
||||||
// Provide initial value in case the speed list has changed
|
|
||||||
// out from under us
|
|
||||||
// and our current speed isn't in the new list
|
|
||||||
String newSpeed;
|
|
||||||
if (availableSpeeds.length > 0) {
|
|
||||||
newSpeed = availableSpeeds[0];
|
|
||||||
} else {
|
|
||||||
newSpeed = "1.00";
|
|
||||||
}
|
}
|
||||||
|
if (controller.canSetPlaybackSpeed()) {
|
||||||
|
String[] availableSpeeds = UserPreferences.getPlaybackSpeedArray();
|
||||||
|
String currentSpeed = UserPreferences.getPlaybackSpeed();
|
||||||
|
|
||||||
for (int i = 0; i < availableSpeeds.length; i++) {
|
// Provide initial value in case the speed list has changed
|
||||||
if (availableSpeeds[i].equals(currentSpeed)) {
|
// out from under us
|
||||||
if (i == availableSpeeds.length - 1) {
|
// and our current speed isn't in the new list
|
||||||
newSpeed = availableSpeeds[0];
|
String newSpeed;
|
||||||
} else {
|
if (availableSpeeds.length > 0) {
|
||||||
newSpeed = availableSpeeds[i + 1];
|
newSpeed = availableSpeeds[0];
|
||||||
}
|
} else {
|
||||||
break;
|
newSpeed = "1.00";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < availableSpeeds.length; i++) {
|
||||||
|
if (availableSpeeds[i].equals(currentSpeed)) {
|
||||||
|
if (i == availableSpeeds.length - 1) {
|
||||||
|
newSpeed = availableSpeeds[0];
|
||||||
|
} else {
|
||||||
|
newSpeed = availableSpeeds[i + 1];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UserPreferences.setPlaybackSpeed(newSpeed);
|
||||||
|
controller.setPlaybackSpeed(Float.parseFloat(newSpeed));
|
||||||
|
} else {
|
||||||
|
VariableSpeedDialog.showGetPluginDialog(this);
|
||||||
}
|
}
|
||||||
UserPreferences.setPlaybackSpeed(newSpeed);
|
});
|
||||||
controller.setPlaybackSpeed(Float.parseFloat(newSpeed));
|
butPlaybackSpeed.setOnLongClickListener(v -> {
|
||||||
} else {
|
VariableSpeedDialog.showDialog(this);
|
||||||
VariableSpeedDialog.showGetPluginDialog(this);
|
return true;
|
||||||
}
|
});
|
||||||
});
|
butPlaybackSpeed.setVisibility(View.VISIBLE);
|
||||||
butPlaybackSpeed.setOnLongClickListener(v -> {
|
} else {
|
||||||
VariableSpeedDialog.showDialog(this);
|
// TODO in the future, perhaps replace it with some cast related button
|
||||||
return true;
|
butPlaybackSpeed.setVisibility(View.GONE);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (butRev != null) {
|
if (butRev != null) {
|
||||||
|
|
Loading…
Reference in New Issue