Disable group volume control bar in output switcher systemUI dialog
-Disable static(Pre-defined) group volume seekbar -Disable dynamic group volume seekbar -Disable group volume seekbar in edit page Bug: 189270378 Test: atest MediaOutputAdapterTest MediaOutputControllerTest MediaOutputBaseDialogTest MediaOutputDialogTest MediaOutputGroupAdapterTest MediaOutputGroupDialogTest Change-Id: Ifc560e21a3ae8a4830be5c5c5d1fb94f452e36b0
This commit is contained in:
@@ -81,6 +81,7 @@
|
||||
android:visibility="gone"/>
|
||||
<SeekBar
|
||||
android:id="@+id/volume_seekbar"
|
||||
style="@*android:style/Widget.DeviceDefault.SeekBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"/>
|
||||
|
||||
@@ -202,6 +202,9 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
}
|
||||
|
||||
void initSeekbar(MediaDevice device) {
|
||||
if (!mController.isVolumeControlEnabled(device)) {
|
||||
disableSeekBar();
|
||||
}
|
||||
mSeekBar.setMax(device.getMaxVolume());
|
||||
mSeekBar.setMin(0);
|
||||
final int currentVolume = device.getCurrentVolume();
|
||||
@@ -230,6 +233,7 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
}
|
||||
|
||||
void initSessionSeekbar() {
|
||||
disableSeekBar();
|
||||
mSeekBar.setMax(mController.getSessionVolumeMax());
|
||||
mSeekBar.setMin(0);
|
||||
final int currentVolume = mController.getSessionVolume();
|
||||
@@ -318,5 +322,10 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
PorterDuff.Mode.SRC_IN));
|
||||
return BluetoothUtils.buildAdvancedDrawable(mContext, drawable);
|
||||
}
|
||||
|
||||
private void disableSeekBar() {
|
||||
mSeekBar.setEnabled(false);
|
||||
mSeekBar.setOnTouchListener((v, event) -> true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -475,6 +475,10 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
|
||||
|| features.contains(MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK));
|
||||
}
|
||||
|
||||
boolean isVolumeControlEnabled(@NonNull MediaDevice device) {
|
||||
return !device.getFeatures().contains(MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK);
|
||||
}
|
||||
|
||||
private final MediaController.Callback mCb = new MediaController.Callback() {
|
||||
@Override
|
||||
public void onMetadataChanged(MediaMetadata metadata) {
|
||||
|
||||
Reference in New Issue
Block a user