am 53e60a5e: am 6f726f6f: am d76b5529: Rename EmojiKeyboardView -> EmojiPalettesView

* commit '53e60a5e1ca7c93feff7e7486592fe85c011195d':
  Rename EmojiKeyboardView -> EmojiPalettesView
This commit is contained in:
Satoshi Kataoka 2013-10-09 21:25:50 -07:00 committed by Android Git Automerger
commit 1dcb5bdc94
9 changed files with 50 additions and 44 deletions

View file

@ -18,13 +18,13 @@
*/ */
--> -->
<com.android.inputmethod.keyboard.EmojiKeyboardView <com.android.inputmethod.keyboard.EmojiPalettesView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/emoji_keyboard_view" android:id="@+id/emoji_keyboard_view"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="?attr/emojiKeyboardViewStyle" style="?attr/emojiPalettesViewStyle"
> >
<LinearLayout <LinearLayout
android:orientation="horizontal" android:orientation="horizontal"
@ -107,4 +107,4 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/sym_keyboard_return_holo_dark" /> android:src="@drawable/sym_keyboard_return_holo_dark" />
</LinearLayout> </LinearLayout>
</com.android.inputmethod.keyboard.EmojiKeyboardView> </com.android.inputmethod.keyboard.EmojiPalettesView>

View file

@ -56,5 +56,5 @@
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
<include <include
layout="@layout/emoji_keyboard_view" /> layout="@layout/emoji_palettes_view" />
</com.android.inputmethod.latin.InputView> </com.android.inputmethod.latin.InputView>

View file

@ -26,8 +26,8 @@
<attr name="keyboardViewStyle" format="reference" /> <attr name="keyboardViewStyle" format="reference" />
<!-- MainKeyboardView style --> <!-- MainKeyboardView style -->
<attr name="mainKeyboardViewStyle" format="reference" /> <attr name="mainKeyboardViewStyle" format="reference" />
<!-- EmojiKeyboardView style --> <!-- EmojiPalettesView style -->
<attr name="emojiKeyboardViewStyle" format="reference" /> <attr name="emojiPalettesViewStyle" format="reference" />
<!-- MoreKeysKeyboard style --> <!-- MoreKeysKeyboard style -->
<attr name="moreKeysKeyboardStyle" format="reference" /> <attr name="moreKeysKeyboardStyle" format="reference" />
<!-- MoreKeysKeyboardView style --> <!-- MoreKeysKeyboardView style -->
@ -167,7 +167,7 @@
<attr name="suppressKeyPreviewAfterBatchInputDuration" format="integer" /> <attr name="suppressKeyPreviewAfterBatchInputDuration" format="integer" />
</declare-styleable> </declare-styleable>
<declare-styleable name="EmojiKeyboardView"> <declare-styleable name="EmojiPalettesView">
<attr name="emojiTabLabelColor" format="reference" /> <attr name="emojiTabLabelColor" format="reference" />
</declare-styleable> </declare-styleable>

View file

@ -104,10 +104,10 @@
<style <style
name="MainKeyboardView" name="MainKeyboardView"
parent="KeyboardView" /> parent="KeyboardView" />
<!-- Though {@link EmojiKeyboardView} doesn't extend {@link KeyboardView}, some views inside it, <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it,
for instance delete button, need themed {@link KeyboardView} attributes. --> for instance delete button, need themed {@link KeyboardView} attributes. -->
<style <style
name="EmojiKeyboardView" name="EmojiPalettesView"
parent="KeyboardView" parent="KeyboardView"
> >
<item name="emojiTabLabelColor">@color/emoji_tab_label_color_ics</item> <item name="emojiTabLabelColor">@color/emoji_tab_label_color_ics</item>

View file

