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

Commit 17f9e70a authored by Ats Jenk's avatar Ats Jenk Committed by Android (Google) Code Review
Browse files

Merge "Announce when bubble bar expands or collapses" into main

parents 354d367c 8034c414
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -348,4 +348,8 @@
    <string name="bubble_bar_action_move_right">Move right</string>
    <!-- Action in accessibility menu to dismiss all bubbles. [CHAR_LIMIT=30] -->
    <string name="bubble_bar_action_dismiss_all">Dismiss all</string>
    <!-- Accessibility announcement when the bubble bar expands. [CHAR LIMIT=NONE]-->
    <string name="bubble_bar_accessibility_announce_expand">expand <xliff:g id="bubble_description" example="some title from Messages">%1$s</xliff:g></string>
    <!-- Accessibility announcement when the bubble bar collapses. [CHAR LIMIT=NONE]-->
    <string name="bubble_bar_accessibility_announce_collapse">collapse <xliff:g id="bubble_description" example="some title from Messages">%1$s</xliff:g></string>
</resources>
+21 −0
Original line number Diff line number Diff line
@@ -1228,6 +1228,7 @@ public class BubbleBarView extends FrameLayout {
                mWidthAnimator.reverse();
            }
            updateBubbleAccessibilityStates();
            announceExpandedStateChange();
        }
    }

@@ -1344,6 +1345,26 @@ public class BubbleBarView extends FrameLayout {
        setContentDescription(contentDesc);
    }

    private void announceExpandedStateChange() {
        final CharSequence selectedBubbleContentDesc;
        if (mSelectedBubbleView != null) {
            selectedBubbleContentDesc = mSelectedBubbleView.getContentDescription();
        } else {
            selectedBubbleContentDesc = getResources().getString(
                    R.string.bubble_bar_bubble_fallback_description);
        }

        final String msg;
        if (mIsBarExpanded) {
            msg = getResources().getString(R.string.bubble_bar_accessibility_announce_expand,
                    selectedBubbleContentDesc);
        } else {
            msg = getResources().getString(R.string.bubble_bar_accessibility_announce_collapse,
                    selectedBubbleContentDesc);
        }
        announceForAccessibility(msg);
    }

    private boolean isIconSizeOrPaddingUpdated(float newIconSize, float newBubbleBarPadding) {
        return isIconSizeUpdated(newIconSize) || isPaddingUpdated(newBubbleBarPadding);
    }