Loading packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,10 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase { assertThat(mViewHolder.mSeekBar.getContentDescription()).isNotNull(); assertThat(mViewHolder.mContainerLayout.isFocusable()).isFalse(); assertThat(mViewHolder.mContainerLayout.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_NO); assertThat(mViewHolder.mTextContent.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } @Test Loading Loading @@ -511,6 +515,11 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase { assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getText().toString()).isEqualTo(TEST_DEVICE_NAME_2); assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mContainerLayout.isFocusable()).isTrue(); assertThat(mViewHolder.mContainerLayout.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_YES); assertThat(mViewHolder.mTextContent.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_YES); assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mSubTitleText.getVisibility()).isEqualTo(View.VISIBLE); Loading packages/SystemUI/res/layout/media_output_list_item_advanced.xml +4 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal" android:focusable="true" android:baselineAligned="false"> <FrameLayout android:layout_weight="1" Loading Loading @@ -77,6 +78,7 @@ </FrameLayout> <LinearLayout android:id="@+id/text_content" android:orientation="vertical" android:layout_width="wrap_content" android:layout_gravity="center_vertical|start" Loading @@ -86,7 +88,7 @@ android:layout_marginStart="72dp"> <TextView android:id="@+id/title" android:importantForAccessibility="no" android:focusable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" Loading @@ -96,6 +98,7 @@ android:textSize="16sp"/> <TextView android:id="@+id/subtitle" android:focusable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:marqueeRepeatLimit="marquee_forever" Loading packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java +18 −13 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { final ViewGroup mContainerLayout; final FrameLayout mItemLayout; final FrameLayout mIconAreaLayout; final ViewGroup mTextContent; final TextView mTitleText; final TextView mSubTitleText; final TextView mVolumeValueText; Loading @@ -152,6 +153,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { super(view, context); mContainerLayout = view.requireViewById(R.id.device_container); mItemLayout = view.requireViewById(R.id.item_layout); mTextContent = view.requireViewById(R.id.text_content); mTitleText = view.requireViewById(R.id.title); mSubTitleText = view.requireViewById(R.id.subtitle); mTitleIcon = view.requireViewById(R.id.title_icon); Loading Loading @@ -180,7 +182,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { mEndClickIcon.setVisibility(View.GONE); mEndTouchArea.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mContainerLayout.setOnClickListener(null); mContainerLayout.setContentDescription(null); mTitleText.setTextColor(mController.getColorItemContent()); mSubTitleText.setTextColor(mController.getColorItemContent()); mVolumeValueText.setTextColor(mController.getColorItemContent()); Loading @@ -188,7 +189,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { updateIconAreaClickListener(null); mSeekBar.setProgressTintList( ColorStateList.valueOf(mController.getColorSeekbarProgress())); enableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(true /* isImportant */); renderItem(mediaItem, position); } Loading Loading @@ -256,10 +257,10 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE); if (showSeekBar) { initSeekbar(device, isCurrentSeekbarInvisible); disableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(false /* isImportant */); mSeekBar.setContentDescription(contentDescription); } else { enableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(true /* isImportant */); } } Loading @@ -268,18 +269,22 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { boolean isCurrentSeekbarInvisible = mSeekBar.getVisibility() == View.GONE; mSeekBar.setVisibility(View.VISIBLE); initGroupSeekbar(isCurrentSeekbarInvisible); disableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(false /* isImportant */); mSeekBar.setContentDescription(contentDescription); } private void disableFocusPropertyForView(View view) { view.setFocusable(false); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } private void enableFocusPropertyForView(View view) { view.setFocusable(true); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); /** * Sets the a11y importance for the device container and it's text content. Making the * container not important for a11y is required when the seekbar is visible. */ private void updateContainerContentA11yImportance(boolean isImportant) { mContainerLayout.setFocusable(isImportant); mContainerLayout.setImportantForAccessibility( isImportant ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); mTextContent.setImportantForAccessibility( isImportant ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } void updateSubtitle(@Nullable String subtitle) { Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacyTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -268,6 +268,10 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase { assertThat(mViewHolder.mSeekBar.getContentDescription()).isNotNull(); assertThat(mViewHolder.mContainerLayout.isFocusable()).isFalse(); assertThat(mViewHolder.mContainerLayout.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_NO); assertThat(mViewHolder.mTextContent.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } @Test Loading Loading @@ -511,6 +515,11 @@ public class MediaOutputAdapterLegacyTest extends SysuiTestCase { assertThat(mViewHolder.mTitleText.getVisibility()).isEqualTo(View.VISIBLE); assertThat(mViewHolder.mTitleText.getText().toString()).isEqualTo(TEST_DEVICE_NAME_2); assertThat(mViewHolder.mSeekBar.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mContainerLayout.isFocusable()).isTrue(); assertThat(mViewHolder.mContainerLayout.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_YES); assertThat(mViewHolder.mTextContent.getImportantForAccessibility()).isEqualTo( View.IMPORTANT_FOR_ACCESSIBILITY_YES); assertThat(mViewHolder.mProgressBar.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mCheckBox.getVisibility()).isEqualTo(View.GONE); assertThat(mViewHolder.mSubTitleText.getVisibility()).isEqualTo(View.VISIBLE); Loading
packages/SystemUI/res/layout/media_output_list_item_advanced.xml +4 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal" android:focusable="true" android:baselineAligned="false"> <FrameLayout android:layout_weight="1" Loading Loading @@ -77,6 +78,7 @@ </FrameLayout> <LinearLayout android:id="@+id/text_content" android:orientation="vertical" android:layout_width="wrap_content" android:layout_gravity="center_vertical|start" Loading @@ -86,7 +88,7 @@ android:layout_marginStart="72dp"> <TextView android:id="@+id/title" android:importantForAccessibility="no" android:focusable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ellipsize="end" Loading @@ -96,6 +98,7 @@ android:textSize="16sp"/> <TextView android:id="@+id/subtitle" android:focusable="false" android:layout_width="wrap_content" android:layout_height="wrap_content" android:marqueeRepeatLimit="marquee_forever" Loading
packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputAdapterLegacy.java +18 −13 Original line number Diff line number Diff line Loading @@ -130,6 +130,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { final ViewGroup mContainerLayout; final FrameLayout mItemLayout; final FrameLayout mIconAreaLayout; final ViewGroup mTextContent; final TextView mTitleText; final TextView mSubTitleText; final TextView mVolumeValueText; Loading @@ -152,6 +153,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { super(view, context); mContainerLayout = view.requireViewById(R.id.device_container); mItemLayout = view.requireViewById(R.id.item_layout); mTextContent = view.requireViewById(R.id.text_content); mTitleText = view.requireViewById(R.id.title); mSubTitleText = view.requireViewById(R.id.subtitle); mTitleIcon = view.requireViewById(R.id.title_icon); Loading Loading @@ -180,7 +182,6 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { mEndClickIcon.setVisibility(View.GONE); mEndTouchArea.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); mContainerLayout.setOnClickListener(null); mContainerLayout.setContentDescription(null); mTitleText.setTextColor(mController.getColorItemContent()); mSubTitleText.setTextColor(mController.getColorItemContent()); mVolumeValueText.setTextColor(mController.getColorItemContent()); Loading @@ -188,7 +189,7 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { updateIconAreaClickListener(null); mSeekBar.setProgressTintList( ColorStateList.valueOf(mController.getColorSeekbarProgress())); enableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(true /* isImportant */); renderItem(mediaItem, position); } Loading Loading @@ -256,10 +257,10 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { mSeekBar.setVisibility(showSeekBar ? View.VISIBLE : View.GONE); if (showSeekBar) { initSeekbar(device, isCurrentSeekbarInvisible); disableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(false /* isImportant */); mSeekBar.setContentDescription(contentDescription); } else { enableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(true /* isImportant */); } } Loading @@ -268,18 +269,22 @@ public class MediaOutputAdapterLegacy extends MediaOutputAdapterBase { boolean isCurrentSeekbarInvisible = mSeekBar.getVisibility() == View.GONE; mSeekBar.setVisibility(View.VISIBLE); initGroupSeekbar(isCurrentSeekbarInvisible); disableFocusPropertyForView(mContainerLayout); updateContainerContentA11yImportance(false /* isImportant */); mSeekBar.setContentDescription(contentDescription); } private void disableFocusPropertyForView(View view) { view.setFocusable(false); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); } private void enableFocusPropertyForView(View view) { view.setFocusable(true); view.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_AUTO); /** * Sets the a11y importance for the device container and it's text content. Making the * container not important for a11y is required when the seekbar is visible. */ private void updateContainerContentA11yImportance(boolean isImportant) { mContainerLayout.setFocusable(isImportant); mContainerLayout.setImportantForAccessibility( isImportant ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO); mTextContent.setImportantForAccessibility( isImportant ? View.IMPORTANT_FOR_ACCESSIBILITY_YES : View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS); } void updateSubtitle(@Nullable String subtitle) { Loading