Java Code Examples for android.view.inputmethod.EditorInfo

The following are top voted examples for showing how to use android.view.inputmethod.EditorInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: qmui   File: QMUIDialog.java   View source code 7 votes vote down vote up
public EditTextDialogBuilder(Context context) {
    super(context);
    mEditText = new EditText(mContext);
    mEditText.setHintTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_gray_3));
    mEditText.setTextColor(QMUIResHelper.getAttrColor(mContext, R.attr.qmui_config_color_black));
    mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, QMUIResHelper.getAttrDimen(mContext, R.attr.qmui_dialog_content_message_text_size));
    mEditText.setFocusable(true);
    mEditText.setFocusableInTouchMode(true);
    mEditText.setImeOptions(EditorInfo.IME_ACTION_GO);
    mEditText.setGravity(Gravity.CENTER_VERTICAL);
    mEditText.setId(R.id.qmui_dialog_edit_input);

    mRightImageView = new ImageView(mContext);
    mRightImageView.setId(R.id.qmui_dialog_edit_right_icon);
    mRightImageView.setVisibility(View.GONE);
}
 
Example 2
Project: microbit   File: ProjectAdapter.java   View source code 7 votes vote down vote up
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    logi("onEditorAction() :: currentEditableRow=" + currentEditableRow);

    int pos = (int) v.getTag(R.id.positionId);
    Project project = mProjects.get(pos);
    project.inEditMode = false;
    currentEditableRow = -1;

    if(actionId == EditorInfo.IME_ACTION_DONE) {
        dismissKeyBoard(v, true, true);
    } else if(actionId == -1) {
        dismissKeyBoard(v, true, false);
    }

    return true;
}
 
Example 3
Project: simple-keyboard   File: EditorInfoCompatUtils.java   View source code 7 votes vote down vote up
public static String imeActionName(final int imeOptions) {
    final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
    switch (actionId) {
    case EditorInfo.IME_ACTION_UNSPECIFIED:
        return "actionUnspecified";
    case EditorInfo.IME_ACTION_NONE:
        return "actionNone";
    case EditorInfo.IME_ACTION_GO:
        return "actionGo";
    case EditorInfo.IME_ACTION_SEARCH:
        return "actionSearch";
    case EditorInfo.IME_ACTION_SEND:
        return "actionSend";
    case EditorInfo.IME_ACTION_NEXT:
        return "actionNext";
    case EditorInfo.IME_ACTION_DONE:
        return "actionDone";
    case EditorInfo.IME_ACTION_PREVIOUS:
        return "actionPrevious";
    default:
        return "actionUnknown(" + actionId + ")";
    }
}
 
Example 4
Project: Android_watch_magpie   File: AddValueFragment.java   View source code 6 votes vote down vote up
private void removeFocus(TextInputLayout... textInputLayouts) {
    for (TextInputLayout textInputLayout : textInputLayouts) {
        textInputLayout.getEditText().setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    textView.clearFocus();
                    // Hide the keyboard
                    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(textView.getWindowToken(), 0);
                }
                return false;
            }
        });
    }
}
 
Example 5
Project: youkes_browser   File: BrowserActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onEditorAction(TextView arg0, int actionId, KeyEvent arg2) {
	// hide the keyboard and search the web when the enter key
	// button is pressed
	if (actionId == EditorInfo.IME_ACTION_GO || actionId == EditorInfo.IME_ACTION_DONE
			|| actionId == EditorInfo.IME_ACTION_NEXT
			|| actionId == EditorInfo.IME_ACTION_SEND
			|| actionId == EditorInfo.IME_ACTION_SEARCH
			|| (arg2.getAction() == KeyEvent.KEYCODE_ENTER)) {
		InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
		imm.hideSoftInputFromWindow(mSearch.getWindowToken(), 0);
		searchTheWeb(mSearch.getText().toString());
		LightningView v=getCurrentWebView();
		if (v != null) {
			v.requestFocus();
		}
		return true;
	}
	return false;
}
 
