Merge "Disable group volume control bar in output switcher systemUI dialog" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
3245ab133d
@@ -81,6 +81,7 @@
|
|||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/volume_seekbar"
|
android:id="@+id/volume_seekbar"
|
||||||
|
style="@*android:style/Widget.DeviceDefault.SeekBar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentBottom="true"/>
|
android:layout_alignParentBottom="true"/>
|
||||||
|
|||||||
@@ -220,6 +220,9 @@ public abstract class MediaOutputBaseAdapter extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initSeekbar(MediaDevice device) {
|
void initSeekbar(MediaDevice device) {
|
||||||
|
if (!mController.isVolumeControlEnabled(device)) {
|
||||||
|
disableSeekBar();
|
||||||
|
}
|
||||||
mSeekBar.setMax(device.getMaxVolume());
|
mSeekBar.setMax(device.getMaxVolume());
|
||||||
mSeekBar.setMin(0);
|
mSeekBar.setMin(0);
|
||||||
final int currentVolume = device.getCurrentVolume();
|
final int currentVolume = device.getCurrentVolume();
|
||||||
@@ -248,6 +251,7 @@ public abstract class MediaOutputBaseAdapter extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
void initSessionSeekbar() {
|
void initSessionSeekbar() {
|
||||||
|
disableSeekBar();
|
||||||
mSeekBar.setMax(mController.getSessionVolumeMax());
|
mSeekBar.setMax(mController.getSessionVolumeMax());
|
||||||
mSeekBar.setMin(0);
|
mSeekBar.setMin(0);
|
||||||
final int currentVolume = mController.getSessionVolume();
|
final int currentVolume = mController.getSessionVolume();
|
||||||
@@ -336,5 +340,10 @@ public abstract class MediaOutputBaseAdapter extends
|
|||||||
PorterDuff.Mode.SRC_IN));
|
PorterDuff.Mode.SRC_IN));
|
||||||
return BluetoothUtils.buildAdvancedDrawable(mContext, drawable);
|
return BluetoothUtils.buildAdvancedDrawable(mContext, drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disableSeekBar() {
|
||||||
|
mSeekBar.setEnabled(false);
|
||||||
|
mSeekBar.setOnTouchListener((v, event) -> true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -465,6 +465,10 @@ public class MediaOutputController implements LocalMediaManager.DeviceCallback {
|
|||||||
|| features.contains(MediaRoute2Info.FEATURE_REMOTE_GROUP_PLAYBACK));
|
|| 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() {
|
private final MediaController.Callback mCb = new MediaController.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onMetadataChanged(MediaMetadata metadata) {
|
public void onMetadataChanged(MediaMetadata metadata) {
|
||||||
|
|||||||
Reference in New Issue
Block a user