am 27ca9f1b: Remove Emoji label tab

* commit '27ca9f1bf17c1d275faed939d529f07bb57e28f3':
  Remove Emoji label tab
main
Tadashi G. Takaoka 2014-05-19 16:46:34 +00:00 committed by Android Git Automerger
commit f808633db1
27 changed files with 64 additions and 120 deletions

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_focused="true"
android:color="@color/key_text_color_holo" />
<item
android:state_pressed="true"
android:color="@color/key_text_color_holo" />
<item
android:state_selected="true"
android:color="@color/key_text_color_holo" />
<item
android:color="@color/key_text_inactivated_color_holo" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 990 B

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 873 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -21,13 +21,12 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:state_focused="true" android:state_focused="true"
android:color="@color/key_text_color_lxx_dark" /> android:drawable="@drawable/ic_emoji_emoticons_activated_holo_dark" />
<item <item
android:state_pressed="true" android:state_pressed="true"
android:color="@color/key_text_color_lxx_dark" /> android:drawable="@drawable/ic_emoji_emoticons_activated_holo_dark" />
<item <item
android:state_selected="true" android:state_selected="true"
android:color="@color/key_text_color_lxx_dark" /> android:drawable="@drawable/ic_emoji_emoticons_activated_holo_dark" />
<item <item android:drawable="@drawable/ic_emoji_emoticons_normal_holo_dark" />
android:color="@color/key_text_inactive_color_lxx_dark" />
</selector> </selector>

View File

@ -21,12 +21,12 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item <item
android:state_focused="true" android:state_focused="true"
android:drawable="@drawable/ic_emoji_recent_activated_holo_dark" /> android:drawable="@drawable/ic_emoji_recents_activated_holo_dark" />
<item <item
android:state_pressed="true" android:state_pressed="true"
android:drawable="@drawable/ic_emoji_recent_activated_holo_dark" /> android:drawable="@drawable/ic_emoji_recents_activated_holo_dark" />
<item <item
android:state_selected="true" android:state_selected="true"
android:drawable="@drawable/ic_emoji_recent_activated_holo_dark" /> android:drawable="@drawable/ic_emoji_recents_activated_holo_dark" />
<item android:drawable="@drawable/ic_emoji_recent_normal_holo_dark" /> <item android:drawable="@drawable/ic_emoji_recents_normal_holo_dark" />
</selector> </selector>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2013, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
** http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<TextView 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"
/>

View File

@ -70,7 +70,6 @@
android:layout_width="0dip" android:layout_width="0dip"
android:layout_weight="12.5" android:layout_weight="12.5"
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/sym_keyboard_delete_holo_dark"
android:contentDescription="@string/spoken_description_delete" /> android:contentDescription="@string/spoken_description_delete" />
</LinearLayout> </LinearLayout>
<android.support.v4.view.ViewPager <android.support.v4.view.ViewPager

View File

@ -172,7 +172,13 @@
</declare-styleable> </declare-styleable>
<declare-styleable name="EmojiPalettesView"> <declare-styleable name="EmojiPalettesView">
<attr name="emojiTabLabelColor" format="reference" /> <attr name="iconEmojiRecentsTab" format="reference" />
<attr name="iconEmojiCategory1Tab" format="reference" />
<attr name="iconEmojiCategory2Tab" format="reference" />
<attr name="iconEmojiCategory3Tab" format="reference" />
<attr name="iconEmojiCategory4Tab" format="reference" />
<attr name="iconEmojiCategory5Tab" format="reference" />
<attr name="iconEmojiCategory6Tab" format="reference" />
</declare-styleable> </declare-styleable>
<declare-styleable name="SuggestionStripView"> <declare-styleable name="SuggestionStripView">

View File

@ -87,7 +87,13 @@
name="EmojiPalettesView.ICS" name="EmojiPalettesView.ICS"
parent="MainKeyboardView.ICS" parent="MainKeyboardView.ICS"
> >
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> <item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item>
<item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item>
<item name="iconEmojiCategory2Tab">@drawable/ic_emoji_objects_holo_dark</item>
<item name="iconEmojiCategory3Tab">@drawable/ic_emoji_nature_holo_dark</item>
<item name="iconEmojiCategory4Tab">@drawable/ic_emoji_places_holo_dark</item>
<item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item>
<item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item>
</style> </style>
<style <style
name="MoreKeysKeyboard.ICS" name="MoreKeysKeyboard.ICS"

