Java 类android.text.InputType 实例源码

项目:DailyStudy    文件:KeyBoardActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_key_board);
    mPasswordEt = (EditText) findViewById(R.id.editText2);
    mPasswordEt.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            int inputType = mPasswordEt.getInputType();
            mPasswordEt.setInputType(InputType.TYPE_NULL);
            new KeyboardUtil(KeyBoardActivity.this, KeyBoardActivity.this, mPasswordEt).showKeyboard();
            mPasswordEt.setInputType(inputType);
            return false;
        }
    });
}
项目:Blockly    文件:BasicFieldNumberView.java   
protected void updateInputMethod() {
    boolean hasNumberField = mNumberField != null;
    setEnabled(hasNumberField);

    if (hasNumberField) {
        int imeOptions = InputType.TYPE_CLASS_NUMBER;
        StringBuilder allowedChars = new StringBuilder("0123456789");
        if (mAllowExponent) {
            allowedChars.append("e");
        }

        if (mNumberField.getMinimumValue() < 0) {
            imeOptions |= InputType.TYPE_NUMBER_FLAG_SIGNED;
            allowedChars.append("-");
        }
        if (!mNumberField.isInteger()) {
            imeOptions |= InputType.TYPE_NUMBER_FLAG_DECIMAL;
            allowedChars.append(mLocalizedDecimalSymbols.getDecimalSeparator());
        }
        allowedChars.append(mLocalizedDecimalSymbols.getGroupingSeparator());

        setImeOptions(imeOptions);
        setKeyListener(DigitsKeyListener.getInstance(allowedChars.toString()));
    }
}
项目:otp-view    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    OTPView otpView = (OTPView) findViewById(R.id.otpView);
    otpView.setTextColor(R.color.colorAccent)
            .setHintColor(R.color.colorAccent)
            .setCount(7)
            .setInputType(InputType.TYPE_CLASS_NUMBER)
            .setViewsPadding(16)
            .setListener(new OTPListener() {
                @Override
                public void otpFinished(String otp) {
                    Toast.makeText(MainActivity.this, "OTP finished, the otp is " + otp, Toast.LENGTH_SHORT).show();
                }
            })
            .fillLayout();
}
项目:SunmiUI    文件:EditPwdDialog.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
protected void init() {
    eyeNo = resources.getDrawable(R.drawable.eye_no, null);
    eyeYes = resources.getDrawable(R.drawable.eye_yes, null);
    error = (TextView) dialog.findViewById(R.id.error);
    editText = (EditText) dialog.findViewById(R.id.edit);
    eye = (ImageView) dialog.findViewById(R.id.eye);
    eyeRegion = dialog.findViewById(R.id.eye_region);
    clear = (RelativeLayout) dialog.findViewById(R.id.rel_clear);
    clear.setVisibility(View.GONE);
    clear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            editText.setText("");
        }
    });
    eyeRegion.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            if(pwdVisible){
                pwdVisible = false;
                eye.setImageDrawable(eyeNo);
                editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            }else{
                pwdVisible = true;
                eye.setImageDrawable(eyeYes);
                editText.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            }
            editText.setSelection(editText.getText().length());
            Log.d(TAG, "onClick:"+pwdVisible);
        }
    });

    editText.addTextChangedListener(textWatcher);
}
项目:chilly    文件:AuthenticationActivity.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    GuidedAction enterUsername = new GuidedAction.Builder()
            .title(getString(R.string.pref_title_username))
            .descriptionEditable(true)
            .build();
    GuidedAction enterPassword = new GuidedAction.Builder()
            .title(getString(R.string.pref_title_password))
            .descriptionEditable(true)
            .descriptionInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)
            .build();
    GuidedAction login = new GuidedAction.Builder()
            .id(CONTINUE)
            .title(getString(R.string.guidedstep_continue))
            .build();
    actions.add(enterUsername);
    actions.add(enterPassword);
    actions.add(login);
}
项目:Phoenix-for-VK    文件:UserWallFragment.java   
@Override
public void showAddToFriendsMessageDialog() {
    new InputTextDialog.Builder(getActivity())
            .setInputType(InputType.TYPE_CLASS_TEXT)
            .setTitleRes(R.string.add_to_friends)
            .setHint(R.string.attach_message)
            .setAllowEmpty(true)
            .setCallback(newValue -> getPresenter().fireAddToFrindsClick(newValue))
            .show();
}
项目:PeSanKita-android    文件:ComposeText.java   
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);
}
项目:androidtv-sample    文件:AuthenticationActivity.java   
@Override
public void onCreateActions(@NonNull List<GuidedAction> actions, Bundle savedInstanceState) {
    GuidedAction enterUsername = new GuidedAction.Builder()
            .title(getString(R.string.pref_title_username))
            .descriptionEditable(true)
            .build();
    GuidedAction enterPassword = new GuidedAction.Builder()
            .title(getString(R.string.pref_title_password))
            .descriptionEditable(true)
            .descriptionInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT)
            .build();
    GuidedAction login = new GuidedAction.Builder()
            .id(CONTINUE)
            .title(getString(R.string.guidedstep_continue))
            .build();
    actions.add(enterUsername);
    actions.add(enterPassword);
    actions.add(login);
}
项目:godlibrary    文件:EditTextWatcher.java   
private int getType(EditType editType) {
    int type;
    switch (editType) {
        case phone:
            type = InputType.TYPE_CLASS_PHONE;
            break;
        case number:
            type = InputType.TYPE_CLASS_NUMBER;
            break;
        case numberDecimal:
            type = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL;
            break;
        case textPassword:
            type = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD;
            break;
        case numberPassword:
            type = InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_VARIATION_PASSWORD;
            break;
        default:
            type = InputType.TYPE_CLASS_TEXT;
    }
    return type;
}
项目:LuaViewPlayground    文件:UDEditText.java   
public UDEditText setInputType(CharSequence text) {
    EditText view = getView();
    if (view != null) {
        if (text.equals("number")) {
            view.setInputType(InputType.TYPE_CLASS_NUMBER);
            mType = "number";
        } else if(text.equals("password")) {
            view.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            mType = "password";
        } else if(text.equals("visible_password")) {
            view.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            mType = "visible_password";
        } else {
            view.setInputType(InputType.TYPE_CLASS_TEXT);
            mType = "text";
        }
    }
    return this;
}
项目:RNLearn_Project1    文件:ReactTextInputPropertyTest.java   
@Test
public void testMultiline() {
  ReactEditText view = mManager.createViewInstance(mThemedContext);

  mManager.updateProperties(view, buildStyles());
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();

  mManager.updateProperties(view, buildStyles("multiline", false));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();

  mManager.updateProperties(view, buildStyles("multiline", true));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isNotZero();

  mManager.updateProperties(view, buildStyles("multiline", null));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();
}
项目:CSipSimple    文件:Ippi.java   
@Override
public void fillLayout(final SipProfile account) {
    super.fillLayout(account);
    accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_TEXT);

    //Get wizard specific row
    customWizardText = (TextView) parent.findViewById(R.id.custom_wizard_text);
    customWizard = (LinearLayout) parent.findViewById(R.id.custom_wizard_row);

       settingsContainer = (ViewGroup) parent.findViewById(R.id.settings_container);
       validationBar = (ViewGroup) parent.findViewById(R.id.validation_bar);

    updateAccountInfos(account);

       extAccCreator = new AccountCreationWebview(parent, "https://m.ippi.fr/subscribe/android.php", this);
}
项目:android-numberpickercompat    文件:NumberPicker.java   
/**
 * Sets the values to be displayed.
 *
 * @param displayedValues The displayed values.
 *                        <p>
 *                        <strong>Note:</strong> The length of the displayed values array
 *                        must be equal to the range of selectable numbers which is equal to
 *                        {@link #getMaxValue()} - {@link #getMinValue()} + 1.
 */
