aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java (renamed from java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java)52
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java18
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java2
4 files changed, 42 insertions, 34 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
index db7c845bc..85ae50092 100644
--- a/java/src/com/android/inputmethod/keyboard/EmojiKeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/EmojiPalettesView.java
@@ -60,8 +60,8 @@ import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;
/**
- * View class to implement Emoji keyboards.
- * The Emoji keyboard consists of group of views {@link R.layout#emoji_keyboard_view}.
+ * View class to implement Emoji palettes.
+ * The Emoji keyboard consists of group of views {@link R.layout#emoji_palettes_view}.
* <ol>
* <li> Emoji category tabs.
* <li> Delete button.
@@ -70,16 +70,16 @@ import java.util.concurrent.ConcurrentHashMap;
* </ol>
* 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,
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 mEmojiFunctionalKeyBackgroundId;
private final KeyboardLayoutSet mLayoutSet;
private final ColorStateList mTabLabelColor;
private final DeleteKeyOnTouchListener mDeleteKeyOnTouchListener;
- private EmojiKeyboardAdapter mEmojiKeyboardAdapter;
+ private EmojiPalettesAdapter mEmojiPalettesAdapter;
private TabHost mTabHost;
private ViewPager mEmojiPager;
@@ -378,11 +378,11 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
private final EmojiCategory mEmojiCategory;
- public EmojiKeyboardView(final Context context, final AttributeSet attrs) {
- this(context, attrs, R.attr.emojiKeyboardViewStyle);
+ public EmojiPalettesView(final Context context, final AttributeSet attrs) {
+ 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);
final TypedArray keyboardViewAttr = context.obtainStyledAttributes(attrs,
R.styleable.KeyboardView, defStyle, R.style.KeyboardView);
@@ -391,11 +391,11 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mEmojiFunctionalKeyBackgroundId = keyboardViewAttr.getResourceId(
R.styleable.KeyboardView_keyBackgroundEmojiFunctional, 0);
keyboardViewAttr.recycle();
- final TypedArray emojiKeyboardViewAttr = context.obtainStyledAttributes(attrs,
- R.styleable.EmojiKeyboardView, defStyle, R.style.EmojiKeyboardView);
- mTabLabelColor = emojiKeyboardViewAttr.getColorStateList(
- R.styleable.EmojiKeyboardView_emojiTabLabelColor);
- emojiKeyboardViewAttr.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(
context, null /* editorInfo */);
final Resources res = context.getResources();
@@ -453,10 +453,10 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mTabHost.setOnTabChangedListener(this);
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.setAdapter(mEmojiKeyboardAdapter);
+ mEmojiPager.setAdapter(mEmojiPalettesAdapter);
mEmojiPager.setOnPageChangeListener(this);
mEmojiPager.setOffscreenPageLimit(0);
final Resources res = getResources();
@@ -484,10 +484,10 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
spaceKey.setTag(Constants.CODE_SPACE);
spaceKey.setOnClickListener(this);
emojiLp.setKeyProperties(spaceKey);
- final ImageView sendKey = (ImageView)findViewById(R.id.emoji_keyboard_send);
- sendKey.setBackgroundResource(mEmojiFunctionalKeyBackgroundId);
- sendKey.setTag(Constants.CODE_ENTER);
- sendKey.setOnClickListener(this);
+ final ImageView alphabetKey2 = (ImageView)findViewById(R.id.emoji_keyboard_alphabet2);
+ alphabetKey2.setBackgroundResource(mEmojiFunctionalKeyBackgroundId);
+ alphabetKey2.setTag(Constants.CODE_SWITCH_ALPHA_SYMBOL);
+ alphabetKey2.setOnClickListener(this);
}
@Override
@@ -551,7 +551,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
@Override
public void onKeyClick(final Key key) {
- mEmojiKeyboardAdapter.addRecentKey(key);
+ mEmojiPalettesAdapter.addRecentKey(key);
mEmojiCategory.saveLastTypedCategoryPage();
final int code = key.getCode();
if (code == Constants.CODE_OUTPUT_TEXT) {
@@ -589,7 +589,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
// Needs to save pending updates for recent keys when we get out of the recents
// category because we don't want to move the recent emojis around while the user
// is in the recents category.
- mEmojiKeyboardAdapter.flushPendingRecentKeys();
+ mEmojiPalettesAdapter.flushPendingRecentKeys();
}
mEmojiCategory.setCurrentCategoryId(categoryId);
@@ -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 DynamicGridKeyboard mRecentsKeyboard;
private final SparseArray<ScrollKeyboardView> mActiveKeyboardView =
@@ -612,7 +612,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
private final EmojiCategory mEmojiCategory;
private int mActivePosition = 0;
- public EmojiKeyboardAdapter(final EmojiCategory emojiCategory,
+ public EmojiPalettesAdapter(final EmojiCategory emojiCategory,
final KeyboardLayoutSet layoutSet,
final ScrollKeyboardView.OnKeyClickListener listener) {
mEmojiCategory = emojiCategory;
@@ -662,6 +662,12 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
@Override
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 =
mEmojiCategory.getKeyboardFromPagePosition(position);
final LayoutInflater inflater = LayoutInflater.from(container.getContext());
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index ad6e2c0f2..4fc1082f1 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -68,7 +68,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private InputView mCurrentInputView;
private View mMainKeyboardFrame;
private MainKeyboardView mKeyboardView;
- private EmojiKeyboardView mEmojiKeyboardView;
+ private EmojiPalettesView mEmojiPalettesView;
private LatinIME mLatinIME;
private Resources mResources;
@@ -169,7 +169,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
private void setKeyboard(final Keyboard keyboard) {
- // Make {@link MainKeyboardView} visible and hide {@link EmojiKeyboardView}.
+ // Make {@link MainKeyboardView} visible and hide {@link EmojiPalettesView}.
setMainKeyboardFrame();
final MainKeyboardView keyboardView = mKeyboardView;
final Keyboard oldKeyboard = keyboardView.getKeyboard();
@@ -259,14 +259,14 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
private void setMainKeyboardFrame() {
mMainKeyboardFrame.setVisibility(View.VISIBLE);
- mEmojiKeyboardView.setVisibility(View.GONE);
+ mEmojiPalettesView.setVisibility(View.GONE);
}
// Implements {@link KeyboardState.SwitchActions}.
@Override
public void setEmojiKeyboard() {
mMainKeyboardFrame.setVisibility(View.GONE);
- mEmojiKeyboardView.setVisibility(View.VISIBLE);
+ mEmojiPalettesView.setVisibility(View.VISIBLE);
}
// Implements {@link KeyboardState.SwitchActions}.
@@ -315,7 +315,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
public boolean isShowingEmojiKeyboard() {
- return mEmojiKeyboardView != null && mEmojiKeyboardView.getVisibility() == View.VISIBLE;
+ return mEmojiPalettesView != null && mEmojiPalettesView.getVisibility() == View.VISIBLE;
}
public boolean isShowingMoreKeysPanel() {
@@ -327,7 +327,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
public View getVisibleKeyboardView() {
if (isShowingEmojiKeyboard()) {
- return mEmojiKeyboardView;
+ return mEmojiPalettesView;
}
return mKeyboardView;
}
@@ -345,15 +345,15 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mCurrentInputView = (InputView)LayoutInflater.from(mThemeContext).inflate(
R.layout.input_view, null);
mMainKeyboardFrame = mCurrentInputView.findViewById(R.id.main_keyboard_frame);
- mEmojiKeyboardView = (EmojiKeyboardView)mCurrentInputView.findViewById(
+ mEmojiPalettesView = (EmojiPalettesView)mCurrentInputView.findViewById(
R.id.emoji_keyboard_view);
mKeyboardView = (MainKeyboardView) mCurrentInputView.findViewById(R.id.keyboard_view);
mKeyboardView.setHardwareAcceleratedDrawingEnabled(isHardwareAcceleratedDrawingEnabled);
mKeyboardView.setKeyboardActionListener(mLatinIME);
- mEmojiKeyboardView.setHardwareAcceleratedDrawingEnabled(
+ mEmojiPalettesView.setHardwareAcceleratedDrawingEnabled(
isHardwareAcceleratedDrawingEnabled);
- mEmojiKeyboardView.setKeyboardActionListener(mLatinIME);
+ mEmojiPalettesView.setKeyboardActionListener(mLatinIME);
// This always needs to be set since the accessibility state can
// potentially change without the input view being re-created.
diff --git a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
index 587f95a39..08302a771 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/DynamicGridKeyboard.java
@@ -20,7 +20,7 @@ import android.content.SharedPreferences;
import android.text.TextUtils;
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.Keyboard;
import com.android.inputmethod.latin.settings.Settings;
@@ -63,7 +63,7 @@ public class DynamicGridKeyboard extends Keyboard {
mVerticalStep = key0.getHeight() + mVerticalGap;
mColumnsNum = mBaseWidth / mHorizontalStep;
mMaxKeyCount = maxKeyCount;
- mIsRecents = categoryId == EmojiKeyboardView.CATEGORY_ID_RECENTS;
+ mIsRecents = categoryId == EmojiPalettesView.CATEGORY_ID_RECENTS;
mPrefs = prefs;
}
diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
index 684cf632b..d219e8195 100644
--- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
+++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardTextsSet.java
@@ -251,6 +251,7 @@ public final class KeyboardTextsSet {
/* 146 */ "more_keys_for_single_quote",
/* 147 */ "more_keys_for_double_quote",
/* 148 */ "more_keys_for_tablet_double_quote",
+ /* 149 */ "emoji_key_as_more_key",
};
private static final String EMPTY = "";
@@ -439,6 +440,7 @@ public final class KeyboardTextsSet {
/* 146 */ "!fixedColumnOrder!5,!text/single_quotes,!text/single_angle_quotes",
/* 147 */ "!fixedColumnOrder!5,!text/double_quotes,!text/double_angle_quotes",
/* 148 */ "!fixedColumnOrder!6,!text/double_quotes,!text/single_quotes,!text/double_angle_quotes,!text/single_angle_quotes",
+ /* 149 */ "!icon/emoji_key|!code/key_emoji",
};
/* Language af: Afrikaans */