Example 6
Project: TheNounProject   File: BaseSearchFragment.java   View source code 6 votes vote down vote up
private void setupSearchView(MenuItem searchItem) {
    if (searchItem != null) {
        MenuItemCompat.setOnActionExpandListener(searchItem, this);
        SearchManager searchManager = (SearchManager) (getActivity()
                .getSystemService(Context.SEARCH_SERVICE));
        searchView = (SearchView) searchItem.getActionView();
        if (searchView != null) {
            searchView.setSearchableInfo(searchManager
                    .getSearchableInfo(getActivity().getComponentName()));
            searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
            searchView.clearFocus();
            searchView.setOnQueryTextListener(this);
            setupSearchOptions(searchView);
        }
    }
}
 
Example 7
Project: AOSP-Kayboard-7.1.2   File: EditorInfoCompatUtils.java   View source code 6 votes vote down vote up
public static String imeActionName(final int imeOptions) {
    final int actionId = imeOptions & EditorInfo.IME_MASK_ACTION;
    switch (actionId) {
    case EditorInfo.IME_ACTION_UNSPECIFIED:
        return "actionUnspecified";
    case EditorInfo.IME_ACTION_NONE:
        return "actionNone";
    case EditorInfo.IME_ACTION_GO:
        return "actionGo";
    case EditorInfo.IME_ACTION_SEARCH:
        return "actionSearch";
    case EditorInfo.IME_ACTION_SEND:
        return "actionSend";
    case EditorInfo.IME_ACTION_NEXT:
        return "actionNext";
    case EditorInfo.IME_ACTION_DONE:
        return "actionDone";
    case EditorInfo.IME_ACTION_PREVIOUS:
        return "actionPrevious";
    default:
        return "actionUnknown(" + actionId + ")";
    }
}
 
Example 8
Project: PeSanKita-android   File: ComposeText.java   View source code 6 votes vote down vote up
public void setTransport(TransportOption transport) {
  final boolean useSystemEmoji = TextSecurePreferences.isSystemEmojiPreferred(getContext());

  int imeOptions = (getImeOptions() & ~EditorInfo.IME_MASK_ACTION) | EditorInfo.IME_ACTION_SEND;
  int inputType  = getInputType();

  if (isLandscape()) setImeActionLabel(transport.getComposeHint(), EditorInfo.IME_ACTION_SEND);
  else               setImeActionLabel(null, 0);

  if (useSystemEmoji) {
    inputType = (inputType & ~InputType.TYPE_MASK_VARIATION) | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE;
  }

  setInputType(inputType);
  setImeOptions(imeOptions);
  setHint(transport.getComposeHint(),
          transport.getSimName().isPresent()
              ? getContext().getString(R.string.conversation_activity__from_sim_name, transport.getSimName().get())
              : null);
}
 
Example 9
Project: EosCommander   File: TransferFragment.java   View source code 6 votes vote down vote up
@Override
protected void setUpView(View view) {

    //  from, to, amount edit text
    mEtFrom = view.findViewById(R.id.et_from);
    mEtTo = view.findViewById(R.id.et_to);
    mEtAmount = view.findViewById(R.id.et_amount);

    // click handler
    view.findViewById(R.id.btn_transfer).setOnClickListener(v -> onSend() );

    mEtAmount.setOnEditorActionListener((textView, actionId, keyEvent) -> {
        if (EditorInfo.IME_ACTION_SEND == actionId) {
            onSend();
            return true;
        }

        return false;
    });


    UiUtils.setupAccountHistory( mEtFrom, mEtTo );
}
 
