Merge "Refactor RecentsKeyboard"

main
Satoshi Kataoka 2013-09-13 07:39:09 +00:00 committed by Android (Google) Code Review
commit b9db10d62e
2 changed files with 6 additions and 6 deletions

View File

@ -37,7 +37,7 @@ import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener; import android.widget.TabHost.OnTabChangeListener;
import android.widget.TextView; import android.widget.TextView;
import com.android.inputmethod.keyboard.internal.RecentsKeyboard; import com.android.inputmethod.keyboard.internal.DynamicGridKeyboard;
import com.android.inputmethod.keyboard.internal.ScrollKeyboardView; import com.android.inputmethod.keyboard.internal.ScrollKeyboardView;
import com.android.inputmethod.keyboard.internal.ScrollViewWithNotifier; import com.android.inputmethod.keyboard.internal.ScrollViewWithNotifier;
import com.android.inputmethod.latin.Constants; import com.android.inputmethod.latin.Constants;
@ -376,7 +376,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
private static class EmojiKeyboardAdapter extends PagerAdapter { private static class EmojiKeyboardAdapter extends PagerAdapter {
private final ScrollKeyboardView.OnKeyClickListener mListener; private final ScrollKeyboardView.OnKeyClickListener mListener;
private final KeyboardLayoutSet mLayoutSet; private final KeyboardLayoutSet mLayoutSet;
private final RecentsKeyboard mRecentsKeyboard; private final DynamicGridKeyboard mRecentsKeyboard;
private final SparseArray<ScrollKeyboardView> mActiveKeyboardView = private final SparseArray<ScrollKeyboardView> mActiveKeyboardView =
CollectionUtils.newSparseArray(); CollectionUtils.newSparseArray();
private final EmojiCategory mEmojiCategory; private final EmojiCategory mEmojiCategory;
@ -388,7 +388,7 @@ public final class EmojiKeyboardView extends LinearLayout implements OnTabChange
mEmojiCategory = emojiCategory; mEmojiCategory = emojiCategory;
mListener = listener; mListener = listener;
mLayoutSet = layoutSet; mLayoutSet = layoutSet;
mRecentsKeyboard = new RecentsKeyboard( mRecentsKeyboard = new DynamicGridKeyboard(
layoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS)); layoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS));
} }

View File

@ -26,10 +26,10 @@ import java.util.ArrayDeque;
import java.util.Random; import java.util.Random;
/** /**
* This is a Keyboard class to host recently used keys. * This is a Keyboard class where you can add keys dynamically shown in a grid layout
*/ */
// TODO: Save/restore recent keys from/to preferences. // TODO: Save/restore recent keys from/to preferences.
public class RecentsKeyboard extends Keyboard { public class DynamicGridKeyboard extends Keyboard {
private static final int TEMPLATE_KEY_CODE_0 = 0x30; private static final int TEMPLATE_KEY_CODE_0 = 0x30;
private static final int TEMPLATE_KEY_CODE_1 = 0x31; private static final int TEMPLATE_KEY_CODE_1 = 0x31;
@ -42,7 +42,7 @@ public class RecentsKeyboard extends Keyboard {
private Key[] mCachedRecentKeys; private Key[] mCachedRecentKeys;
public RecentsKeyboard(final Keyboard templateKeyboard) { public DynamicGridKeyboard(final Keyboard templateKeyboard) {
super(templateKeyboard); super(templateKeyboard);
final Key key0 = getTemplateKey(TEMPLATE_KEY_CODE_0); final Key key0 = getTemplateKey(TEMPLATE_KEY_CODE_0);
final Key key1 = getTemplateKey(TEMPLATE_KEY_CODE_1); final Key key1 = getTemplateKey(TEMPLATE_KEY_CODE_1);