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

Commit 94ca5364 authored by RoboErik's avatar RoboErik
Browse files

Add descriptions to MediaController buttons

This widget was missing some accessibility descriptions.

bug:16536697
Change-Id: I6f50fd1f4fc0a804151ff465b612128d71a1fde6
parent 06602441
Loading
Loading
Loading
Loading
+42 −32
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.widget;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.PixelFormat;
import android.media.AudioManager;
import android.os.Handler;
@@ -96,6 +97,8 @@ public class MediaController extends FrameLayout {
    private ImageButton mRewButton;
    private ImageButton mNextButton;
    private ImageButton mPrevButton;
    private CharSequence mPlayDescription;
    private CharSequence mPauseDescription;

    public MediaController(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -249,6 +252,11 @@ public class MediaController extends FrameLayout {
    }

    private void initControllerView(View v) {
        Resources res = mContext.getResources();
        mPlayDescription = res
                .getText(com.android.internal.R.string.lockscreen_transport_play_description);
        mPauseDescription = res
                .getText(com.android.internal.R.string.lockscreen_transport_pause_description);
        mPauseButton = (ImageButton) v.findViewById(com.android.internal.R.id.pause);
        if (mPauseButton != null) {
            mPauseButton.requestFocus();
@@ -525,8 +533,10 @@ public class MediaController extends FrameLayout {

        if (mPlayer.isPlaying()) {
            mPauseButton.setImageResource(com.android.internal.R.drawable.ic_media_pause);
            mPauseButton.setContentDescription(mPauseDescription);
        } else {
            mPauseButton.setImageResource(com.android.internal.R.drawable.ic_media_play);
            mPauseButton.setContentDescription(mPlayDescription);
        }
    }

+9 −5
Original line number Diff line number Diff line
@@ -2540,15 +2540,19 @@
    Contact your wireless service provider for another SIM card.</string>

    <!-- Shown on transport control of lockscreen. Pressing button goes to previous track. -->
    <string name="lockscreen_transport_prev_description">Previous track button</string>
    <string name="lockscreen_transport_prev_description">Previous track</string>
    <!-- Shown on transport control of lockscreen. Pressing button goes to next track. -->
    <string name="lockscreen_transport_next_description">Next track button</string>
    <string name="lockscreen_transport_next_description">Next track</string>
    <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
    <string name="lockscreen_transport_pause_description">Pause button</string>
    <string name="lockscreen_transport_pause_description">Pause</string>
    <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
    <string name="lockscreen_transport_play_description">Play button</string>
    <string name="lockscreen_transport_play_description">Play</string>
    <!-- Shown on transport control of lockscreen. Pressing button pauses playback -->
    <string name="lockscreen_transport_stop_description">Stop button</string>
    <string name="lockscreen_transport_stop_description">Stop</string>
    <!-- Shown on transport control screens. Pressing button rewinds playback [CHAR LIMIT=NONE]-->
    <string name="lockscreen_transport_rew_description">Rewind</string>
    <!-- Shown on transport control screens. Pressing button fast forwards playback [CHAR LIMIT=NONE]-->
    <string name="lockscreen_transport_ffw_description">Fast forward</string>

    <!-- Shown in the lock screen when there is emergency calls only mode. -->
    <string name="emergency_calls_only" msgid="2485604591272668370">Emergency calls only</string>
+6 −0
Original line number Diff line number Diff line
@@ -1105,26 +1105,32 @@ please see styles_device_defaults.xml.

    <style name="MediaButton.Previous">
        <item name="src">@drawable/ic_media_previous</item>
        <item name="contentDescription">@string/lockscreen_transport_prev_description</item>
    </style>

    <style name="MediaButton.Next">
        <item name="src">@drawable/ic_media_next</item>
        <item name="contentDescription">@string/lockscreen_transport_next_description</item>
    </style>

    <style name="MediaButton.Play">
        <item name="src">@drawable/ic_media_play</item>
        <item name="contentDescription">@string/lockscreen_transport_play_description</item>
    </style>

    <style name="MediaButton.Ffwd">
        <item name="src">@drawable/ic_media_ff</item>
        <item name="contentDescription">@string/lockscreen_transport_ffw_description</item>
    </style>

    <style name="MediaButton.Rew">
        <item name="src">@drawable/ic_media_rew</item>
        <item name="contentDescription">@string/lockscreen_transport_rew_description</item>
    </style>

    <style name="MediaButton.Pause">
        <item name="src">@drawable/ic_media_pause</item>
        <item name="contentDescription">@string/lockscreen_transport_pause_description</item>
    </style>

    <style name="ZoomControls">
+2 −0
Original line number Diff line number Diff line
@@ -976,6 +976,8 @@
  <java-symbol type="string" name="ssl_ca_cert_noti_by_unknown" />
  <java-symbol type="string" name="ssl_ca_cert_noti_managed" />
  <java-symbol type="string" name="ssl_ca_cert_warning" />
  <java-symbol type="string" name="lockscreen_transport_play_description" />
  <java-symbol type="string" name="lockscreen_transport_pause_description" />

  <java-symbol type="plurals" name="abbrev_in_num_days" />
  <java-symbol type="plurals" name="abbrev_in_num_hours" />