aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-04-17 08:56:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-17 08:56:22 +0000
commit8180b02bedae2ba8056e31d8ff3af600b2167ea3 (patch)
tree01c281daab2700cf76bffcfd42d7edb8313c68a2 /java
parent20b0c3c5a9594e98d5468460585148cb8ace2076 (diff)
parentbfc998096b506ab4813267bc47ff312a37fcef84 (diff)
downloadlatinime-8180b02bedae2ba8056e31d8ff3af600b2167ea3.tar.gz
latinime-8180b02bedae2ba8056e31d8ff3af600b2167ea3.tar.xz
latinime-8180b02bedae2ba8056e31d8ff3af600b2167ea3.zip
Merge "Add contentDescription to Emoji palette"
Diffstat (limited to 'java')
-rw-r--r--java/res/layout/emoji_keyboard_tab_icon.xml2
-rw-r--r--java/res/layout/emoji_palettes_view.xml6
-rw-r--r--java/res/layout/suggestion_divider.xml1
-rw-r--r--java/res/values/strings-talkback-descriptions.xml15
-rw-r--r--java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java18
5 files changed, 39 insertions, 3 deletions
diff --git a/java/res/layout/emoji_keyboard_tab_icon.xml b/java/res/layout/emoji_keyboard_tab_icon.xml
index 1609f6a26..13bb41ca2 100644
--- a/java/res/layout/emoji_keyboard_tab_icon.xml
+++ b/java/res/layout/emoji_keyboard_tab_icon.xml
@@ -18,10 +18,12 @@
*/
-->
+<!-- Note: contentDescription will be added programatically in {@link EmojiPalettesView}. -->
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dip"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:gravity="center"
android:scaleType="center"
+ android:contentDescription="@null"
/>
diff --git a/java/res/layout/emoji_palettes_view.xml b/java/res/layout/emoji_palettes_view.xml
index ef565a4f8..552a474b4 100644
--- a/java/res/layout/emoji_palettes_view.xml
+++ b/java/res/layout/emoji_palettes_view.xml
@@ -71,7 +71,8 @@
android:layout_weight="12.5"
android:layout_height="match_parent"
android:background="@color/emoji_key_background_color"
- android:src="@drawable/sym_keyboard_delete_holo_dark" />
+ android:src="@drawable/sym_keyboard_delete_holo_dark"
+ android:contentDescription="@string/spoken_description_delete" />
</LinearLayout>
<android.support.v4.view.ViewPager
android:id="@+id/emoji_keyboard_pager"
@@ -99,7 +100,8 @@
android:id="@+id/emoji_keyboard_space"
android:layout_width="0dip"
android:layout_weight="0.70"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:contentDescription="@string/spoken_description_space"/>
<TextView
android:id="@+id/emoji_keyboard_alphabet_right"
android:layout_width="0dip"
diff --git a/java/res/layout/suggestion_divider.xml b/java/res/layout/suggestion_divider.xml
index a8b78c082..149095147 100644
--- a/java/res/layout/suggestion_divider.xml
+++ b/java/res/layout/suggestion_divider.xml
@@ -23,5 +23,6 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/suggestions_strip_divider"
+ android:contentDescription="@null"
android:padding="0dp"
android:gravity="center" />
diff --git a/java/res/values/strings-talkback-descriptions.xml b/java/res/values/strings-talkback-descriptions.xml
index 03b191e59..9c1e652b0 100644
--- a/java/res/values/strings-talkback-descriptions.xml
+++ b/java/res/values/strings-talkback-descriptions.xml
@@ -108,4 +108,19 @@
<string name="keyboard_mode_time">time</string>
<!-- Description of the keyboard mode for entering URLs. -->
<string name="keyboard_mode_url">URL</string>
+
+ <!-- Description of the emoji category icon of Recents. -->
+ <string name="spoken_descrption_emoji_category_recents">Recents</string>
+ <!-- Description of the emoji category icon of People. -->
+ <string name="spoken_descrption_emoji_category_people">People</string>
+ <!-- Description of the emoji category icon of Objects. -->
+ <string name="spoken_descrption_emoji_category_objects">Objects</string>
+ <!-- Description of the emoji category icon of Nature. -->
+ <string name="spoken_descrption_emoji_category_nature">Nature</string>
+ <!-- Description of the emoji category icon of Places. -->
+ <string name="spoken_descrption_emoji_category_places">Places</string>
+ <!-- Description of the emoji category icon of Symbols. -->
+ <string name="spoken_descrption_emoji_category_symbols">Symbols</string>
+ <!-- Description of the emoji category icon of Emoticons. -->
+ <string name="spoken_descrption_emoji_category_emoticons">Emoticons</string>
</resources>
diff --git a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
index 8822ccec9..ad996971f 100644
--- a/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
+++ b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
@@ -123,7 +123,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
"places",
"symbols",
"emoticons" };
- private static final int[] sCategoryIcon = new int[] {
+ private static final int[] sCategoryIcon = {
R.drawable.ic_emoji_recent_light,
R.drawable.ic_emoji_people_light,
R.drawable.ic_emoji_objects_light,
@@ -133,6 +133,14 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
0 };
private static final String[] sCategoryLabel =
{ null, null, null, null, null, null, ":-)" };
+ private static final int[] sAccessibilityDescriptionResourceIdsForCategories = {
+ R.string.spoken_descrption_emoji_category_recents,
+ R.string.spoken_descrption_emoji_category_people,
+ R.string.spoken_descrption_emoji_category_objects,
+ R.string.spoken_descrption_emoji_category_nature,
+ R.string.spoken_descrption_emoji_category_places,
+ R.string.spoken_descrption_emoji_category_symbols,
+ R.string.spoken_descrption_emoji_category_emoticons };
private static final int[] sCategoryElementId = {
KeyboardId.ELEMENT_EMOJI_RECENTS,
KeyboardId.ELEMENT_EMOJI_CATEGORY1,
@@ -142,6 +150,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
KeyboardId.ELEMENT_EMOJI_CATEGORY5,
KeyboardId.ELEMENT_EMOJI_CATEGORY6 };
private final SharedPreferences mPrefs;
+ private final Resources mRes;
private final int mMaxPageKeyCount;
private final KeyboardLayoutSet mLayoutSet;
private final HashMap<String, Integer> mCategoryNameToIdMap = CollectionUtils.newHashMap();
@@ -156,6 +165,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
public EmojiCategory(final SharedPreferences prefs, final Resources res,
final KeyboardLayoutSet layoutSet) {
mPrefs = prefs;
+ mRes = res;
mMaxPageKeyCount = res.getInteger(R.integer.config_emoji_keyboard_max_page_key_count);
mLayoutSet = layoutSet;
for (int i = 0; i < sCategoryName.length; ++i) {
@@ -206,6 +216,10 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
return sCategoryLabel[categoryId];
}
+ public String getAccessibilityDescription(final int categoryId) {
+ return mRes.getString(sAccessibilityDescriptionResourceIdsForCategories[categoryId]);
+ }
+
public ArrayList<CategoryProperties> getShownCategories() {
return mShownCategories;
}
@@ -447,12 +461,14 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
final ImageView iconView = (ImageView)LayoutInflater.from(getContext()).inflate(
R.layout.emoji_keyboard_tab_icon, null);
iconView.setImageResource(mEmojiCategory.getCategoryIcon(categoryId));
+ iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
tspec.setIndicator(iconView);
}
if (mEmojiCategory.getCategoryLabel(categoryId) != null) {
final TextView textView = (TextView)LayoutInflater.from(getContext()).inflate(
R.layout.emoji_keyboard_tab_label, null);
textView.setText(mEmojiCategory.getCategoryLabel(categoryId));
+ textView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
textView.setTextColor(mTabLabelColor);
tspec.setIndicator(textView);
}