Example 10
Project: IdeaTrackerPlus   File: MainActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {

    if (actionId == EditorInfo.IME_ACTION_GO
            || actionId == EditorInfo.IME_ACTION_DONE
            || actionId == EditorInfo.IME_ACTION_NEXT
            || actionId == EditorInfo.IME_ACTION_SEND
            || actionId == EditorInfo.IME_ACTION_SEARCH
            || actionId == EditorInfo.IME_NULL) {

        switch ((int) v.getTag()) {
            case 1:
                mNoteField.requestFocus();
                break;

            case 2:
                sendIdeaFromDialog();
                break;

            default:
                break;
        }
        return true;
    }
    return false;
}
 
Example 11
Project: NeoStream   File: SearchFragment.java   View source code 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.fragment_search, container, false);

    ((EditText)view.findViewById(R.id.searchEditText)).setOnEditorActionListener(
            new EditText.OnEditorActionListener() {
                @Override
                public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                    if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE || (event != null && (
                            event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER))) {

                            search();
                            return true;
                    }
                    return false;
                }
            });

    changeFilter(null, Filter.CHANNEL, view);

    return view;
}
 
Example 12
Project: ROKOmoji.Emoji.Keyboard.App-Android   File: KeyboardService.java   View source code 6 votes vote down vote up
private boolean isCommitContentSupported(@Nullable EditorInfo editorInfo, @NonNull String mimeType) {
    if (editorInfo == null) {
        return false;
    }

    final InputConnection ic = getCurrentInputConnection();
    if (ic == null) {
        return false;
    }

    if (!validatePackageName(editorInfo)) {
        return false;
    }

    final String[] supportedMimeTypes = EditorInfoCompat.getContentMimeTypes(editorInfo);
    for (String supportedMimeType : supportedMimeTypes) {
        if (ClipDescription.compareMimeTypes(mimeType, supportedMimeType)) {
            return true;
        }
    }
    return false;
}
 
Example 13
Project: AOSP-Kayboard-7.1.2   File: AccessibilityUtils.java   View source code 6 votes vote down vote up
/**
 * Returns whether the device should obscure typed password characters.
 * Typically this means speaking "dot" in place of non-control characters.
 *
 * @return {@code true} if the device should obscure password characters.
 */
@SuppressWarnings("deprecation")
public boolean shouldObscureInput(final EditorInfo editorInfo) {
    if (editorInfo == null) return false;

    // The user can optionally force speaking passwords.
    if (SettingsSecureCompatUtils.ACCESSIBILITY_SPEAK_PASSWORD != null) {
        final boolean speakPassword = Settings.Secure.getInt(mContext.getContentResolver(),
                SettingsSecureCompatUtils.ACCESSIBILITY_SPEAK_PASSWORD, 0) != 0;
        if (speakPassword) return false;
    }

    // Always speak if the user is listening through headphones.
    if (mAudioManager.isWiredHeadsetOn() || mAudioManager.isBluetoothA2dpOn()) {
        return false;
    }

    // Don't speak if the IME is connected to a password field.
    return InputTypeUtils.isPasswordInputType(editorInfo.inputType);
}
 
Example 14
Project: BittrexApi   File: AuthenticationActivity.java   View source code 6 votes vote down vote up
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
    final int id = textView.getId();
    switch (id) {
        case R.id.key_edittext:
            if (actionId == EditorInfo.IME_ACTION_NEXT) {
                _secretEditText.requestFocus();
            }

            return true;
        case R.id.secret_edittext:
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                updateAuthenticationSettings();
            }

            return true;
    }

    return false;
}
 
Example 15
Project: chat-sdk-android-push-firebase   File: DialogUtils.java   View source code 6 votes vote down vote up
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (EditorInfo.IME_ACTION_DONE == actionId) {
        if (mEditText.getText().toString().isEmpty())
        {
            SuperToast toast = chatSDKUiHelper.getAlertToast();
            toast.setGravity(Gravity.TOP, 0, 0);
            toast.setText("Please enter chat name");
            toast.show();
            return true;
        }

        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(
                Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);

        // Return input text to activity
        listener.onFinished(mEditText.getText().toString());
        this.dismiss();
        return true;
    }
    return false;
}
 
