Merge "DO NOT MERGE: Downbranch merge conflict [Output Switcher] set icon to volume icon when device is active" into tm-dev
This commit is contained in:
10
packages/SystemUI/res/drawable/media_output_icon_volume.xml
Normal file
10
packages/SystemUI/res/drawable/media_output_icon_volume.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@color/media_dialog_item_main_content"
|
||||
android:pathData="M14,20.725V18.675Q16.25,18.025 17.625,16.175Q19,14.325 19,11.975Q19,9.625 17.625,7.775Q16.25,5.925 14,5.275V3.225Q17.1,3.925 19.05,6.362Q21,8.8 21,11.975Q21,15.15 19.05,17.587Q17.1,20.025 14,20.725ZM3,15V9H7L12,4V20L7,15ZM14,16V7.95Q15.125,8.475 15.812,9.575Q16.5,10.675 16.5,12Q16.5,13.325 15.812,14.4Q15.125,15.475 14,16ZM10,8.85 L7.85,11H5V13H7.85L10,15.15ZM7.5,12Z"/>
|
||||
</vector>
|
||||
@@ -143,6 +143,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
if (mController.isTransferring()) {
|
||||
if (device.getState() == MediaDeviceState.STATE_CONNECTING
|
||||
&& !mController.hasAdjustVolumeUserRestriction()) {
|
||||
setUpDeviceIcon(device);
|
||||
mProgressBar.getIndeterminateDrawable().setColorFilter(
|
||||
new PorterDuffColorFilter(
|
||||
mController.getColorItemContent(),
|
||||
@@ -151,11 +152,13 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
false /* showSeekBar*/,
|
||||
true /* showProgressBar */, false /* showStatus */);
|
||||
} else {
|
||||
setUpDeviceIcon(device);
|
||||
setSingleLineLayout(getItemTitle(device), false /* bFocused */);
|
||||
}
|
||||
} else {
|
||||
// Set different layout for each device
|
||||
if (device.getState() == MediaDeviceState.STATE_CONNECTING_FAILED) {
|
||||
setUpDeviceIcon(device);
|
||||
mTitleText.setAlpha(DEVICE_CONNECTED_ALPHA);
|
||||
mTitleIcon.setAlpha(DEVICE_CONNECTED_ALPHA);
|
||||
mStatusIcon.setImageDrawable(
|
||||
@@ -167,6 +170,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
mSubTitleText.setText(R.string.media_output_dialog_connect_failed);
|
||||
mContainerLayout.setOnClickListener(v -> onItemClick(v, device));
|
||||
} else if (device.getState() == MediaDeviceState.STATE_GROUPING) {
|
||||
setUpDeviceIcon(device);
|
||||
mProgressBar.getIndeterminateDrawable().setColorFilter(
|
||||
new PorterDuffColorFilter(
|
||||
mController.getColorItemContent(),
|
||||
@@ -179,6 +183,9 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
boolean isDeviceDeselectable = isDeviceIncluded(
|
||||
mController.getDeselectableMediaDevice(), device);
|
||||
mTitleText.setTextColor(mController.getColorItemContent());
|
||||
mTitleIcon.setImageDrawable(
|
||||
mContext.getDrawable(R.drawable.media_output_icon_volume));
|
||||
mTitleIcon.setColorFilter(mController.getColorItemContent());
|
||||
setSingleLineLayout(getItemTitle(device), true /* bFocused */,
|
||||
true /* showSeekBar */,
|
||||
false /* showProgressBar */, false /* showStatus */);
|
||||
@@ -207,6 +214,9 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
mStatusIcon.setImageDrawable(
|
||||
mContext.getDrawable(R.drawable.media_output_status_check));
|
||||
mStatusIcon.setColorFilter(mController.getColorItemContent());
|
||||
mTitleIcon.setImageDrawable(
|
||||
mContext.getDrawable(R.drawable.media_output_icon_volume));
|
||||
mTitleIcon.setColorFilter(mController.getColorItemContent());
|
||||
mTitleText.setTextColor(mController.getColorItemContent());
|
||||
setSingleLineLayout(getItemTitle(device), true /* bFocused */,
|
||||
true /* showSeekBar */,
|
||||
@@ -215,6 +225,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
setUpContentDescriptionForView(mContainerLayout, false, device);
|
||||
mCurrentActivePosition = position;
|
||||
} else if (isDeviceIncluded(mController.getSelectableMediaDevice(), device)) {
|
||||
setUpDeviceIcon(device);
|
||||
mCheckBox.setOnCheckedChangeListener(null);
|
||||
mCheckBox.setVisibility(View.VISIBLE);
|
||||
mCheckBox.setChecked(false);
|
||||
@@ -227,6 +238,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
|
||||
false /* showSeekBar */,
|
||||
false /* showProgressBar */, false /* showStatus */);
|
||||
} else {
|
||||
setUpDeviceIcon(device);
|
||||
setSingleLineLayout(getItemTitle(device), false /* bFocused */);
|
||||
mContainerLayout.setOnClickListener(v -> onItemClick(v, device));
|
||||
}
|
||||
|
||||
@@ -166,15 +166,6 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
|
||||
void onBind(MediaDevice device, boolean topMargin, boolean bottomMargin, int position) {
|
||||
mDeviceId = device.getId();
|
||||
ThreadUtils.postOnBackgroundThread(() -> {
|
||||
Icon icon = mController.getDeviceIconCompat(device).toIcon(mContext);
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
if (!TextUtils.equals(mDeviceId, device.getId())) {
|
||||
return;
|
||||
}
|
||||
mTitleIcon.setImageIcon(icon);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
abstract void onBind(int customizedItem, boolean topMargin, boolean bottomMargin);
|
||||
@@ -414,5 +405,17 @@ public abstract class MediaOutputBaseAdapter extends
|
||||
mSeekBar.setEnabled(false);
|
||||
mSeekBar.setOnTouchListener((v, event) -> true);
|
||||
}
|
||||
|
||||
protected void setUpDeviceIcon(MediaDevice device) {
|
||||
ThreadUtils.postOnBackgroundThread(() -> {
|
||||
Icon icon = mController.getDeviceIconCompat(device).toIcon(mContext);
|
||||
ThreadUtils.postOnMainThread(() -> {
|
||||
if (!TextUtils.equals(mDeviceId, device.getId())) {
|
||||
return;
|
||||
}
|
||||
mTitleIcon.setImageIcon(icon);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user