summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java8
-rw-r--r--packages/SystemUI/res/layout/media_output_list_group_divider.xml4
-rw-r--r--packages/SystemUI/res/layout/media_output_list_item_advanced.xml32
-rw-r--r--packages/SystemUI/res/values/strings.xml6
-rw-r--r--packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java24
5 files changed, 32 insertions, 42 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java
index 6384491ad12e..2db2199602b8 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java
@@ -759,7 +759,7 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase {
.onCreateViewHolder(new LinearLayout(mContext), 0);
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 1);
- mViewHolder.mEndTouchArea.performClick();
+ mViewHolder.mCheckBox.performClick();
verify(mMediaSwitchingController).addDeviceToPlayMedia(mMediaDevice2);
}
@@ -903,7 +903,7 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase {
.onCreateViewHolder(new LinearLayout(mContext), 0);
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
- mViewHolder.mEndTouchArea.performClick();
+ mViewHolder.mCheckBox.performClick();
verify(mMediaSwitchingController).removeDeviceFromPlayMedia(mMediaDevice1);
}
@@ -1059,7 +1059,7 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase {
new LinearLayout(mContext), MediaItem.MediaItemType.TYPE_DEVICE);
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
- mViewHolder.mEndTouchArea.performClick();
+ mViewHolder.mEndClickIcon.performClick();
mViewHolder = (MediaOutputAdapterLegacy.MediaDeviceViewHolderLegacy) mMediaOutputAdapter
.onCreateViewHolder(
new LinearLayout(mContext), MediaItem.MediaItemType.TYPE_DEVICE);
@@ -1082,7 +1082,7 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase {
new LinearLayout(mContext), MediaItem.MediaItemType.TYPE_DEVICE);
mMediaOutputAdapter.onBindViewHolder(mViewHolder, 0);
- mViewHolder.mEndTouchArea.performClick();
+ mViewHolder.mEndClickIcon.performClick();
mViewHolder = (MediaOutputAdapterLegacy.MediaDeviceViewHolderLegacy) mMediaOutputAdapter
.onCreateViewHolder(
new LinearLayout(mContext), MediaItem.MediaItemType.TYPE_DEVICE);
diff --git a/packages/SystemUI/res/layout/media_output_list_group_divider.xml b/packages/SystemUI/res/layout/media_output_list_group_divider.xml
index c351912de295..fa5ad0d981c1 100644
--- a/packages/SystemUI/res/layout/media_output_list_group_divider.xml
+++ b/packages/SystemUI/res/layout/media_output_list_group_divider.xml
@@ -20,14 +20,14 @@
android:id="@+id/device_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/media_output_dialog_margin_horizontal"
+ android:layout_marginEnd="56dp"
android:orientation="vertical">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center_vertical|start"
- android:layout_marginStart="@dimen/media_output_dialog_margin_horizontal"
- android:layout_marginEnd="56dp"
android:ellipsize="end"
android:maxLines="1"
android:fontFamily="@*android:string/config_headlineFontFamilyMedium"
diff --git a/packages/SystemUI/res/layout/media_output_list_item_advanced.xml b/packages/SystemUI/res/layout/media_output_list_item_advanced.xml
index 7cfc1d6d4938..6b868b3c7379 100644
--- a/packages/SystemUI/res/layout/media_output_list_item_advanced.xml
+++ b/packages/SystemUI/res/layout/media_output_list_item_advanced.xml
@@ -20,7 +20,7 @@
android:id="@+id/device_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal"
+ android:layout_marginHorizontal="@dimen/media_output_dialog_margin_horizontal"
android:focusable="true"
android:baselineAligned="false">
<FrameLayout
@@ -127,7 +127,6 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="16dp"
- android:indeterminate="true"
android:layout_gravity="end|center"
android:indeterminateOnly="true"
android:importantForAccessibility="no"
@@ -138,30 +137,23 @@
android:layout_width="@dimen/media_output_dialog_item_height"
android:layout_height="@dimen/media_output_dialog_item_height"
android:visibility="gone"
- android:layout_marginBottom="6dp"
android:layout_marginStart="7dp"
- android:layout_gravity="end|center"
- android:gravity="center"
android:background="@drawable/media_output_item_background_active">
<CheckBox
android:id="@+id/check_box"
- android:focusable="false"
- android:importantForAccessibility="no"
- android:layout_gravity="center"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:button="@drawable/media_output_item_check_box"
+ android:foreground="@drawable/media_output_item_check_box"
+ android:foregroundGravity="center"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:button="@null"
android:visibility="gone"
/>
- <ImageView
- android:id="@+id/media_output_item_end_click_icon"
- android:layout_width="24dp"
- android:layout_height="24dp"
- android:focusable="false"
- android:importantForAccessibility="no"
- android:layout_gravity="center"
- android:indeterminate="true"
- android:indeterminateOnly="true"
+ <ImageButton
+ android:id="@+id/end_area_image_button"
+ android:background="@android:color/transparent"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:contentDescription="@null"
android:visibility="gone"/>
</FrameLayout>
</LinearLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index 359bd2bcb37c..1f65bb2035c2 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -592,6 +592,12 @@
<!-- Content description of the button to expand the group of devices. [CHAR LIMIT=NONE] -->
<string name="accessibility_expand_group">Expand group.</string>
+ <!-- Content description of the button to add a device to a group. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_add_device_to_group">Add device to group.</string>
+
+ <!-- Content description of the button to remove a device from a group. [CHAR LIMIT=NONE] -->
+ <string name="accessibility_remove_device_from_group">Remove device from group.</string>
+
<!-- Content description of the button to open the application . [CHAR LIMIT=NONE] -->
<string name="accessibility_open_application">Open application.</string>
diff --git a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java
index aaa36d824da2..f8e57ef489aa 100644
--- a/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java
+++ b/packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java
@@ -36,6 +36,7 @@ import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import android.widget.CheckBox;
import android.widget.FrameLayout;
+import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.SeekBar;
@@ -44,7 +45,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
-import androidx.core.widget.CompoundButtonCompat;
import androidx.recyclerview.widget.RecyclerView;
import com.android.media.flags.Flags;
@@ -139,7 +139,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
final ImageView mStatusIcon;
final CheckBox mCheckBox;
final ViewGroup mEndTouchArea;
- final ImageView mEndClickIcon;
+ final ImageButton mEndClickIcon;
@VisibleForTesting
MediaOutputSeekbar mSeekBar;
private final float mInactiveRadius;
@@ -162,7 +162,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
mStatusIcon = view.requireViewById(R.id.media_output_item_status);
mCheckBox = view.requireViewById(R.id.check_box);
mEndTouchArea = view.requireViewById(R.id.end_action_area);
- mEndClickIcon = view.requireViewById(R.id.media_output_item_end_click_icon);
+ mEndClickIcon = view.requireViewById(R.id.end_area_image_button);
mVolumeValueText = view.requireViewById(R.id.volume_value);
mIconAreaLayout = view.requireViewById(R.id.icon_area);
mInactiveRadius = mContext.getResources().getDimension(
@@ -180,7 +180,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
mStatusIcon.setVisibility(View.GONE);
mEndTouchArea.setVisibility(View.GONE);
mEndClickIcon.setVisibility(View.GONE);
- mEndTouchArea.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
mContainerLayout.setOnClickListener(null);
mTitleText.setTextColor(mController.getColorItemContent());
mSubTitleText.setTextColor(mController.getColorItemContent());
@@ -581,26 +580,22 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
mEndClickIcon.setImageTintList(
ColorStateList.valueOf(mController.getColorItemContent()));
mEndClickIcon.setOnClickListener(clickListener);
- mEndTouchArea.setOnClickListener(v -> mEndClickIcon.performClick());
Drawable drawable = mContext.getDrawable(iconDrawableId);
mEndClickIcon.setImageDrawable(drawable);
if (drawable instanceof AnimatedVectorDrawable) {
((AnimatedVectorDrawable) drawable).start();
}
- if (Flags.enableOutputSwitcherDeviceGrouping()) {
- mEndClickIcon.setContentDescription(mContext.getString(accessibilityStringId));
- }
+ mEndClickIcon.setContentDescription(mContext.getString(accessibilityStringId));
}
private void updateEndAreaForGroupCheckBox(@NonNull MediaDevice device,
@NonNull GroupStatus groupStatus) {
boolean isEnabled = isGroupCheckboxEnabled(groupStatus);
- mEndTouchArea.setOnClickListener(
- isEnabled ? (v) -> mCheckBox.performClick() : null);
- mEndTouchArea.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
updateEndAreaColor(groupStatus.selected() ? mController.getColorSeekbarProgress()
: mController.getColorItemBackground());
- mEndTouchArea.setContentDescription(getDeviceItemContentDescription(device));
+ mCheckBox.setContentDescription(mContext.getString(
+ groupStatus.selected() ? R.string.accessibility_remove_device_from_group
+ : R.string.accessibility_add_device_to_group));
mCheckBox.setOnCheckedChangeListener(null);
mCheckBox.setChecked(groupStatus.selected());
mCheckBox.setOnCheckedChangeListener(
@@ -611,10 +606,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase {
}
private void setCheckBoxColor(CheckBox checkBox, int color) {
- int[][] states = {{android.R.attr.state_checked}, {}};
- int[] colors = {color, color};
- CompoundButtonCompat.setButtonTintList(checkBox, new
- ColorStateList(states, colors));
+ checkBox.setForegroundTintList(ColorStateList.valueOf(color));
}
private boolean shouldShowGroupCheckbox(@NonNull GroupStatus groupStatus) {