View File

@ -87,7 +87,13 @@
name="EmojiPalettesView.KLP" name="EmojiPalettesView.KLP"
parent="MainKeyboardView.KLP" parent="MainKeyboardView.KLP"
> >
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_holo</item> <item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item>
<item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item>
<item name="iconEmojiCategory2Tab">@drawable/ic_emoji_objects_holo_dark</item>
<item name="iconEmojiCategory3Tab">@drawable/ic_emoji_nature_holo_dark</item>
<item name="iconEmojiCategory4Tab">@drawable/ic_emoji_places_holo_dark</item>
<item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item>
<item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item>
</style> </style>
<style <style
name="MoreKeysKeyboard.KLP" name="MoreKeysKeyboard.KLP"

View File

@ -88,7 +88,14 @@
name="EmojiPalettesView.LXX_Dark" name="EmojiPalettesView.LXX_Dark"
parent="MainKeyboardView.LXX_Dark" parent="MainKeyboardView.LXX_Dark"
> >
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_lxx_dark</item> <!-- TODO: Update those icons to LXX_Dark theme. -->
<item name="iconEmojiRecentsTab">@drawable/ic_emoji_recents_holo_dark</item>
<item name="iconEmojiCategory1Tab">@drawable/ic_emoji_people_holo_dark</item>
<item name="iconEmojiCategory2Tab">@drawable/ic_emoji_objects_holo_dark</item>
<item name="iconEmojiCategory3Tab">@drawable/ic_emoji_nature_holo_dark</item>
<item name="iconEmojiCategory4Tab">@drawable/ic_emoji_places_holo_dark</item>
<item name="iconEmojiCategory5Tab">@drawable/ic_emoji_symbols_holo_dark</item>
<item name="iconEmojiCategory6Tab">@drawable/ic_emoji_emoticons_holo_dark</item>
</style> </style>
<style <style
name="MoreKeysKeyboard.LXX_Dark" name="MoreKeysKeyboard.LXX_Dark"

View File

