Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5602dde0 authored by Alexandr Shabalin's avatar Alexandr Shabalin Committed by Android (Google) Code Review
Browse files

Merge "Fix end area button alignment and background for selected device." into main

parents 478ae569 954a4bb6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
        android:layout_width="wrap_content"
        android:layout_height="36dp"
        android:layout_gravity="center_vertical|start"
        android:layout_marginStart="16dp"
        android:layout_marginStart="@dimen/media_output_dialog_margin_horizontal"
        android:layout_marginEnd="56dp"
        android:ellipsize="end"
        android:maxLines="1"
+14 −13
Original line number Diff line number Diff line
@@ -15,18 +15,19 @@
  ~ limitations under the License.
  -->

<FrameLayout
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/device_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    android:layout_height="wrap_content"
    android:paddingHorizontal="@dimen/media_output_dialog_margin_horizontal"
    android:baselineAligned="false">
    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="64dp"
        android:layout_weight="1"
        android:layout_width="0dp"
        android:layout_height="@dimen/media_output_dialog_item_height"
        android:id="@+id/item_layout"
        android:background="@drawable/media_output_item_background"
        android:layout_marginStart="16dp"
        android:layout_marginEnd="80dp"
        android:layout_marginBottom="12dp">
        <FrameLayout
            android:layout_width="match_parent"
@@ -36,7 +37,7 @@
                android:id="@+id/volume_seekbar"
                android:splitTrack="false"
                android:visibility="gone"
                android:paddingStart="64dp"
                android:paddingStart="@dimen/media_output_dialog_item_height"
                android:paddingEnd="0dp"
                android:background="@null"
                android:contentDescription="@string/media_output_dialog_accessibility_seekbar"
@@ -48,8 +49,8 @@

        <FrameLayout
            android:id="@+id/icon_area"
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:layout_width="@dimen/media_output_dialog_item_height"
            android:layout_height="@dimen/media_output_dialog_item_height"
            android:focusable="false"
            android:importantForAccessibility="no"
            android:layout_gravity="center_vertical|start">
@@ -131,11 +132,11 @@
    </FrameLayout>
    <FrameLayout
        android:id="@+id/end_action_area"
        android:layout_width="64dp"
        android:layout_height="64dp"
        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_marginEnd="8dp"
        android:layout_marginStart="7dp"
        android:layout_gravity="end|center"
        android:gravity="center"
        android:background="@drawable/media_output_item_background_active">
@@ -160,4 +161,4 @@
            android:indeterminateOnly="true"
            android:visibility="gone"/>
    </FrameLayout>
</FrameLayout>
 No newline at end of file
</LinearLayout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -16,5 +16,5 @@
  -->
<resources>
    <dimen name="media_output_dialog_icon_left_radius">0dp</dimen>
    <dimen name="media_output_dialog_icon_right_radius">28dp</dimen>
    <dimen name="media_output_dialog_icon_right_radius">@dimen/media_output_dialog_active_background_radius</dimen>
</resources>
 No newline at end of file
+4 −4
Original line number Diff line number Diff line
@@ -1525,11 +1525,11 @@
    <dimen name="media_output_dialog_icon_corner_radius">16dp</dimen>
    <dimen name="media_output_dialog_title_anim_y_delta">12.5dp</dimen>
    <dimen name="media_output_dialog_background_radius">16dp</dimen>
    <dimen name="media_output_dialog_active_background_radius">30dp</dimen>
    <dimen name="media_output_dialog_default_margin_end">16dp</dimen>
    <dimen name="media_output_dialog_selectable_margin_end">80dp</dimen>
    <dimen name="media_output_dialog_active_background_radius">32dp</dimen>
    <dimen name="media_output_dialog_item_height">64dp</dimen>
    <dimen name="media_output_dialog_margin_horizontal">16dp</dimen>
    <dimen name="media_output_dialog_list_padding_top">8dp</dimen>
    <dimen name="media_output_dialog_icon_left_radius">28dp</dimen>
    <dimen name="media_output_dialog_icon_left_radius">@dimen/media_output_dialog_active_background_radius</dimen>
    <dimen name="media_output_dialog_icon_right_radius">0dp</dimen>

    <!-- Distance that the full shade transition takes in order to complete by tapping on a button
