Example #1
0
 private boolean equals(final KeyboardId other) {
   if (other == this) return true;
   return other.mElementId == mElementId
       && other.mMode == mMode
       && other.mWidth == mWidth
       && other.mHeight == mHeight
       && other.passwordInput() == passwordInput()
       && other.mClobberSettingsKey == mClobberSettingsKey
       && other.mHasShortcutKey == mHasShortcutKey
       && other.mLanguageSwitchKeyEnabled == mLanguageSwitchKeyEnabled
       && other.isMultiLine() == isMultiLine()
       && other.imeAction() == imeAction()
       && TextUtils.equals(other.mCustomActionLabel, mCustomActionLabel)
       && other.navigateNext() == navigateNext()
       && other.navigatePrevious() == navigatePrevious()
       && other.mSubtype.equals(mSubtype)
       && other.mIsSplitLayout == mIsSplitLayout;
 }
Example #2
0
 private static int computeHashCode(final KeyboardId id) {
   return Arrays.hashCode(
       new Object[] {
         id.mElementId,
         id.mMode,
         id.mWidth,
         id.mHeight,
         id.passwordInput(),
         id.mClobberSettingsKey,
         id.mHasShortcutKey,
         id.mLanguageSwitchKeyEnabled,
         id.isMultiLine(),
         id.imeAction(),
         id.mCustomActionLabel,
         id.navigateNext(),
         id.navigatePrevious(),
         id.mSubtype,
         id.mIsSplitLayout
       });
 }
  /**
   * Returns a context-sensitive description of the "Enter" action key.
   *
   * @param context The package's context.
   * @param keyboard The keyboard on which the key resides.
   * @param key The key to describe.
   * @return Returns a context-sensitive description of the "Enter" action key.
   */
  private static String getDescriptionForActionKey(
      final Context context, final Keyboard keyboard, final Key key) {
    final KeyboardId keyboardId = keyboard.mId;
    final int actionId = keyboardId.imeAction();
    final int resId;

    // Always use the label, if available.
    if (!TextUtils.isEmpty(key.getLabel())) {
      return key.getLabel().trim();
    }

    // Otherwise, use the action ID.
    switch (actionId) {
      case EditorInfo.IME_ACTION_SEARCH:
        resId = R.string.spoken_description_search;
        break;
      case EditorInfo.IME_ACTION_GO:
        resId = R.string.label_go_key;
        break;
      case EditorInfo.IME_ACTION_SEND:
        resId = R.string.label_send_key;
        break;
      case EditorInfo.IME_ACTION_NEXT:
        resId = R.string.label_next_key;
        break;
      case EditorInfo.IME_ACTION_DONE:
        resId = R.string.label_done_key;
        break;
      case EditorInfo.IME_ACTION_PREVIOUS:
        resId = R.string.label_previous_key;
        break;
      default:
        resId = R.string.spoken_description_return;
    }
    return context.getString(resId);
  }
Example #4
0
 @Override
 public String toString() {
   return mId.toString();
 }