use of com.android.inputmethod.keyboard.Keyboard in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class EmojiCategory method getKeyboard.
public DynamicGridKeyboard getKeyboard(final int categoryId, final int id) {
synchronized (mCategoryKeyboardMap) {
final Long categoryKeyboardMapKey = getCategoryKeyboardMapKey(categoryId, id);
if (mCategoryKeyboardMap.containsKey(categoryKeyboardMapKey)) {
return mCategoryKeyboardMap.get(categoryKeyboardMapKey);
}
if (categoryId == EmojiCategory.ID_RECENTS) {
final DynamicGridKeyboard kbd = new DynamicGridKeyboard(mPrefs, mLayoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS), mMaxPageKeyCount, categoryId);
mCategoryKeyboardMap.put(categoryKeyboardMapKey, kbd);
return kbd;
}
final Keyboard keyboard = mLayoutSet.getKeyboard(sCategoryElementId[categoryId]);
final Key[][] sortedKeys = sortKeysIntoPages(keyboard.getSortedKeys(), mMaxPageKeyCount);
for (int pageId = 0; pageId < sortedKeys.length; ++pageId) {
final DynamicGridKeyboard tempKeyboard = new DynamicGridKeyboard(mPrefs, mLayoutSet.getKeyboard(KeyboardId.ELEMENT_EMOJI_RECENTS), mMaxPageKeyCount, categoryId);
for (final Key emojiKey : sortedKeys[pageId]) {
if (emojiKey == null) {
break;
}
tempKeyboard.addKeyLast(emojiKey);
}
mCategoryKeyboardMap.put(getCategoryKeyboardMapKey(categoryId, pageId), tempKeyboard);
}
return mCategoryKeyboardMap.get(categoryKeyboardMapKey);
}
}
use of com.android.inputmethod.keyboard.Keyboard in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class EmojiPalettesAdapter method instantiateItem.
@Override
public Object instantiateItem(final ViewGroup container, final int position) {
if (DEBUG_PAGER) {
Log.d(TAG, "instantiate item: " + position);
}
final EmojiPageKeyboardView oldKeyboardView = mActiveKeyboardViews.get(position);
if (oldKeyboardView != null) {
oldKeyboardView.deallocateMemory();
// This may be redundant but wanted to be safer..
mActiveKeyboardViews.remove(position);
}
final Keyboard keyboard = mEmojiCategory.getKeyboardFromPagePosition(position);
final LayoutInflater inflater = LayoutInflater.from(container.getContext());
final EmojiPageKeyboardView keyboardView = (EmojiPageKeyboardView) inflater.inflate(R.layout.emoji_keyboard_page, container, false);
keyboardView.setKeyboard(keyboard);
keyboardView.setOnKeyEventListener(mListener);
container.addView(keyboardView);
mActiveKeyboardViews.put(position, keyboardView);
return keyboardView;
}
use of com.android.inputmethod.keyboard.Keyboard in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class ActionTestsBase method assertActionKey.
private static void assertActionKey(final String tag, final KeyboardLayoutSet layoutSet, final int elementId, final ExpectedActionKey expectedKey) {
final Keyboard keyboard = layoutSet.getKeyboard(elementId);
final Key actualKey = keyboard.getKey(Constants.CODE_ENTER);
assertNotNull(tag + " enter key on " + keyboard.mId, actualKey);
assertEquals(tag + " label " + expectedKey, expectedKey.getLabel(), actualKey.getLabel());
assertEquals(tag + " icon " + expectedKey, expectedKey.getIconId(), actualKey.getIconId());
}
use of com.android.inputmethod.keyboard.Keyboard in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class LatinIME method dump.
@Override
protected void dump(final FileDescriptor fd, final PrintWriter fout, final String[] args) {
super.dump(fd, fout, args);
final Printer p = new PrintWriterPrinter(fout);
p.println("LatinIME state :");
p.println(" VersionCode = " + ApplicationUtils.getVersionCode(this));
p.println(" VersionName = " + ApplicationUtils.getVersionName(this));
final Keyboard keyboard = mKeyboardSwitcher.getKeyboard();
final int keyboardMode = keyboard != null ? keyboard.mId.mMode : -1;
p.println(" Keyboard mode = " + keyboardMode);
final SettingsValues settingsValues = mSettings.getCurrent();
p.println(settingsValues.dump());
p.println(mDictionaryFacilitator.dump(this));
// TODO: Dump all settings values
}
use of com.android.inputmethod.keyboard.Keyboard in project android_packages_inputmethods_LatinIME by CyanogenMod.
the class SuggestionStripView method showMoreSuggestions.
boolean showMoreSuggestions() {
final Keyboard parentKeyboard = mMainKeyboardView.getKeyboard();
if (parentKeyboard == null) {
return false;
}
final SuggestionStripLayoutHelper layoutHelper = mLayoutHelper;
if (mSuggestedWords.size() <= mStartIndexOfMoreSuggestions) {
return false;
}
final int stripWidth = getWidth();
final View container = mMoreSuggestionsContainer;
final int maxWidth = stripWidth - container.getPaddingLeft() - container.getPaddingRight();
final MoreSuggestions.Builder builder = mMoreSuggestionsBuilder;
builder.layout(mSuggestedWords, mStartIndexOfMoreSuggestions, maxWidth, (int) (maxWidth * layoutHelper.mMinMoreSuggestionsWidth), layoutHelper.getMaxMoreSuggestionsRow(), parentKeyboard);
mMoreSuggestionsView.setKeyboard(builder.build());
container.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
final MoreKeysPanel moreKeysPanel = mMoreSuggestionsView;
final int pointX = stripWidth / 2;
final int pointY = -layoutHelper.mMoreSuggestionsBottomGap;
moreKeysPanel.showMoreKeysPanel(this, mMoreSuggestionsController, pointX, pointY, mMoreSuggestionsListener);
mOriginX = mLastX;
mOriginY = mLastY;
for (int i = 0; i < mStartIndexOfMoreSuggestions; i++) {
mWordViews.get(i).setPressed(false);
}
return true;
}
Aggregations