Example 16
Project: SimpleDialogFragments   File: TextInputAutoCompleteTextView.java   View source code 6 votes vote down vote up
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    final InputConnection ic = super.onCreateInputConnection(outAttrs);
    if (ic != null && outAttrs.hintText == null) {
        // If we don't have a hint and our parent is a TextInputLayout, use it's hint for the
        // EditorInfo. This allows us to display a hint in 'extract mode'.
        ViewParent parent = getParent();
        while (parent instanceof View) {
            if (parent instanceof TextInputLayout) {
                outAttrs.hintText = ((TextInputLayout) parent).getHint();
                break;
            }
            parent = parent.getParent();
        }
    }
    return ic;
}
 
Example 17
Project: AOSP-Kayboard-7.1.2   File: LatinIME.java   View source code 6 votes vote down vote up
public void onStartInputView(final EditorInfo editorInfo, final boolean restarting) {
    if (hasMessages(MSG_PENDING_IMS_CALLBACK)
            && KeyboardId.equivalentEditorInfoForKeyboard(editorInfo, mAppliedEditorInfo)) {
        // Typically this is the second onStartInputView after orientation changed.
        resetPendingImsCallback();
    } else {
        if (mPendingSuccessiveImsCallback) {
            // This is the first onStartInputView after orientation changed.
            mPendingSuccessiveImsCallback = false;
            resetPendingImsCallback();
            sendMessageDelayed(obtainMessage(MSG_PENDING_IMS_CALLBACK),
                    PENDING_IMS_CALLBACK_DURATION_MILLIS);
        }
        final LatinIME latinIme = getOwnerInstance();
        if (latinIme != null) {
            executePendingImsCallback(latinIme, editorInfo, restarting);
            latinIme.onStartInputViewInternal(editorInfo, restarting);
            mAppliedEditorInfo = editorInfo;
        }
        cancelDeallocateMemory();
    }
}
 
Example 18
Project: Android-Scrapper   File: GridSettingFragment.java   View source code 6 votes vote down vote up
@OnClick(R.id.editName)
protected void editName() {
    animationAtStart();
    InputMethodManager inputMethodManager =
            (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInputFromWindow(
            mGridName.getApplicationWindowToken(),
            InputMethodManager.SHOW_FORCED, 0);
    mGridName.requestFocus();
    mGridName.moveCursorToVisibleOffset();
    mGridName.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE) {
                mGridSettingPresenter.setGridName(mGridName.getText().toString());
                changeListener.nameChanged(String.valueOf(mGrid.getId()), mGridName.getText().toString());
                animationAtEnd();
                return true;
            }
            return false;
        }

    });
}
 
Example 19
Project: SWDemo   File: ChatActivity.java   View source code 5 votes vote down vote up
private void showMessageEditContainer() {
    findViewById(R.id.bottom_action_container).setVisibility(View.GONE);
    findViewById(R.id.bottom_action_end_call).setVisibility(View.GONE);
    findViewById(R.id.msg_input_container).setVisibility(View.VISIBLE);

    EditText edit = (EditText) findViewById(R.id.msg_content);

    edit.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEND
                    || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
                String msgStr = v.getText().toString();
                if (TextUtils.isEmpty(msgStr)) {
                    return false;
                }
                sendChannelMsg(msgStr);

                v.setText("");

                Message msg = new Message(Message.MSG_TYPE_TEXT,
                        new User(config().mUid, String.valueOf(config().mUid)), msgStr);
                notifyMessageChanged(msg);

                return true;
            }
            return false;
        }
    });

    openIME(edit);
}
 