@ -18,6 +18,7 @@ package com.android.inputmethod.keyboard.emoji;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Build; import android.os.Build;
import android.util.Log; import android.util.Log;
@ -69,17 +70,14 @@ final class EmojiCategory {
"symbols", "symbols",
"emoticons" }; "emoticons" };
private static final int[] sCategoryIcon = { private static final int[] sCategoryTabIconAttr = {
R.drawable.ic_emoji_recent_holo_dark, R.styleable.EmojiPalettesView_iconEmojiRecentsTab,
R.drawable.ic_emoji_people_holo_dark, R.styleable.EmojiPalettesView_iconEmojiCategory1Tab,
R.drawable.ic_emoji_objects_holo_dark, R.styleable.EmojiPalettesView_iconEmojiCategory2Tab,
R.drawable.ic_emoji_nature_holo_dark, R.styleable.EmojiPalettesView_iconEmojiCategory3Tab,
R.drawable.ic_emoji_places_holo_dark, R.styleable.EmojiPalettesView_iconEmojiCategory4Tab,
R.drawable.ic_emoji_symbols_holo_dark, R.styleable.EmojiPalettesView_iconEmojiCategory5Tab,
0 }; R.styleable.EmojiPalettesView_iconEmojiCategory6Tab };
private static final String[] sCategoryLabel =
{ null, null, null, null, null, null, ":-)" };
private static final int[] sAccessibilityDescriptionResourceIdsForCategories = { private static final int[] sAccessibilityDescriptionResourceIdsForCategories = {
R.string.spoken_descrption_emoji_category_recents, R.string.spoken_descrption_emoji_category_recents,
@ -104,6 +102,7 @@ final class EmojiCategory {
private final int mMaxPageKeyCount; private final int mMaxPageKeyCount;
private final KeyboardLayoutSet mLayoutSet; private final KeyboardLayoutSet mLayoutSet;
private final HashMap<String, Integer> mCategoryNameToIdMap = CollectionUtils.newHashMap(); private final HashMap<String, Integer> mCategoryNameToIdMap = CollectionUtils.newHashMap();
private final int[] mCategoryTabIconId = new int[sCategoryName.length];
private final ArrayList<CategoryProperties> mShownCategories = private final ArrayList<CategoryProperties> mShownCategories =
CollectionUtils.newArrayList(); CollectionUtils.newArrayList();
private final ConcurrentHashMap<Long, DynamicGridKeyboard> private final ConcurrentHashMap<Long, DynamicGridKeyboard>
@ -113,13 +112,15 @@ final class EmojiCategory {
private int mCurrentCategoryPageId = 0; private int mCurrentCategoryPageId = 0;
public EmojiCategory(final SharedPreferences prefs, final Resources res, public EmojiCategory(final SharedPreferences prefs, final Resources res,
final KeyboardLayoutSet layoutSet) { final KeyboardLayoutSet layoutSet, final TypedArray emojiPaletteViewAttr) {
mPrefs = prefs; mPrefs = prefs;
mRes = res; mRes = res;
mMaxPageKeyCount = res.getInteger(R.integer.config_emoji_keyboard_max_page_key_count); mMaxPageKeyCount = res.getInteger(R.integer.config_emoji_keyboard_max_page_key_count);
mLayoutSet = layoutSet; mLayoutSet = layoutSet;
for (int i = 0; i < sCategoryName.length; ++i) { for (int i = 0; i < sCategoryName.length; ++i) {
mCategoryNameToIdMap.put(sCategoryName[i], i); mCategoryNameToIdMap.put(sCategoryName[i], i);
mCategoryTabIconId[i] = emojiPaletteViewAttr.getResourceId(
sCategoryTabIconAttr[i], 0);
} }
addShownCategoryId(EmojiCategory.ID_RECENTS); addShownCategoryId(EmojiCategory.ID_RECENTS);
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2 if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2
@ -158,12 +159,8 @@ final class EmojiCategory {
return mCategoryNameToIdMap.get(strings[0]); return mCategoryNameToIdMap.get(strings[0]);
} }
public int getCategoryIcon(final int categoryId) { public int getCategoryTabIcon(final int categoryId) {
return sCategoryIcon[categoryId]; return mCategoryTabIconId[categoryId];
}
public String getCategoryLabel(final int categoryId) {
return sCategoryLabel[categoryId];
} }
public String getAccessibilityDescription(final int categoryId) { public String getAccessibilityDescription(final int categoryId) {

View File

@ -19,11 +19,9 @@ package com.android.inputmethod.keyboard.emoji;
import static com.android.inputmethod.latin.Constants.NOT_A_COORDINATE; import static com.android.inputmethod.latin.Constants.NOT_A_COORDINATE;
import android.content.Context; import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources; import android.content.res.Resources;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Typeface;
import android.os.CountDownTimer; import android.os.CountDownTimer;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager;
@ -56,7 +54,7 @@ import java.util.concurrent.TimeUnit;
/** /**
* View class to implement Emoji palettes. * View class to implement Emoji palettes.
* The Emoji keyboard consists of group of views {@link R.layout#emoji_palettes_view}. * The Emoji keyboard consists of group of views layout/emoji_palettes_view.
* <ol> * <ol>
* <li> Emoji category tabs. * <li> Emoji category tabs.
* <li> Delete button. * <li> Delete button.
@ -70,7 +68,6 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
EmojiPageKeyboardView.OnKeyEventListener { EmojiPageKeyboardView.OnKeyEventListener {
private final int mFunctionalKeyBackgroundId; private final int mFunctionalKeyBackgroundId;
private final int mSpacebarBackgroundId; private final int mSpacebarBackgroundId;
private final ColorStateList mTabLabelColor;
private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener; private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener;
private EmojiPalettesAdapter mEmojiPalettesAdapter; private EmojiPalettesAdapter mEmojiPalettesAdapter;
private final EmojiLayoutParams mEmojiLayoutParams; private final EmojiLayoutParams mEmojiLayoutParams;
@ -103,11 +100,6 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
mSpacebarBackgroundId = keyboardViewAttr.getResourceId( mSpacebarBackgroundId = keyboardViewAttr.getResourceId(
R.styleable.KeyboardView_spacebarBackground, keyBackgroundId); R.styleable.KeyboardView_spacebarBackground, keyBackgroundId);
keyboardViewAttr.recycle(); keyboardViewAttr.recycle();
final TypedArray emojiPalettesViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.EmojiPalettesView, defStyle, R.style.EmojiPalettesView);
mTabLabelColor = emojiPalettesViewAttr.getColorStateList(
R.styleable.EmojiPalettesView_emojiTabLabelColor);
emojiPalettesViewAttr.recycle();
final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder( final KeyboardLayoutSet.Builder builder = new KeyboardLayoutSet.Builder(
context, null /* editorInfo */); context, null /* editorInfo */);
final Resources res = context.getResources(); final Resources res = context.getResources();
@ -117,8 +109,12 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
mEmojiLayoutParams.mEmojiKeyboardHeight); mEmojiLayoutParams.mEmojiKeyboardHeight);
builder.setOptions(false /* shortcutImeEnabled */, false /* showsVoiceInputKey */, builder.setOptions(false /* shortcutImeEnabled */, false /* showsVoiceInputKey */,
false /* languageSwitchKeyEnabled */); false /* languageSwitchKeyEnabled */);
final KeyboardLayoutSet layoutSet = builder.build();
final TypedArray emojiPalettesViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.EmojiPalettesView, defStyle, R.style.EmojiPalettesView);
mEmojiCategory = new EmojiCategory(PreferenceManager.getDefaultSharedPreferences(context), mEmojiCategory = new EmojiCategory(PreferenceManager.getDefaultSharedPreferences(context),
context.getResources(), builder.build()); res, layoutSet, emojiPalettesViewAttr);
emojiPalettesViewAttr.recycle();
mDeleteKeyOnTouchListener = new DeleteKeyOnTouchListener(context); mDeleteKeyOnTouchListener = new DeleteKeyOnTouchListener(context);
} }
@ -139,24 +135,11 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
final String tabId = mEmojiCategory.getCategoryName(categoryId, 0 /* categoryPageId */); final String tabId = mEmojiCategory.getCategoryName(categoryId, 0 /* categoryPageId */);
final TabHost.TabSpec tspec = host.newTabSpec(tabId); final TabHost.TabSpec tspec = host.newTabSpec(tabId);
tspec.setContent(R.id.emoji_keyboard_dummy); tspec.setContent(R.id.emoji_keyboard_dummy);
if (mEmojiCategory.getCategoryIcon(categoryId) != 0) { final ImageView iconView = (ImageView)LayoutInflater.from(getContext()).inflate(
final ImageView iconView = (ImageView)LayoutInflater.from(getContext()).inflate( R.layout.emoji_keyboard_tab_icon, null);
R.layout.emoji_keyboard_tab_icon, null); iconView.setImageResource(mEmojiCategory.getCategoryTabIcon(categoryId));
iconView.setImageResource(mEmojiCategory.getCategoryIcon(categoryId)); iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
iconView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId)); tspec.setIndicator(iconView);
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.setTypeface(Typeface.DEFAULT_BOLD);
textView.setContentDescription(mEmojiCategory.getAccessibilityDescription(categoryId));
if (mTabLabelColor != null) {
textView.setTextColor(mTabLabelColor);
}
tspec.setIndicator(textView);
}
host.addTab(tspec); host.addTab(tspec);
} }
@ -353,7 +336,7 @@ public final class EmojiPalettesView extends LinearLayout implements OnTabChange
private static void setupAlphabetKey(final TextView alphabetKey, final String label, private static void setupAlphabetKey(final TextView alphabetKey, final String label,
final KeyDrawParams params) { final KeyDrawParams params) {
alphabetKey.setText(label); alphabetKey.setText(label);
alphabetKey.setTextColor(params.mTextColor); alphabetKey.setTextColor(params.mFunctionalTextColor);
alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize); alphabetKey.setTextSize(TypedValue.COMPLEX_UNIT_PX, params.mLabelSize);
alphabetKey.setTypeface(params.mTypeface); alphabetKey.setTypeface(params.mTypeface);
} }