diff options
| author | ztenghui <ztenghui@google.com> | 2013-04-16 13:52:07 -0700 |
|---|---|---|
| committer | ztenghui <ztenghui@google.com> | 2013-04-17 11:05:50 -0700 |
| commit | 75408cd38e7efe0755addcf3170932c8b3190bc1 (patch) | |
| tree | 8f1ca7a6f0ac72e4d3052dc10b207660796b06f8 | |
| parent | 83bd8d346d295e4fe06212da957feb77ee23c04d (diff) | |
| download | android_packages_apps_Gallery2-75408cd38e7efe0755addcf3170932c8b3190bc1.tar.gz android_packages_apps_Gallery2-75408cd38e7efe0755addcf3170932c8b3190bc1.tar.bz2 android_packages_apps_Gallery2-75408cd38e7efe0755addcf3170932c8b3190bc1.zip | |
Add accessibility to video player controller.
bug:5714277
cherry pick the Carlsbad CL:
https://googleplex-android-review.git.corp.google.com/#/c/297944/
Change-Id: If0de1ec250a211890e1914d89e8b61780542a675
| -rw-r--r-- | res/values/strings.xml | 9 | ||||
| -rw-r--r-- | src/com/android/gallery3d/app/CommonControllerOverlay.java | 23 |
2 files changed, 27 insertions, 5 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 7f8e083f5..8fa8f3471 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -921,6 +921,15 @@ <!-- button in review mode indicate the user want to retake another photo/video for attachment [ CHAR LIMIT = NONE] --> <string name="accessibility_review_retake">Review retake</string> + <!-- The button to play the video. [CHAR LIMIT = NONE] --> + <string name="accessibility_play_video">Play video</string> + <!-- The button to pause the video. [CHAR LIMIT = NONE] --> + <string name="accessibility_pause_video">Pause video</string> + <!-- The button to reload the video. [CHAR LIMIT = NONE] --> + <string name="accessibility_reload_video">Reload video</string> + <!-- The time bar of the media player. [CHAR LIMIT = NONE] --> + <string name="accessibility_time_bar">Video player time bar</string> + <!-- TODO: remove the string as it is a work-around solution to bypass the default speak of the element type. --> <string name="empty" translatable="false">" "</string> diff --git a/src/com/android/gallery3d/app/CommonControllerOverlay.java b/src/com/android/gallery3d/app/CommonControllerOverlay.java index a5aa805ef..a4f5807ae 100644 --- a/src/com/android/gallery3d/app/CommonControllerOverlay.java +++ b/src/com/android/gallery3d/app/CommonControllerOverlay.java @@ -17,6 +17,7 @@ package com.android.gallery3d.app; import android.content.Context; +import android.content.res.Resources; import android.graphics.Rect; import android.view.Gravity; import android.view.KeyEvent; @@ -83,7 +84,8 @@ public abstract class CommonControllerOverlay extends FrameLayout implements // multiple ones for trimming. createTimeBar(context); addView(mTimeBar, wrapContent); - + mTimeBar.setContentDescription( + context.getResources().getString(R.string.accessibility_time_bar)); mLoadingView = new LinearLayout(context); mLoadingView.setOrientation(LinearLayout.VERTICAL); mLoadingView.setGravity(Gravity.CENTER_HORIZONTAL); @@ -97,6 +99,8 @@ public abstract class CommonControllerOverlay extends FrameLayout implements mPlayPauseReplayView = new ImageView(context); mPlayPauseReplayView.setImageResource(R.drawable.ic_vidcontrol_play); + mPlayPauseReplayView.setContentDescription( + context.getResources().getString(R.string.accessibility_play_video)); mPlayPauseReplayView.setBackgroundResource(R.drawable.bg_vidcontrol); mPlayPauseReplayView.setScaleType(ScaleType.CENTER); mPlayPauseReplayView.setFocusable(true); @@ -299,10 +303,19 @@ public abstract class CommonControllerOverlay extends FrameLayout implements protected void updateViews() { mBackground.setVisibility(View.VISIBLE); mTimeBar.setVisibility(View.VISIBLE); - mPlayPauseReplayView.setImageResource( - mState == State.PAUSED ? R.drawable.ic_vidcontrol_play : - mState == State.PLAYING ? R.drawable.ic_vidcontrol_pause : - R.drawable.ic_vidcontrol_reload); + Resources resources = getContext().getResources(); + int imageResource = R.drawable.ic_vidcontrol_reload; + String contentDescription = resources.getString(R.string.accessibility_reload_video); + if (mState == State.PAUSED) { + imageResource = R.drawable.ic_vidcontrol_play; + contentDescription = resources.getString(R.string.accessibility_play_video); + } else if (mState == State.PLAYING) { + imageResource = R.drawable.ic_vidcontrol_pause; + contentDescription = resources.getString(R.string.accessibility_pause_video); + } + + mPlayPauseReplayView.setImageResource(imageResource); + mPlayPauseReplayView.setContentDescription(contentDescription); mPlayPauseReplayView.setVisibility( (mState != State.LOADING && mState != State.ERROR && !(mState == State.ENDED && !mCanReplay)) |