public void setDisplayedValues(String[] displayedValues) {
    if (mDisplayedValues == displayedValues) {
        return;
    }
    mDisplayedValues = displayedValues;
    if (mDisplayedValues != null) {
        // Allow text entry rather than strictly numeric entry.
        mInputText.setRawInputType(InputType.TYPE_CLASS_TEXT
                | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    } else {
        mInputText.setRawInputType(InputType.TYPE_CLASS_NUMBER);
    }
    updateInputTextView();
    initializeSelectorWheelIndices();
    tryComputeMaxWidth();
}
项目:A.scribe    文件:NoteFragment.java   
private void initializeViews(Note note) {
    String title = note.getTitle();
    String text = note.getText();
    titleEditText.setFilters(new InputFilter[]{new InputFilter.AllCaps()});
    titleEditText.setRawInputType(InputType.TYPE_CLASS_TEXT);
    if (title == null && text == null) {
        getActivity().getWindow()
                .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE
                        | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
        Util.showKeyboardFrom(getContext(), textEditText);
    } else {
        titleEditText.setText(title);
        textEditText.setText(text);
    }
    setColor(note.getColor());
    updateDateEditedTextView();
}
项目:RNLearn_Project1    文件:ReactTextInputPropertyTest.java   
@Test
public void testMultiline() {
  ReactEditText view = mManager.createViewInstance(mThemedContext);

  mManager.updateProperties(view, buildStyles());
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();

  mManager.updateProperties(view, buildStyles("multiline", false));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();

  mManager.updateProperties(view, buildStyles("multiline", true));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isNotZero();

  mManager.updateProperties(view, buildStyles("multiline", null));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_MULTI_LINE).isZero();
}
项目:revolution-irc    文件:AutoRunCommandListEditText.java   
@Override
protected void onSelectionChanged(int selStart, int selEnd) {
    super.onSelectionChanged(selStart, selEnd);

    if (getLayout() == null)
        return;
    String line = getText().subSequence(getLayout().getLineStart(getLayout()
            .getLineForOffset(selStart)), selEnd).toString();
    boolean isPassword = getPasswordStart(line) != -1;
    boolean wasPassword = (getInputType() & InputType.TYPE_TEXT_VARIATION_PASSWORD) != 0;
    if (isPassword && !wasPassword) {
        Typeface tf = getTypeface();
        setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE |
                InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
        setTypeface(tf);
        setSelection(selStart, selEnd);
    } else if (!isPassword && wasPassword) {
        createPasswordSpans();
        setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    }
}
项目:anitrend-app    文件:DialogManager.java   
/**
 * Creates a dialog to type in text
 */