@ -23,7 +23,7 @@
<item name="keyboardStyle">@style/Keyboard.GB</item> <item name="keyboardStyle">@style/Keyboard.GB</item>
<item name="keyboardViewStyle">@style/KeyboardView.GB</item> <item name="keyboardViewStyle">@style/KeyboardView.GB</item>
<item name="mainKeyboardViewStyle">@style/MainKeyboardView.GB</item> <item name="mainKeyboardViewStyle">@style/MainKeyboardView.GB</item>
<item name="emojiKeyboardViewStyle">@style/EmojiKeyboardView.GB</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.GB</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.GB</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.GB</item>
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.GB</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.GB</item>
<item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.GB</item> <item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.GB</item>
@ -96,10 +96,10 @@
<item name="spacebarTextColor">@color/spacebar_text_color_gb</item> <item name="spacebarTextColor">@color/spacebar_text_color_gb</item>
<item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_gb</item> <item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_gb</item>
</style> </style>
<!-- Though {@link EmojiKeyboardView} doesn't extend {@link KeyboardView}, some views inside it, <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it,
for instance delete button, need themed {@link KeyboardView} attributes. --> for instance delete button, need themed {@link KeyboardView} attributes. -->
<style <style
name="EmojiKeyboardView.GB" name="EmojiPalettesView.GB"
parent="KeyboardView.GB" parent="KeyboardView.GB"
> >
<item name="keyBackground">@drawable/btn_keyboard_key_functional_gb</item> <item name="keyBackground">@drawable/btn_keyboard_key_functional_gb</item>

View file

@ -23,7 +23,7 @@
<item name="keyboardStyle">@style/Keyboard.ICS</item> <item name="keyboardStyle">@style/Keyboard.ICS</item>
<item name="keyboardViewStyle">@style/KeyboardView.ICS</item> <item name="keyboardViewStyle">@style/KeyboardView.ICS</item>
<item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item> <item name="mainKeyboardViewStyle">@style/MainKeyboardView.ICS</item>
<item name="emojiKeyboardViewStyle">@style/EmojiKeyboardView.ICS</item> <item name="emojiPalettesViewStyle">@style/EmojiPalettesView.ICS</item>
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item> <item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.ICS</item>
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item> <item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.ICS</item>
<item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.ICS</item> <item name="moreKeysKeyboardContainerStyle">@style/MoreKeysKeyboardContainer.ICS</item>
@ -97,10 +97,10 @@
<item name="spacebarTextColor">@color/spacebar_text_color_ics</item> <item name="spacebarTextColor">@color/spacebar_text_color_ics</item>
<item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_ics</item> <item name="spacebarTextShadowColor">@color/spacebar_text_shadow_color_ics</item>
</style> </style>
<!-- Though {@link EmojiKeyboardView} doesn't extend {@link KeyboardView}, some views inside it, <!-- Though {@link EmojiPalettesView} doesn't extend {@link KeyboardView}, some views inside it,
for instance delete button, need themed {@link KeyboardView} attributes. --> for instance delete button, need themed {@link KeyboardView} attributes. -->
<style <style
name="EmojiKeyboardView.ICS" name="EmojiPalettesView.ICS"
parent="KeyboardView.ICS" parent="KeyboardView.ICS"
> >
<item name="keyBackgroundEmojiFunctional">@drawable/btn_keyboard_key_functional_ics</item> <item name="keyBackgroundEmojiFunctional">@drawable/btn_keyboard_key_functional_ics</item>

View file