Example 20
Project: Anagram   File: AnagramsActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_anagrams);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    AssetManager assetManager = getAssets();
    try {
        InputStream inputStream = assetManager.open("words.txt");
        dictionary = new AnagramDictionary(new InputStreamReader(inputStream));
    } catch (IOException e) {
        Toast toast = Toast.makeText(this, "Could not load dictionary", Toast.LENGTH_LONG);
        toast.show();
    }
    // Set up the EditText box to process the content of the box when the user hits 'enter'
    final EditText editText = (EditText) findViewById(R.id.editText);
    editText.setRawInputType(InputType.TYPE_CLASS_TEXT);
    editText.setImeOptions(EditorInfo.IME_ACTION_GO);
    editText.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            boolean handled = false;
            if (actionId == EditorInfo.IME_ACTION_GO) {
                processWord(editText);
                handled = true;
            }
            return handled;
        }
    });
}
 
Example 21
Project: Auto.js   File: CodeMirrorEditor.java   View source code 5 votes vote down vote up
private void setupWebView() {
    mWebView = new WebView(getContext()) {
        @Override
        public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
            InputConnection connection = super.onCreateInputConnection(outAttrs);
            return connection == null ? null : new MyInputConnection(connection);
        }
    };
    setupWebSettings();
    mWebView.addJavascriptInterface(mJavaScriptBridge, "__bridge__");
    addView(mWebView);
}
 
Example 22
Project: FanChat   File: AddFriendActivity.java   View source code 5 votes vote down vote up
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_SEARCH) {
        searchFriend();
        return true;
    }
    return false;
}
 
Example 23
Project: GitHub   File: PoiAroundSearchActivity.java   View source code 5 votes vote down vote up
private void setup() {
    mSearchText = (AutoCompleteTextView) findViewById(R.id.etInput);
    mSearchText.addTextChangedListener(this);
    mSearchText.setHint(getString(R.string.search_map));
    findViewById(R.id.search_back).setOnClickListener(view -> {
        finish();
    });
    mSearchText.setOnEditorActionListener((textView, i, keyEvent) -> {
        if (i == EditorInfo.IME_ACTION_SEARCH) {
            doSearch();
        }
        return false;
    });
}
 
Example 24
Project: AOSP-Kayboard-7.1.2   File: EditorInfoCompatUtils.java   View source code 5 votes vote down vote up
public static Locale getPrimaryHintLocale(final EditorInfo editorInfo) {
    if (editorInfo == null) {
        return null;
    }
    final Object localeList = CompatUtils.getFieldValue(editorInfo, null, FIELD_HINT_LOCALES);
    if (localeList == null) {
        return null;
    }
    if (LocaleListCompatUtils.isEmpty(localeList)) {
        return null;
    }
    return LocaleListCompatUtils.get(localeList, 0);
}
 
Example 25
Project: behe-keyboard   File: PCKeyboard.java   View source code 5 votes vote down vote up
/**
 * Helper to update the shift state of our keyboard based on the initial
 * editor state.
 */
private void updateShiftKeyState(EditorInfo attr) {
    if (attr != null
            && mInputView != null && mQwertyKeyboard == mInputView.getKeyboard()) {
        int caps = 0;
        EditorInfo ei = getCurrentInputEditorInfo();
        if (ei != null && ei.inputType != InputType.TYPE_NULL) {
            caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
        }
        mInputView.setShifted(mCapsLock || caps != 0);
    }
}
 
Example 26
Project: EditCodeView   File: EditCodeView.java   View source code 5 votes vote down vote up
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {

    outAttrs.inputType = InputType.TYPE_CLASS_NUMBER;
    outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE;
    outAttrs.initialSelStart = 0;

    return editCodeInputConnection;
}
 
