[Android] AudioPlayerActivity: add contentDescriptions for accessibility
Edward Wang
git at videolan.org
Sun Nov 4 15:18:35 CET 2012
vlc-ports/android | branch: master | Edward Wang <edward.c.wang at compdigitec.com> | Sun Nov 4 09:06:47 2012 -0500| [d480a2ab89b2649d0176b9bdbb5305405af10ac1] | committer: Edward Wang
AudioPlayerActivity: add contentDescriptions for accessibility
> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=d480a2ab89b2649d0176b9bdbb5305405af10ac1
---
vlc-android/res/layout/audio_player.xml | 54 ++++++++++++--------
vlc-android/res/values/strings.xml | 8 +++
.../vlc/gui/audio/AudioPlayerActivity.java | 2 +
3 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/vlc-android/res/layout/audio_player.xml b/vlc-android/res/layout/audio_player.xml
index 0b5dcea..e578148 100644
--- a/vlc-android/res/layout/audio_player.xml
+++ b/vlc-android/res/layout/audio_player.xml
@@ -14,13 +14,15 @@
android:src="@drawable/header_logo"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
- android:scaleType="centerInside" />
+ android:scaleType="centerInside"
+ android:contentDescription="@string/app_name" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1">
<ImageView
+ android:contentDescription="@string/cover_art"
android:layout_height="fill_parent"
android:layout_width="0dip"
android:layout_weight="1"
@@ -41,6 +43,7 @@
android:layout_height="60dip"
android:layout_width="60dip"
android:layout_marginBottom="10dip"
+ android:contentDescription="@string/shuffle"
android:id="@+id/shuffle"
android:onClick="onShuffleClick" />
<ImageButton
@@ -51,6 +54,7 @@
android:layout_height="60dip"
android:layout_width="60dip"
android:layout_marginTop="10dip"
+ android:contentDescription="@string/repeat"
android:id="@+id/repeat"
android:onClick="onRepeatClick" />
@@ -155,42 +159,48 @@
android:gravity="center"
android:layout_margin="10dip">
<ImageButton
- android:src="@drawable/ic_backward"
- android:scaleType="fitXY"
- android:background="#00000000"
- android:layout_height="70dip"
- android:layout_width="70dip"
android:id="@+id/previous"
- android:onClick="onPreviousClick" />
- <ImageButton
- android:src="@drawable/ic_pause"
- android:scaleType="fitXY"
+ android:layout_width="70dip"
+ android:layout_height="70dip"
android:background="#00000000"
+ android:contentDescription="@string/previous"
+ android:onClick="onPreviousClick"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_backward" />
+
+ <ImageButton
+ android:id="@+id/play_pause"
android:layout_width="70dip"
android:layout_height="70dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
- android:id="@+id/play_pause"
- android:onClick="onPlayPauseClick" />
+ android:background="#00000000"
+ android:contentDescription="@string/pause"
+ android:onClick="onPlayPauseClick"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_pause" />
<ImageButton
android:id="@+id/stop"
- android:scaleType="fitXY"
- android:background="#00000000"
android:layout_width="70dip"
android:layout_height="70dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
- android:src="@drawable/ic_stop"
- android:onClick="onStopClick" />
+ android:background="#00000000"
+ android:contentDescription="@string/stop"
+ android:onClick="onStopClick"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_stop" />
<ImageButton
- android:src="@drawable/ic_forward"
- android:scaleType="fitXY"
- android:background="#00000000"
- android:layout_height="70dip"
- android:layout_width="70dip"
android:id="@+id/next"
- android:onClick="onNextClick" />
+ android:layout_width="70dip"
+ android:layout_height="70dip"
+ android:background="#00000000"
+ android:contentDescription="@string/next"
+ android:onClick="onNextClick"
+ android:scaleType="fitXY"
+ android:src="@drawable/ic_forward" />
+
</LinearLayout>
</LinearLayout>
diff --git a/vlc-android/res/values/strings.xml b/vlc-android/res/values/strings.xml
index 9b80042..18ab425 100644
--- a/vlc-android/res/values/strings.xml
+++ b/vlc-android/res/values/strings.xml
@@ -80,6 +80,14 @@
<string name="nosubdirectory">No subdirectories.</string>
<string name="nohistory">You have no playback history yet.</string>
<string name="validation">Are you sure?</string>
+
+ <string name="cover_art">Cover art</string>
+ <string name="shuffle">Shuffle</string>
+ <string name="repeat">Repeat none/single/all</string>
+ <string name="previous">Previous</string>
+ <string name="stop">Stop</string>
+ <string name="next">Next</string>
+
<string name="lock_rotation">Lock screen rotation</string>
<string name="locked">Locked</string>
<string name="unlocked">Unlocked</string>
diff --git a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
index c73e875..b611d95 100644
--- a/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/audio/AudioPlayerActivity.java
@@ -173,8 +173,10 @@ public class AudioPlayerActivity extends Activity implements IAudioPlayer {
mTimeline.setProgress(time);
if (mAudioController.isPlaying()) {
mPlayPause.setImageResource(R.drawable.ic_pause);
+ mPlayPause.setContentDescription(getString(R.string.pause));
} else {
mPlayPause.setImageResource(R.drawable.ic_play);
+ mPlayPause.setContentDescription(getString(R.string.play));
}
if (mAudioController.isShuffling()) {
mShuffle.setImageResource(R.drawable.ic_shuffle_glow);
More information about the Android
mailing list