public void createDialogInput(String header, String content, MaterialDialog.InputCallback callback, MaterialDialog.SingleButtonCallback buttonCallback) {
    new MaterialDialog.Builder(mContext)
            .positiveText(R.string.Ok)
            .negativeText(R.string.Cancel)
            //.neutralText(R.string.attach_media)
            .autoDismiss(false)
            .onAny(buttonCallback)
            .buttonRippleColorRes(R.color.colorAccent)
            .positiveColorRes(R.color.colorStateBlue)
            .negativeColorRes(R.color.colorStateOrange)
            .theme(app_prefs.isLightTheme()?Theme.LIGHT:Theme.DARK)
            .title(header)
            .content(content)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE | InputType.TYPE_TEXT_FLAG_MULTI_LINE)
            .input(mContext.getString(R.string.text_enter_text), null, callback)
            .show();
}
项目:simpleSDL    文件:SDLActivity.java   
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    ic = new SDLInputConnection(this, true);

    outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
    outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
            | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;

    return ic;
}
项目:RNLearn_Project1    文件:ReactTextInputManager.java   
@ReactProp(name = "multiline", defaultBoolean = false)
public void setMultiline(ReactEditText view, boolean multiline) {
  updateStagedInputTypeFlag(
      view,
      multiline ? 0 : InputType.TYPE_TEXT_FLAG_MULTI_LINE,
      multiline ? InputType.TYPE_TEXT_FLAG_MULTI_LINE : 0);
}
项目:CXJPadProject    文件:LicenseKeyboardUtil.java   
public LicenseKeyboardUtil(Context ctx, View view, EditText edits[]) {
    this.ctx = ctx;
    this.edits = edits;

    //禁用edits输入属性 即禁用光标
    for (int i = 0; i < edits.length; i++) {
        edits[i].setText("");
        edits[i].setInputType(InputType.TYPE_NULL);
    }


    k1 = new Keyboard(ctx, R.xml.province_short_keyboard);
    k2 = new Keyboard(ctx, R.xml.lettersanddigit_keyboard);

    keyboardView = (KeyboardView) view.findViewById(R.id.keyboard_view);

    keyboardView.setKeyboard(k1);
    keyboardView.setEnabled(true);
    //设置为true时,当按下一个按键时会有一个popup来显示<key>元素设置的android:popupCharacters=""
    keyboardView.setPreviewEnabled(false);
    //设置键盘按键监听器
    keyboardView.setOnKeyboardActionListener(listener);
    provinceShort = new String[]{"澳", "川", "鄂", "赣", "甘", "港", "桂", "贵", "黑"
            , "沪", "冀", "吉", "京", "津", "晋", "辽", "鲁", "蒙"
            , "闽", "宁", "青", "琼", "苏", "陕", "台", "皖", "湘"
            , "新", "豫", "粤", "渝", "云", "藏", "浙"};

    letterAndDigit = new String[]{"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"
            , "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P"
            , "A", "S", "D", "F", "G", "H", "J", "K", "L"
            , "Z", "X", "C", "V", "B", "N", "M"};
}
项目:IelloAndroidAdminApp    文件:DialogAPIKey.java   
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {

    // creazione 'manuale' del dialog
    int margin = getResources().getDimensionPixelSize(R.dimen.activity_horizontal_margin);

    LinearLayout rootView = new LinearLayout(getActivity());
    rootView.setOrientation(LinearLayout.VERTICAL);
    rootView.setPadding(margin, margin, margin, margin);
    mTxtInput = new TextInputLayout(getActivity());
    mTxtInput.addView(new EditText(getActivity()));
    mTxtInput.setHint(getString(R.string.api_key_title));
    if (mTxtInput.getEditText() != null) {
        mTxtInput.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
        mTxtInput.getEditText().setHighlightColor(Color.YELLOW);
    }

    rootView.addView(mTxtInput);

    // Setto l'edit text con il testo dell'api key se presente
    String apiKey = SharedPrefsHelper.getInstance().getApiKey(getActivity());
    if(apiKey != null)
        mTxtInput.getEditText().setText(apiKey);

    AlertDialog dialog = new AlertDialog.Builder(getActivity())
            .setTitle(getString(R.string.title_insert_api_key))
            .setView(rootView)
            //.setCancelable(false)
            .setPositiveButton(getString(R.string.salva), null)
            .setNegativeButton(SharedPrefsHelper.getInstance()
                    .isApiKeyRegistered(getActivity()) ? getString(R.string.annulla) : getString(R.string.esci_app), this)
            .create();

    dialog.setOnShowListener(this);

    return dialog;
}
项目:Renrentou    文件:LoginActivity.java   
@OnClick({
        R.id.img_eye_open,
        R.id.img_eye_close,
        R.id.tv_reg,
        R.id.week_login_layout,
        R.id.login_btn
})
public void clickEvent(View view) {

    switch (view.getId()) {
        case R.id.img_eye_open:
            Log.d(TAG, "clickEvent: img_eye_open");
            eyeopenImg.setVisibility(View.GONE);
            eyecloseImg.setVisibility(View.VISIBLE);
            pwdEdt.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
            break;
        case R.id.img_eye_close:
            Log.d(TAG, "clickEvent: img_eye_close");
            eyecloseImg.setVisibility(View.GONE);
            eyeopenImg.setVisibility(View.VISIBLE);
            pwdEdt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
            break;
        case R.id.tv_reg:
            Log.d(TAG, "clickEvent: tv_reg");
            RegUserTypeActivity.launch(this);
            break;
        case R.id.week_login_layout:
            Log.d(TAG, "clickEvent: week_login_layout");
            weekLogin();
            break;
        case R.id.login_btn:
            Log.d(TAG, "clickEvent: login_btn");
            login();
            break;
    }
}
项目:starcraft-2-build-player    文件:RaceFragment.java   
private void exportBuildWithPermissionsGranted(long rowId) {
    if (!JsonBuildService.createBuildsDirectory()) {
        Toast.makeText(getActivity(),
                String.format(getString(R.string.error_couldnt_create_builds_dir), JsonBuildService.BUILDS_DIR),
                Toast.LENGTH_LONG).show();
        return;
    }

    final Build build = getDb().fetchBuild(rowId);
    if (build == null) {
        Timber.d("couldn't export build with id " + rowId + " as it doesn't exist in DB");
        return;
    }

    new MaterialDialog.Builder(getActivity())
            .title(R.string.dlg_enter_filename_title)
            .content(R.string.dlg_enter_filename_message)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_URI)
            .positiveText(android.R.string.ok)
            .negativeText(android.R.string.cancel)
            .input(getString(R.string.dlg_enter_filename_title),
                    suggestedFilenameForBuild(build), new MaterialDialog.InputCallback() {
                        @Override
                        public void onInput(MaterialDialog dialog, CharSequence filename) {
                            writeBuildToFile(filename.toString(), build);
                        }
                    }).show();
}
项目:simpleSDL    文件:SDLActivity.java   
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    ic = new SDLInputConnection(this, true);

    outAttrs.inputType = InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD;
    outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
            | EditorInfo.IME_FLAG_NO_FULLSCREEN /* API 11 */;

    return ic;
}
项目:behe-keyboard    文件:PCKeyboard.java   
private void setInputType() {

        /** Checks the preferences for the default keyboard layout.
         * If qwerty, we start out whether in qwerty or numbers, depending on the input type.
         * */

        EditorInfo attribute = getCurrentInputEditorInfo();

        if (PreferenceManager.getDefaultSharedPreferences(getBaseContext()).getString("start", "1").equals("1")) {
            switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
                case InputType.TYPE_CLASS_NUMBER:
                case InputType.TYPE_CLASS_DATETIME:
                case InputType.TYPE_CLASS_PHONE:
                    currentKeyboard = new LatinKeyboard(this, R.xml.numbers);
                    break;
                case InputType.TYPE_CLASS_TEXT:
                    int webInputType = attribute.inputType & InputType.TYPE_MASK_VARIATION;

                    if (webInputType == InputType.TYPE_TEXT_VARIATION_URI ||
                            webInputType == InputType.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT ||
                            webInputType == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
                            || webInputType == InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS) {
                        currentKeyboard = new LatinKeyboard(this, qwertyKeyboardID);
                    } else {
                        currentKeyboard = new LatinKeyboard(this, qwertyKeyboardID);
                    }

                    break;

                default:
                    currentKeyboard = new LatinKeyboard(this, qwertyKeyboardID);
                    break;
            }
        } else {
            setDefaultKeyboard();
        }
        if (kv != null) {
            kv.setKeyboard(currentKeyboard);
        }
    }