Example 27
Project: RNLearn_Project1   File: ReactEditText.java   View source code 5 votes vote down vote up
private void updateImeOptions() {
  // Default to IME_ACTION_DONE
  int returnKeyFlag = EditorInfo.IME_ACTION_DONE;
  if (mReturnKeyType != null) {
    switch (mReturnKeyType) {
      case "go":
        returnKeyFlag = EditorInfo.IME_ACTION_GO;
        break;
      case "next":
        returnKeyFlag = EditorInfo.IME_ACTION_NEXT;
        break;
      case "none":
        returnKeyFlag = EditorInfo.IME_ACTION_NONE;
        break;
      case "previous":
        returnKeyFlag = EditorInfo.IME_ACTION_PREVIOUS;
        break;
      case "search":
        returnKeyFlag = EditorInfo.IME_ACTION_SEARCH;
        break;
      case "send":
        returnKeyFlag = EditorInfo.IME_ACTION_SEND;
        break;
      case "done":
        returnKeyFlag = EditorInfo.IME_ACTION_DONE;
        break;
    }
  }

  if (mDisableFullscreen) {
    setImeOptions(returnKeyFlag | EditorInfo.IME_FLAG_NO_FULLSCREEN);
  } else {
    setImeOptions(returnKeyFlag);
  }
}
 
Example 28
Project: DateTimePicker   File: NumberPicker.java   View source code 5 votes vote down vote up
@Override
public void onEditorAction(int actionCode) {
    super.onEditorAction(actionCode);
    if (actionCode == EditorInfo.IME_ACTION_DONE) {
        clearFocus();
    }
}
 
Example 29
Project: microMathematics   File: CustomEditText.java   View source code 5 votes vote down vote up
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs)
{
    try
    {
        return new TermInputConnection(super.onCreateInputConnection(outAttrs), true);
    }
    catch (StackOverflowError ex)
    {
        // the StackOverflowError in this procedure was observed on Alcatel OT (android version 10)
        return null;
    }
}
 
Example 30
Project: myan   File: SmartMyan.java   View source code 5 votes vote down vote up
@Override
public void onStartInputView(EditorInfo attribute, boolean restarting) {
    super.onStartInputView(attribute, restarting);
    //applying the selected keyboard to the input view
    setSmKeyboard(mCurKeyboard);
    mInputView.closing();
    final InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype();
    mCurKeyboard.setSubtypeOnSpaceKey(getString(subtype.getNameResId()), getResources().getDrawable(R.drawable.sym_keyboard_space));
}
 
Example 31
Project: TPlayer   File: MethodProxies.java   View source code 5 votes vote down vote up
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {
    int editorInfoIndex = ArrayUtils.indexOfFirst(args, EditorInfo.class);
    if (editorInfoIndex != -1) {
        EditorInfo attribute = (EditorInfo) args[editorInfoIndex];
        attribute.packageName = getHostPkg();
    }
    return method.invoke(who, args);
}
 
Example 32
Project: TodoRealm   File: EditActionViewHolder.java   View source code 5 votes vote down vote up
@OnEditorAction(R.id.edit_text_view)
boolean onEditorAction(TextView view, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
        menuItem.collapseActionView();
        KeyboardUtils.hideKeyboard(view.getContext(), view);
        return true;
    }
    return false;
}
 
Example 33
Project: chips-input-layout   File: ChipEditText.java   View source code 5 votes vote down vote up
/**
 * Used to detect IME option press on any type of input method.
 */
@Override
public void onEditorAction(int actionCode) {
    if (keyboardListener != null && actionCode == EditorInfo.IME_ACTION_DONE) {
        this.keyboardListener.onKeyboardActionDone(getText().toString());
    }
    super.onEditorAction(actionCode);
}
 
Example 34
Project: LaunchEnr   File: Folder.java   View source code 5 votes vote down vote up
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (actionId == EditorInfo.IME_ACTION_DONE) {
        mFolderName.dispatchBackKey();
        return true;
    }
    return false;
}
 
Example 35
Project: EosCommander   File: PushFragment.java   View source code 5 votes vote down vote up
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
    if (EditorInfo.IME_ACTION_SEND == actionId) {
        onPushAction();
        return true;
    }
    else
    if ( (EditorInfo.IME_ACTION_SEARCH == actionId ) && ( textView.getId() == R.id.et_contract_account) ){
        onContractEntered( mEtContract.getText().toString());
    }

    return false;
}
 