@ -60,8 +60,8 @@ import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
/** /**
* View class to implement Emoji keyboards. * View class to implement Emoji palettes.
* The Emoji keyboard consists of group of views {@link R.layout#emoji_keyboard_view}. * The Emoji keyboard consists of group of views {@link R.layout#emoji_palettes_view}.
* <ol> * <ol>
* <li> Emoji category tabs. * <li> Emoji category tabs.
* <li> Delete button. * <li> Delete button.
@ -70,16 +70,16 @@ import java.util.concurrent.ConcurrentHashMap;
* </ol> * </ol>
* Because of the above reasons, this class doesn't extend {@link KeyboardView}. * Because of the above reasons, this class doesn't extend {@link KeyboardView}.
*/ */
public final class EmojiKeyboardView extends LinearLayout implements OnTabChangeListener, public final class EmojiPalettesView extends LinearLayout implements OnTabChangeListener,
ViewPager.OnPageChangeListener, View.OnClickListener, ViewPager.OnPageChangeListener, View.OnClickListener,
ScrollKeyboardView.OnKeyClickListener { ScrollKeyboardView.OnKeyClickListener {
private static final String TAG = EmojiKeyboardView.class.getSimpleName(); private static final String TAG = EmojiPalettesView.class.getSimpleName();
private final int mKeyBackgroundId; private final int mKeyBackgroundId;
private final int mEmojiFunctionalKeyBackgroundId; private final int mEmojiFunctionalKeyBackgroundId;
private final KeyboardLayoutSet mLayoutSet; private final KeyboardLayoutSet mLayoutSet;
private final ColorStateList mTabLabelColor; private final ColorStateList mTabLabelColor;
private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener; private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener;
private EmojiKeyboardAdapter mEmojiKeyboardAdapter; private EmojiPalettesAdapter mEmojiPalettesAdapter;
private TabHost mTabHost; private TabHost mTabHost;
private ViewPager mEmojiPager; private ViewPager mEmojiPager;
@ -378,11 +378,11 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
private final EmojiCategory mEmojiCategory; private final EmojiCategory mEmojiCategory;
public EmojiKeyboardView(final Context context, final AttributeSet attrs) { public EmojiPalettesView(final Context context, final AttributeSet attrs) {
this(context, attrs, R.attr.emojiKeyboardViewStyle); this(context, attrs, R.attr.emojiPalettesViewStyle);
} }
public EmojiKeyboardView(final Context context, final AttributeSet attrs, final int defStyle) { public EmojiPalettesView(final Context context, final AttributeSet attrs, final int defStyle) {
super(context, attrs, defStyle); super(context, attrs, defStyle);
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs, final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.KeyboardView, defStyle, R.style.KeyboardView); R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
@ -391,11 +391,11 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mEmojiFunctionalKeyBackgroundId = keyboardViewAttr.getResourceId( mEmojiFunctionalKeyBackgroundId = keyboardViewAttr.getResourceId(
R.styleable.KeyboardView_keyBackgroundEmojiFunctional, 0); R.styleable.KeyboardView_keyBackgroundEmojiFunctional, 0);
keyboardViewAttr.recycle(); keyboardViewAttr.recycle();
final TypedArray emojiKeyboardViewAttr = context.obtainStyledAttributes(attrs, final TypedArray emojiPalettesViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.EmojiKeyboardView, defStyle, R.style.EmojiKeyboardView); R.styleable.EmojiPalettesView, defStyle, R.style.EmojiPalettesView);
mTabLabelColor = emojiKeyboardViewAttr.getColorStateList( mTabLabelColor = emojiPalettesViewAttr.getColorStateList(
R.styleable.EmojiKeyboardView_emojiTabLabelColor); R.styleable.EmojiPalettesView_emojiTabLabelColor);
emojiKeyboardViewAttr.recycle(); 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();
@ -453,10 +453,10 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mTabHost.setOnTabChangedListener(this); mTabHost.setOnTabChangedListener(this);
mTabHost.getTabWidget().setStripEnabled(true); mTabHost.getTabWidget().setStripEnabled(true);
mEmojiKeyboardAdapter = new EmojiKeyboardAdapter(mEmojiCategory, mLayoutSet, this); mEmojiPalettesAdapter = new EmojiPalettesAdapter(mEmojiCategory, mLayoutSet, this);
mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager); mEmojiPager = (ViewPager)findViewById(R.id.emoji_keyboard_pager);
mEmojiPager.setAdapter(mEmojiKeyboardAdapter); mEmojiPager.setAdapter(mEmojiPalettesAdapter);
mEmojiPager.setOnPageChangeListener(this); mEmojiPager.setOnPageChangeListener(this);
mEmojiPager.setOffscreenPageLimit(0); mEmojiPager.setOffscreenPageLimit(0);
final Resources res = getResources(); final Resources res = getResources();
@ -551,7 +551,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
@Override @Override
public void onKeyClick(final Key key) { public void onKeyClick(final Key key) {
mEmojiKeyboardAdapter.addRecentKey(key); mEmojiPalettesAdapter.addRecentKey(key);
mEmojiCategory.saveLastTypedCategoryPage(); mEmojiCategory.saveLastTypedCategoryPage();
final int code = key.getCode(); final int code = key.getCode();
if (code == Constants.CODE_OUTPUT_TEXT) { if (code == Constants.CODE_OUTPUT_TEXT) {
@ -604,7 +604,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
} }
} }
private static class EmojiKeyboardAdapter extends PagerAdapter { private static class EmojiPalettesAdapter extends PagerAdapter {
private final ScrollKeyboardView.OnKeyClickListener mListener; private final ScrollKeyboardView.OnKeyClickListener mListener;
private final DynamicGridKeyboard mRecentsKeyboard; private final DynamicGridKeyboard mRecentsKeyboard;
private final SparseArray<ScrollKeyboardView> mActiveKeyboardView = private final SparseArray<ScrollKeyboardView> mActiveKeyboardView =
@ -612,7 +612,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
private final EmojiCategory mEmojiCategory; private final EmojiCategory mEmojiCategory;
private int mActivePosition = 0; private int mActivePosition = 0;
public EmojiKeyboardAdapter(final EmojiCategory emojiCategory, public EmojiPalettesAdapter(final EmojiCategory emojiCategory,
final KeyboardLayoutSet layoutSet, final KeyboardLayoutSet layoutSet,
final ScrollKeyboardView.OnKeyClickListener listener) { final ScrollKeyboardView.OnKeyClickListener listener) {
mEmojiCategory = emojiCategory; mEmojiCategory = emojiCategory;
@ -662,6 +662,12 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
@Override @Override
public Object instantiateItem(final ViewGroup container, final int position) { public Object instantiateItem(final ViewGroup container, final int position) {
final ScrollKeyboardView oldKeyboardView = mActiveKeyboardView.get(position);
if (oldKeyboardView != null) {
oldKeyboardView.deallocateMemory();
// This may be redundant but wanted to be safer..
mActiveKeyboardView.remove(position);
}
final Keyboard keyboard = final Keyboard keyboard =
mEmojiCategory.getKeyboardFromPagePosition(position); mEmojiCategory.getKeyboardFromPagePosition(position);
final LayoutInflater inflater = LayoutInflater.from(container.getContext()); final LayoutInflater inflater = LayoutInflater.from(container.getContext());

View file

@ -68,7 +68,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private InputView mCurrentInputView; private InputView mCurrentInputView;
private View mMainKeyboardFrame; private View mMainKeyboardFrame;
private MainKeyboardView mKeyboardView; private MainKeyboardView mKeyboardView;
private EmojiKeyboardView mEmojiKeyboardView; private EmojiPalettesView mEmojiPalettesView;
private LatinIME mLatinIME; private LatinIME mLatinIME;
private Resources mResources; private Resources mResources;
@ -169,7 +169,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
private void setKeyboard(final Keyboard keyboard) { private void setKeyboard(final Keyboard keyboard) {
// Make {@link MainKeyboardView} visible and hide {@link EmojiKeyboardView}. // Make {@link MainKeyboardView} visible and hide {@link EmojiPalettesView}.
setMainKeyboardFrame(); setMainKeyboardFrame();
final MainKeyboardView keyboardView = mKeyboardView; final MainKeyboardView keyboardView = mKeyboardView;
final Keyboard oldKeyboard = keyboardView.getKeyboard(); final Keyboard oldKeyboard = keyboardView.getKeyboard();
@ -259,14 +259,14 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private void setMainKeyboardFrame() { private void setMainKeyboardFrame() {
mMainKeyboardFrame.setVisibility(View.VISIBLE); mMainKeyboardFrame.setVisibility(View.VISIBLE);
mEmojiKeyboardView.setVisibility(View.GONE); mEmojiPalettesView.setVisibility(View.GONE);
} }
// Implements {@link KeyboardState.SwitchActions}. // Implements {@link KeyboardState.SwitchActions}.
@Override @Override
public void setEmojiKeyboard() { public void setEmojiKeyboard() {
mMainKeyboardFrame.setVisibility(View.GONE); mMainKeyboardFrame.setVisibility(View.GONE);
mEmojiKeyboardView.setVisibility(View.VISIBLE); mEmojiPalettesView.setVisibility(View.VISIBLE);
} }
// Implements {@link KeyboardState.SwitchActions}. // Implements {@link KeyboardState.SwitchActions}.
@ -315,7 +315,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
public boolean isShowingEmojiKeyboard() { public boolean isShowingEmojiKeyboard() {
return mEmojiKeyboardView != null && mEmojiKeyboardView.getVisibility() == View.VISIBLE; return mEmojiPalettesView != null && mEmojiPalettesView.getVisibility() == View.VISIBLE;
} }
public boolean isShowingMoreKeysPanel() { public boolean isShowingMoreKeysPanel() {
@ -327,7 +327,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
public View getVisibleKeyboardView() { public View getVisibleKeyboardView() {
if (isShowingEmojiKeyboard()) { if (isShowingEmojiKeyboard()) {
return mEmojiKeyboardView; return mEmojiPalettesView;
} }
return mKeyboardView; return mKeyboardView;
} }
@ -345,15 +345,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate( mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate(
R.layout.input_view, null); R.layout.input_view, null);
mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame); mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame);
mEmojiKeyboardView = (EmojiKeyboardView)mCurrentInputView.findViewById( mEmojiPalettesView = (EmojiPalettesView)mCurrentInputView.findViewById(
R.id.emoji_keyboard_view); R.id.emoji_keyboard_view);
mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view); mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled); mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
mKeyboardView.setKeyboardActionListener(mLatinIME); mKeyboardView.setKeyboardActionListener(mLatinIME);
mEmojiKeyboardView.setHardwareAcceleratedDrawingEnabled( mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled(
isHardwareAcceleratedDrawingEnabled); isHardwareAcceleratedDrawingEnabled);
mEmojiKeyboardView.setKeyboardActionListener(mLatinIME); mEmojiPalettesView.setKeyboardActionListener(mLatinIME);
// This always needs to be set since the accessibility state can // This always needs to be set since the accessibility state can
// potentially change without the input view being re-created. // potentially change without the input view being re-created.

View file

@ -20,7 +20,7 @@ import android.content.SharedPreferences;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.android.inputmethod.keyboard.EmojiKeyboardView; import com.android.inputmethod.keyboard.EmojiPalettesView;
import com.android.inputmethod.keyboard.Key; import com.android.inputmethod.keyboard.Key;
import com.android.inputmethod.keyboard.Keyboard; import com.android.inputmethod.keyboard.Keyboard;
import com.android.inputmethod.latin.settings.Settings; import com.android.inputmethod.latin.settings.Settings;
@ -63,7 +63,7 @@ public class DynamicGridKeyboard extends Keyboard {
mVerticalStep = key0.getHeight() + mVerticalGap; mVerticalStep = key0.getHeight() + mVerticalGap;
mColumnsNum = mBaseWidth / mHorizontalStep; mColumnsNum = mBaseWidth / mHorizontalStep;
mMaxKeyCount = maxKeyCount; mMaxKeyCount = maxKeyCount;
mIsRecents = categoryId == EmojiKeyboardView.CATEGORY_ID_RECENTS; mIsRecents = categoryId == EmojiPalettesView.CATEGORY_ID_RECENTS;
mPrefs = prefs; mPrefs = prefs;
} }