项目:CSipSimple    文件:SearchView.java   
/**
 * Updates the auto-complete text view.
 */
private void updateSearchAutoComplete() {
    // TODO mQueryTextView.setDropDownAnimationStyle(0); // no animation
    mQueryTextView.setThreshold(mSearchable.getSuggestThreshold());
    mQueryTextView.setImeOptions(mSearchable.getImeOptions());
    int inputType = mSearchable.getInputType();
    // We only touch this if the input type is set up for text (which it almost certainly
    // should be, in the case of search!)
    if ((inputType & InputType.TYPE_MASK_CLASS) == InputType.TYPE_CLASS_TEXT) {
        // The existence of a suggestions authority is the proxy for "suggestions
        // are available here"
        inputType &= ~InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
        if (mSearchable.getSuggestAuthority() != null) {
            inputType |= InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE;
            // TYPE_TEXT_FLAG_AUTO_COMPLETE means that the text editor is performing
            // auto-completion based on its own semantics, which it will present to the user
            // as they type. This generally means that the input method should not show its
            // own candidates, and the spell checker should not be in action. The text editor
            // supplies its candidates by calling InputMethodManager.displayCompletions(),
            // which in turn will call InputMethodSession.displayCompletions().
            inputType |= InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
        }
    }
    mQueryTextView.setInputType(inputType);
    if (mSuggestionsAdapter != null) {
        mSuggestionsAdapter.changeCursor(null);
    }
    // attach the suggestions adapter, if suggestions are available
    // The existence of a suggestions authority is the proxy for "suggestions available here"
    if (mSearchable.getSuggestAuthority() != null) {
        mSuggestionsAdapter = new SuggestionsAdapter(getContext(),
                this, mSearchable, mOutsideDrawablesCache);
        mQueryTextView.setAdapter(mSuggestionsAdapter);
        ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement(
                mQueryRefinement ? SuggestionsAdapter.REFINE_ALL
                : SuggestionsAdapter.REFINE_BY_ENTRY);
    }
}
项目:CSipSimple    文件:TeleNative.java   
@Override
public void fillLayout(final SipProfile account) {
    super.fillLayout(account);

    accountUsername.setTitle(R.string.w_common_phone_number);
    accountUsername.setDialogTitle(R.string.w_common_phone_number);
    accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);

}
项目:AndroidVerify    文件:FormTest.java   
@Before
public void setUp() {
    mContext = RuntimeEnvironment.application.getApplicationContext();
    mEmailEditText = new EditText(mContext);
    mEmailEditText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
    mPasswordEditText = new EditText(mContext);
}
项目:Mindustry    文件:TextFieldDialogListener.java   
public void clicked(final InputEvent event, float x, float y){

    if(Gdx.app.getType() == ApplicationType.Desktop) return;

    AndroidTextFieldDialog dialog = new AndroidTextFieldDialog();

    dialog.setTextPromptListener(new TextPromptListener(){
        public void confirm(String text){
            field.clearText();
            field.appendText(text);
            field.fire(new ChangeListener.ChangeEvent());
            Gdx.graphics.requestRendering();
        }
    });

    if(type == 0){
        dialog.setInputType(InputType.TYPE_CLASS_TEXT);
    }else if(type == 1){
        dialog.setInputType(InputType.TYPE_CLASS_NUMBER);
    }else if(type == 2){
        dialog.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
    }

    dialog.setConfirmButtonLabel("OK").setText(field.getText());
    dialog.setCancelButtonLabel("Cancel");
    dialog.setMaxLength(max);
    dialog.show();
    event.cancel();

}
项目:TransLinkMe-App    文件:SearchFragment.java   
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    inflater.inflate(R.menu.menu_search_view, menu);
    MenuItem menuItem = menu.findItem(R.id.action_search);

    mSearchView = (SearchView) menuItem.getActionView();
    mSearchView.setInputType(InputType.TYPE_CLASS_NUMBER);
    mSearchView.setQueryHint(getString(R.string.fragment_search_search_view_hint));
    mSearchView.setOnQueryTextListener(this);
}
项目:AOSP-Kayboard-7.1.2    文件:InputAttributes.java   
private static String toInputClassString(final int inputClass) {
    switch (inputClass) {
    case InputType.TYPE_CLASS_TEXT:
        return "TYPE_CLASS_TEXT";
    case InputType.TYPE_CLASS_PHONE:
        return "TYPE_CLASS_PHONE";
    case InputType.TYPE_CLASS_NUMBER:
        return "TYPE_CLASS_NUMBER";
    case InputType.TYPE_CLASS_DATETIME:
        return "TYPE_CLASS_DATETIME";
    default:
        return String.format("unknownInputClass<0x%08x>", inputClass);
    }
}
项目:Clipcon-AndroidClient    文件:MainActivity.java   
public void showJoinDialog() {
    Log.d("delf", "join group button clicked");
    new MaterialDialog.Builder(this)
            .title(R.string.inputKey)
            .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PERSON_NAME)
            .positiveText(R.string.joinEn)
            .input(R.string.empty, R.string.empty, false, new MaterialDialog.InputCallback() {
                @Override
                public void onInput(@NonNull MaterialDialog dialog, final CharSequence inputGroupKey) {
                    final EndpointInBackGround.BackgroundCallback result = new EndpointInBackGround.BackgroundCallback() {
                        @Override
                        public void onSuccess(JSONObject response) {
                            try {
                                if (response.get(Message.RESULT).equals(Message.CONFIRM)) {
                                    response.put(Message.GROUP_NAME, inputGroupKey.toString());
                                    startGroupActivity(response);
                                } else { // reject
                                    MainActivity.this.runOnUiThread(new Runnable() {
                                        @Override
                                        public void run() {
                                            alertDialog();
                                        }
                                    });
                                }
                            } catch (JSONException e) {
                                e.printStackTrace();
                            }
                        }
                    };
                    new EndpointInBackGround(result).execute(Message.REQUEST_JOIN_GROUP, inputGroupKey.toString());
                }
            }).show();
}
项目:RNLearn_Project1    文件:ReactTextInputPropertyTest.java   
@Test
public void testAutoCapitalize() {
  ReactEditText view = mManager.createViewInstance(mThemedContext);

  mManager.updateProperties(view, buildStyles());
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_WORDS).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS).isZero();

  mManager.updateProperties(
      view,
      buildStyles("autoCapitalize", InputType.TYPE_TEXT_FLAG_CAP_SENTENCES));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_WORDS).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS).isZero();

  mManager.updateProperties(
      view,
      buildStyles("autoCapitalize", InputType.TYPE_TEXT_FLAG_CAP_WORDS));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_WORDS).isNotZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS).isZero();

  mManager.updateProperties(
      view,
      buildStyles("autoCapitalize", InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_WORDS).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS).isNotZero();

  mManager.updateProperties(
      view,
      buildStyles("autoCapitalize", InputType.TYPE_CLASS_TEXT));
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_WORDS).isZero();
  assertThat(view.getInputType() & InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS).isZero();
}
项目:Phoenix-for-VK    文件:ChatFragment.java   
@Override
public void showChatTitleChangeDialog(String initialValue) {
    new InputTextDialog.Builder(getActivity())
            .setAllowEmpty(false)
            .setInputType(InputType.TYPE_CLASS_TEXT)
            .setValue(initialValue)
            .setTitleRes(R.string.change_chat_title)
            .setCallback(newValue -> getPresenter().fireChatTitleTyped(newValue))
            .show();
}
项目:PowerfulEditText    文件:PowerfulEditText.java   
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_UP) {

        boolean clearTouched =
                ( getWidth() - mBtnPadding - mBtnWidth < event.getX() )
                        && (event.getX() < getWidth() - mBtnPadding)
                        && isFocused();
        boolean visibleTouched =
                (getWidth() - mBtnPadding * 3 - mBtnWidth * 2 < event.getX())
                        && (event.getX() < getWidth() - mBtnPadding * 3 - mBtnWidth)
                        && isPassword && isFocused();

        if (clearTouched) {
            setError(null);
            setText("");
            return true;
        } else if (visibleTouched) {
            if (isPasswordVisible) {
                isPasswordVisible = false;
                setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD | InputType.TYPE_CLASS_TEXT);
                setSelection(getText().length());
                invalidate();
            } else {
                isPasswordVisible = true;
                setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
                setSelection(getText().length());
                invalidate();
            }
            return true;
        }
    }
    return super.onTouchEvent(event);
}
项目:DAPNETApp    文件:PostCallActivity.java   
private void setCallsigns(CallSignResource[] data) {
    callSignsCompletion = (CallsignsCompletionView) findViewById(R.id.callSignSearchView);
    callSignsCompletion.setAdapter(generateAdapter(data));
    callSignsCompletion.setTokenListener(this);
    callSignsCompletion.setTokenClickStyle(TokenCompleteTextView.TokenClickStyle.Select);
    callSignsCompletion.allowDuplicates(false);
    callSignsCompletion.setThreshold(0);
    callSignsCompletion.setInputType(InputType.TYPE_CLASS_TEXT|InputType.TYPE_TEXT_VARIATION_FILTER|InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    callSignsCompletion.performBestGuess(true);
}
项目:Phoenix-for-VK    文件:UserWallFragment.java   
@Override
public void showEditStatusDialog(String initialValue) {
    new InputTextDialog.Builder(getActivity())
            .setInputType(InputType.TYPE_CLASS_TEXT)
            .setTitleRes(R.string.edit_status)
            .setHint(R.string.enter_your_status)
            .setValue(initialValue)
            .setAllowEmpty(true)
            .setCallback(newValue -> getPresenter().fireNewStatusEntered(newValue))
            .show();
}
项目:MyPlace    文件:MainActivity.java   
public void onAddRoomClick(final int createOrJoin) {
    actionMenu.collapse();
    LayoutInflater inflater = LayoutInflater.from(context);
    View dialogView = inflater.inflate(R.layout.dialog_add_room, null);

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setView(dialogView);

    final EditText inputRoom = (EditText) dialogView.findViewById(R.id.input_room);
    if (getResources().getString(createOrJoin).equals(getResources().getString(R.string.join_room))) {
        inputRoom.setHint(R.string.enter_room_id);
        inputRoom.setInputType(InputType.TYPE_CLASS_NUMBER);
    }

    builder.setPositiveButton(createOrJoin, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String nameOrId = inputRoom.getText().toString();

            if (getResources().getString(createOrJoin).equals(getResources().getString(R.string.join_room))) {
                joinRoomRequest(Integer.parseInt(nameOrId));
            } else {
                createRoomRequest(nameOrId);
            }
        }
    });

    AlertDialog alertDialog = builder.create();
    alertDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    alertDialog.show();
}
项目:KernelAdiutor-Mod    文件:VMFragment.java   
@Override
protected void addItems(List<RecyclerViewItem> items) {
    mVMs.clear();
    for (int i = 0; i < VM.size(); i++) {
        if (VM.exists(i)) {
            GenericSelectView vm = new GenericSelectView();
            vm.setSummary(VM.getName(i));
            vm.setValue(VM.getValue(i));
            vm.setValueRaw(vm.getValue());
            vm.setInputType(InputType.TYPE_CLASS_NUMBER);

            final int position = i;
            vm.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {
                @Override
                public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                    VM.setValue(value, position, getActivity());
                    genericSelectView.setValue(value);
                    refreshVMs();
                }
            });

            items.add(vm);
            mVMs.add(vm);
        }
    }

    if (ZRAM.supported()) {
        zramInit(items);
    }
    zswapInit(items);
}
项目:CSipSimple    文件:Fix2Mob.java   
@Override
public void fillLayout(final SipProfile account) {
    super.fillLayout(account);

    accountUsername.setTitle(R.string.w_common_phone_number);
    accountUsername.setDialogTitle(R.string.w_common_phone_number);
    accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);

}