Example 36
Project: RNLearn_Project1   File: ReactEditText.java   View source code 5 votes vote down vote up
private void updateImeOptions() {
  // Default to IME_ACTION_DONE
  int returnKeyFlag = EditorInfo.IME_ACTION_DONE;
  if (mReturnKeyType != null) {
    switch (mReturnKeyType) {
      case "go":
        returnKeyFlag = EditorInfo.IME_ACTION_GO;
        break;
      case "next":
        returnKeyFlag = EditorInfo.IME_ACTION_NEXT;
        break;
      case "none":
        returnKeyFlag = EditorInfo.IME_ACTION_NONE;
        break;
      case "previous":
        returnKeyFlag = EditorInfo.IME_ACTION_PREVIOUS;
        break;
      case "search":
        returnKeyFlag = EditorInfo.IME_ACTION_SEARCH;
        break;
      case "send":
        returnKeyFlag = EditorInfo.IME_ACTION_SEND;
        break;
      case "done":
        returnKeyFlag = EditorInfo.IME_ACTION_DONE;
        break;
    }
  }

  if (mDisableFullscreen) {
    setImeOptions(returnKeyFlag | EditorInfo.IME_FLAG_NO_FULLSCREEN);
  } else {
    setImeOptions(returnKeyFlag);
  }
}
 
Example 37
Project: Goalie_Android   File: LoginFragment.java   View source code 5 votes vote down vote up
private EditText.OnEditorActionListener handleEditorAction() {
    return new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent) {
            if (actionId == EditorInfo.IME_ACTION_DONE && getView() != null) {
                mServerMsg.setVisibility(View.GONE);
                mPresenter.register(getActivity(), mUsername.getText().toString());
                return true;
            }
            return false;
        }
    };
}
 
Example 38
Project: AndroidGithubIssues   File: MainActivity.java   View source code 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mViewModel = ViewModelProviders.of(this).get(ListIssuesViewModel.class);
    setupView();

    mSearchEditText.setOnEditorActionListener((TextView v, int actionId, KeyEvent event) -> {
        if (actionId == EditorInfo.IME_ACTION_SEARCH) {
            String repo = mSearchEditText.getText().toString();
            if (repo.length() > 0) {
                String[] query = repo.split("/");
                if (query.length == 2) {
                    hideSoftKeyboard(MainActivity.this, v);
                    setProgress(true);
                    mViewModel.loadIssues(query[0], query[1]);
                } else {
                    handleError(new Exception(
                            "Error wrong format of input. Required format owner/repository_name")
                    );
                }
            } else {
                handleError(new Exception(
                        "Repository name empty. Required format owner/repository_name")
                );
            }
            return true;
        }
        return false;
    });

    // Handle changes emitted by LiveData
    mViewModel.getApiResponse().observe(this, apiResponse -> {
        if (apiResponse.getError() != null) {
            handleError(apiResponse.getError());
        } else {
            handleResponse(apiResponse.getIssues());
        }
    });
}
 
Example 39
Project: myan   File: SmartMyan.java   View source code 5 votes vote down vote up
private void updateShiftKeyState(EditorInfo attr) {
    if (attr != null && mInputView != null && enKeyboard == mInputView.getKeyboard()) {
        int caps = 0;
        EditorInfo ei = getCurrentInputEditorInfo();
        if (ei != null && ei.inputType != InputType.TYPE_NULL) {
            caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
        }
        mInputView.setShifted(mCapsLock || caps != 0);
    }
}
 
Example 40
Project: keepass2android   File: KP2AKeyboard.java   View source code 5 votes vote down vote up
private boolean commitTextForKey(final EditorInfo attribute, String key) {
	List<StringForTyping> availableFields = keepass2android.kbbridge.KeyboardData.availableFields;
	for (StringForTyping str: availableFields)
	{
		if (str.key.equals(key))
		{
			Log.d("KP2AK", "Typing!");
			commitKp2aString(str.value, attribute);
			return true;
		}
	}
	return false;
}