+14 −18
Original line number Diff line number Diff line
@@ -298,8 +298,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                    boolean showEndArea =
                            !Flags.enableOutputSwitcherSessionGrouping() || isDeselectable;
                    updateUnmutedVolumeIcon(device);
                    updateGroupableCheckBox(true, isDeselectable, device);
                    updateEndClickArea(device, isDeselectable);
                    updateEndAreaForGroupCheckbox(device, true /* isSelected */, isDeselectable);
                    disableFocusPropertyForView(mContainerLayout);
                    setUpContentDescriptionForView(mSeekBar, device);
                    setSingleLineLayout(device.getName(), true /* showSeekBar */,
@@ -331,8 +330,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                        //If device is connected and there's other selectable devices, layout as
                        // one of selected devices.
                        updateUnmutedVolumeIcon(device);
                        updateGroupableCheckBox(true, isDeselectable, device);
                        updateEndClickArea(device, isDeselectable);
                        updateEndAreaForGroupCheckbox(device, true /* isSelected */,
                                isDeselectable);
                        disableFocusPropertyForView(mContainerLayout);
                        setUpContentDescriptionForView(mSeekBar, device);
                        setSingleLineLayout(device.getName(), true /* showSeekBar */,
@@ -352,8 +351,8 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                } else if (isSelectable) {
                    //groupable device
                    setUpDeviceIcon(device);
                    updateGroupableCheckBox(false, true, device);
                    updateEndClickArea(device, true);
                    updateEndAreaForGroupCheckbox(device, false /* isSelected */,
                            true /* isDeselectable */);
                    if (!Flags.disableTransferWhenAppsDoNotSupport()
                            || isTransferable
                            || hasRouteListingPreferenceItem) {
@@ -406,7 +405,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
        private void updateEndClickAreaWithIcon(View.OnClickListener clickListener,
                @DrawableRes int iconDrawableId,
                @StringRes int accessibilityStringId) {
            updateEndClickAreaColor(mController.getColorSeekbarProgress());
            updateEndAreaColor(mController.getColorSeekbarProgress());
            mEndClickIcon.setImageTintList(
                    ColorStateList.valueOf(mController.getColorItemContent()));
            mEndClickIcon.setOnClickListener(clickListener);
@@ -422,7 +421,7 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
            }
        }

        public void updateEndClickAreaColor(int color) {
        public void updateEndAreaColor(int color) {
            mEndTouchArea.setBackgroundTintList(
                    ColorStateList.valueOf(color));
        }
@@ -455,25 +454,22 @@ public class MediaOutputAdapter extends MediaOutputBaseAdapter {
                    ColorStateList.valueOf(mController.getColorItemContent()));
        }

        public void updateEndClickArea(MediaDevice device, boolean isDeviceDeselectable) {
        public void updateEndAreaForGroupCheckbox(MediaDevice device, boolean isSelected,
                boolean isDeselectable) {
            mEndTouchArea.setOnClickListener(null);
            mEndTouchArea.setOnClickListener(
                    isDeviceDeselectable ? (v) -> mCheckBox.performClick() : null);
                    isDeselectable ? (v) -> mCheckBox.performClick() : null);
            mEndTouchArea.setImportantForAccessibility(
                    View.IMPORTANT_FOR_ACCESSIBILITY_YES);
            mEndTouchArea.setBackgroundTintList(
                    ColorStateList.valueOf(mController.getColorItemBackground()));
            updateEndAreaColor(isSelected ? mController.getColorSeekbarProgress()
                    : mController.getColorItemBackground());
            setUpContentDescriptionForView(mEndTouchArea, device);
        }

        private void updateGroupableCheckBox(boolean isSelected, boolean isGroupable,
                MediaDevice device) {
            mCheckBox.setOnCheckedChangeListener(null);
            mCheckBox.setChecked(isSelected);
            mCheckBox.setOnCheckedChangeListener(
                    isGroupable ? (buttonView, isChecked) -> onGroupActionTriggered(!isSelected,
                    isDeselectable ? (buttonView, isChecked) -> onGroupActionTriggered(!isSelected,
                            device) : null);
            mCheckBox.setEnabled(isGroupable);
            mCheckBox.setEnabled(isDeselectable);
            setCheckBoxColor(mCheckBox, mController.getColorItemContent());
        }

Loading