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

Commit c34b57da authored by Josh Tsuji's avatar Josh Tsuji Committed by Automerger Merge Worker
Browse files

Merge "Fix volume talkback issues." into sc-dev am: f076f6d2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14938286

Change-Id: Ie6cfc526dc7163c2b1802b14a21d5ee7d8a9f256
parents 1c040a3a f076f6d2
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@
                android:id="@+id/volume_drawer_vibrate"
                android:layout_width="@dimen/volume_ringer_drawer_item_size"
                android:layout_height="@dimen/volume_ringer_drawer_item_size"
                android:description="@string/volume_ringer_hint_vibrate"
                android:contentDescription="@string/volume_ringer_hint_vibrate"
                android:gravity="center">

                <ImageView
@@ -76,7 +76,7 @@
                android:id="@+id/volume_drawer_mute"
                android:layout_width="@dimen/volume_ringer_drawer_item_size"
                android:layout_height="@dimen/volume_ringer_drawer_item_size"
                android:description="@string/volume_ringer_hint_mute"
                android:contentDescription="@string/volume_ringer_hint_mute"
                android:gravity="center">

                <ImageView
@@ -93,7 +93,7 @@
                android:id="@+id/volume_drawer_normal"
                android:layout_width="@dimen/volume_ringer_drawer_item_size"
                android:layout_height="@dimen/volume_ringer_drawer_item_size"
                android:description="@string/volume_ringer_hint_unmute"
                android:contentDescription="@string/volume_ringer_hint_unmute"
                android:gravity="center">

                <ImageView
@@ -117,7 +117,7 @@
        android:layout_width="@dimen/volume_ringer_drawer_item_size"
        android:layout_height="@dimen/volume_ringer_drawer_item_size"
        android:layout_gravity="bottom|right"
        android:description="@string/volume_ringer_change"
        android:contentDescription="@string/volume_ringer_change"
        android:background="@drawable/volume_drawer_selection_bg">

        <ImageView
+26 −14
Original line number Diff line number Diff line
@@ -932,6 +932,13 @@ public class VolumeDialogImpl implements VolumeDialog,
                    .start();
        }

        // When the ringer drawer is open, tapping the currently selected ringer will set the ringer
        // to the current ringer mode. Change the content description to that, instead of the 'tap
        // to change ringer mode' default.
        mSelectedRingerContainer.setContentDescription(
                mContext.getString(getStringDescriptionResourceForRingerMode(
                        mState.ringerModeInternal)));

        mIsRingerDrawerOpen = true;
    }

@@ -976,6 +983,11 @@ public class VolumeDialogImpl implements VolumeDialog,
                .translationY(0f)
                .start();

        // When the drawer is closed, tapping the selected ringer drawer will open it, allowing the
        // user to change the ringer.
        mSelectedRingerContainer.setContentDescription(
                mContext.getString(R.string.volume_ringer_change));

        mIsRingerDrawerOpen = false;
    }

@@ -1464,20 +1476,8 @@ public class VolumeDialogImpl implements VolumeDialog,
    }

    private void addAccessibilityDescription(View view, int currState, String hintLabel) {
        int currStateResId;
        switch (currState) {
            case RINGER_MODE_SILENT:
                currStateResId = R.string.volume_ringer_status_silent;
                break;
            case RINGER_MODE_VIBRATE:
                currStateResId = R.string.volume_ringer_status_vibrate;
                break;
            case RINGER_MODE_NORMAL:
            default:
                currStateResId = R.string.volume_ringer_status_normal;
        }

        view.setContentDescription(mContext.getString(currStateResId));
        view.setContentDescription(
                mContext.getString(getStringDescriptionResourceForRingerMode(currState)));
        view.setAccessibilityDelegate(new AccessibilityDelegate() {
            public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
                super.onInitializeAccessibilityNodeInfo(host, info);
@@ -1487,6 +1487,18 @@ public class VolumeDialogImpl implements VolumeDialog,
        });
    }

    private int getStringDescriptionResourceForRingerMode(int mode) {
        switch (mode) {
            case RINGER_MODE_SILENT:
                return R.string.volume_ringer_status_silent;
            case RINGER_MODE_VIBRATE:
                return R.string.volume_ringer_status_vibrate;
            case RINGER_MODE_NORMAL:
            default:
                return R.string.volume_ringer_status_normal;
        }
    }

    /**
     * Toggles enable state of views in a VolumeRow (not including seekbar or icon)
     * Hides/shows zen icon