Example usage for android.text InputType TYPE_TEXT_FLAG_NO_SUGGESTIONS

List of usage examples for android.text InputType TYPE_TEXT_FLAG_NO_SUGGESTIONS

Introduction

In this page you can find the example usage for android.text InputType TYPE_TEXT_FLAG_NO_SUGGESTIONS.

Prototype

int TYPE_TEXT_FLAG_NO_SUGGESTIONS

To view the source code for android.text InputType TYPE_TEXT_FLAG_NO_SUGGESTIONS.

Click Source Link

Document

Flag for #TYPE_CLASS_TEXT : the input method does not need to display any dictionary-based candidates.

Usage

From source file:Main.java

/**
 * Disable suggestions on EditText widgets. This was added to
 * support SDK levels where suggestions crashed apps without the
 * appropriate Android Support library compiled into the app.
 *
 * @param textview EditText widget to have its suggestion feature
 * disabled.//from  w ww .  jav a  2 s . co m
 */
public static void disableSuggestions(EditText textview) {
    textview.setInputType(textview.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
}

From source file:Main.java

/**
 * Configures an EditText that will be used to let the user enter a key alias.
 *
 * @param editText  The EditText to configure.
 * @param maxLength The maximum number of characters the user can write in the EditText.
 *//*from ww  w  .  j  a  v a2s  .c  o m*/
public static void setUpAliasEditText(EditText editText, int maxLength) {
    editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(maxLength) });
    editText.setSingleLine();
    editText.setInputType(
            InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
}

From source file:Main.java

public static void uppercaseEditText(final EditText editText) {
    editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS
            | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    editText.addTextChangedListener(new TextWatcher() {

        @Override/*from   www  . ja v a2  s.  co m*/
        public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {
        }

        @Override
        public void afterTextChanged(Editable arg0) {
            String s = arg0.toString();
            if (!s.equals(s.toUpperCase().trim())) {
                s = s.toUpperCase().trim();
                editText.setText(s);
                editText.setSelection(s.length());
            }
        }
    });
}

From source file:com.cyanogenmod.eleven.menu.BasePlaylistDialog.java

/**
 * {@inheritDoc}//from   ww w.ja va 2  s  .c  om
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    // Initialize the alert dialog
    mPlaylistDialog = new AlertDialog.Builder(getActivity()).create();
    // Initialize the edit text
    mPlaylist = new EditText(getActivity());
    // To show the "done" button on the soft keyboard
    mPlaylist.setSingleLine(true);
    // All caps
    mPlaylist.setInputType(mPlaylist.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    // Set the save button action
    mPlaylistDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            onSaveClick();
            MusicUtils.refresh();
            dialog.dismiss();
        }
    });
    // Set the cancel button action
    mPlaylistDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(R.string.cancel), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            MusicUtils.refresh();
            dialog.dismiss();
        }
    });

    mPlaylist.post(new Runnable() {

        @Override
        public void run() {
            // Request focus to the edit text
            mPlaylist.requestFocus();
            // Select the playlist name
            mPlaylist.selectAll();
        };
    });

    initObjects(savedInstanceState);
    mPlaylistDialog.setTitle(mPrompt);
    mPlaylistDialog.setView(mPlaylist);
    mPlaylist.setText(mDefaultname);
    mPlaylist.setSelection(mDefaultname.length());
    mPlaylist.addTextChangedListener(mTextWatcher);
    mPlaylistDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
    mPlaylistDialog.show();
    return mPlaylistDialog;
}

From source file:com.boko.vimusic.menu.BasePlaylistDialog.java

/**
 * {@inheritDoc}/*w  w w  .  java2  s . c  o  m*/
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    // Initialize the alert dialog
    mPlaylistDialog = new AlertDialog.Builder(getActivity()).create();
    // Initialize the edit text
    mPlaylist = new EditText(getActivity());
    // To show the "done" button on the soft keyboard
    mPlaylist.setSingleLine(true);
    // All caps
    mPlaylist.setInputType(mPlaylist.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    // Set the save button action
    mPlaylistDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            onSaveClick();
            MusicUtils.refresh(getActivity());
            dialog.dismiss();
        }
    });
    // Set the cancel button action
    mPlaylistDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(R.string.cancel), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            closeKeyboard();
            MusicUtils.refresh(getActivity());
            dialog.dismiss();
        }
    });

    mPlaylist.post(new Runnable() {

        @Override
        public void run() {
            // Open up the soft keyboard
            openKeyboard();
            // Request focus to the edit text
            mPlaylist.requestFocus();
            // Select the playlist name
            mPlaylist.selectAll();
        };
    });

    initObjects(savedInstanceState);
    mPlaylistDialog.setTitle(mPrompt);
    mPlaylistDialog.setView(mPlaylist);
    mPlaylist.setText(mDefaultname);
    mPlaylist.setSelection(mDefaultname.length());
    mPlaylist.addTextChangedListener(mTextWatcher);
    mPlaylistDialog.show();
    return mPlaylistDialog;
}

From source file:com.andrew.apollo.menu.BasePlaylistDialog.java

/**
 * {@inheritDoc}/*from  w ww.  j  a  va 2  s .c  o m*/
 */
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    // Initialize the alert dialog
    mPlaylistDialog = new AlertDialog.Builder(getActivity()).create();
    // Initialize the edit text
    mPlaylist = new EditText(getActivity());
    // To show the "done" button on the soft keyboard
    mPlaylist.setSingleLine(true);
    // All caps
    mPlaylist.setInputType(mPlaylist.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    // Set the save button action
    mPlaylistDialog.setButton(Dialog.BUTTON_POSITIVE, getString(R.string.save), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            onSaveClick();
            MusicUtils.refresh();
            dialog.dismiss();
        }
    });
    // Set the cancel button action
    mPlaylistDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(R.string.cancel), new OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            closeKeyboard();
            MusicUtils.refresh();
            dialog.dismiss();
        }
    });

    mPlaylist.post(new Runnable() {

        @Override
        public void run() {
            // Open up the soft keyboard
            openKeyboard();
            // Request focus to the edit text
            mPlaylist.requestFocus();
            // Select the playlist name
            mPlaylist.selectAll();
        };
    });

    initObjects(savedInstanceState);
    mPlaylistDialog.setTitle(mPrompt);
    mPlaylistDialog.setView(mPlaylist);
    mPlaylist.setText(mDefaultname);
    mPlaylist.setSelection(mDefaultname.length());
    mPlaylist.addTextChangedListener(mTextWatcher);
    mPlaylistDialog.show();
    return mPlaylistDialog;
}

From source file:com.txusballesteros.PasswordEditText.java

private void initializeView(AttributeSet attrs) {
    setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    setTransformationMethod(PasswordTransformationMethod.getInstance());
    if (attrs != null) {
        TypedArray attributes = getContext().getTheme().obtainStyledAttributes(attrs,
                R.styleable.PasswordEditText, 0, 0);
        int drawableTint = attributes.getColor(R.styleable.PasswordEditText_drawableTintCompat, WITHOUT_TINT);
        showPasswordDrawable = getDrawable(attributes, R.styleable.PasswordEditText_showDrawable, drawableTint);
        hidePasswordDrawable = getDrawable(attributes, R.styleable.PasswordEditText_hideDrawable, drawableTint);
        if (showPasswordDrawable == null) {
            showPasswordDrawable = getDrawable(getResources().getDrawable(R.drawable.ic_password_visible_24dp),
                    drawableTint);/*from  w  w w  . jav  a 2  s  .com*/
        }
        if (hidePasswordDrawable == null) {
            hidePasswordDrawable = getDrawable(getResources().getDrawable(R.drawable.ic_password_hidden_24dp),
                    drawableTint);
        }
        if (showPasswordDrawable != null && hidePasswordDrawable != null) {
            setCompoundDrawablesWithIntrinsicBounds(null, null, showPasswordDrawable, null);
            setCompoundDrawablePadding(dp2px(DRAWABLE_PADDING_IN_DP));
        }
        attributes.recycle();
    }
}

From source file:de.appetites.android.menuItemSearchAction.MenuItemSearchAction.java

public MenuItemSearchAction(Context context, Menu menu, SearchPerformListener searchPerformListener,
        Drawable drawable, TextWatcher text, LinearLayout list) {
    super(context);
    this.searchPerformListener = searchPerformListener;
    this.context = context;

    createMenuItem(menu, drawable, list);

    // show search button on keyboard; this needs the setting of TYPE_TEXT... to be shown
    setImeOptions(EditorInfo.IME_ACTION_SEARCH);
    setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    setMaxLines(1);// ww  w. jav  a  2  s  . com

    this.addTextChangedListener(text);
}

From source file:com.wolkabout.hexiwear.view.Input.java

public Input(final Context context, final AttributeSet attrs) {
    super(context, attrs);
    final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.Input);
    defaultText = typedArray.getString(R.styleable.Input_text);
    hint = typedArray.getString(R.styleable.Input_hint);
    drawable = typedArray.getResourceId(R.styleable.Input_drawable, 0);
    maxLength = typedArray.getResourceId(R.styleable.Input_maxLength, 100);
    actionLabel = typedArray.getString(R.styleable.Input_actionLabel);
    textColor = typedArray.getColor(R.styleable.Input_textColor,
            ContextCompat.getColor(getContext(), R.color.primary_text));

    final int typeOrdinal = typedArray.getInt(R.styleable.Input_type, InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    type = Type.byOrdinal(typeOrdinal);

    typedArray.recycle();//w ww .java  2  s . c  o  m
}

From source file:com.miz.mizuu.fragments.AccountsFragment.java

@Override
public void onViewCreated(View v, Bundle savedInstanceState) {
    super.onViewCreated(v, savedInstanceState);

    traktUser = (EditText) v.findViewById(R.id.traktUsername);
    traktUser.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

    traktPass = (EditText) v.findViewById(R.id.traktPassword);
    traktPass.setTypeface(Typeface.DEFAULT);
    traktPass.setTransformationMethod(new PasswordTransformationMethod());

    traktLogIn = (Button) v.findViewById(R.id.traktLogIn);
    traktLogIn.setOnClickListener(new OnClickListener() {
        @Override//from   ww w  .  j  a v a2s  .  co  m
        public void onClick(View v) {
            new TraktLogin().execute();
        }
    });
    traktRemoveAccount = (Button) v.findViewById(R.id.traktRemoveAccount);
    traktRemoveAccount.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            traktRemove();
        }
    });
    traktSyncNow = (Button) v.findViewById(R.id.traktSyncNow);
    traktSyncNow.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            getActivity().startService(new Intent(getActivity(), TraktMoviesSyncService.class));
            getActivity().startService(new Intent(getActivity(), TraktTvShowsSyncService.class));
        }
    });

    syncTrakt = (CheckBox) v.findViewById(R.id.syncTrakt);
    syncTrakt.setChecked(settings.getBoolean(SYNC_WITH_TRAKT, true));
    syncTrakt.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            Editor editor = settings.edit();
            editor.putBoolean(SYNC_WITH_TRAKT, isChecked);
            editor.apply();
        }
    });

    traktUser.setText(settings.getString(TRAKT_USERNAME, ""));
    if (TextUtils.isEmpty(settings.getString(TRAKT_PASSWORD, ""))) {
        traktPass.setText("");
        traktUser.setEnabled(true);
        traktPass.setEnabled(true);
        traktLogIn.setVisibility(View.VISIBLE);
        traktSyncNow.setVisibility(View.GONE);
        traktRemoveAccount.setVisibility(View.GONE);
        syncTrakt.setVisibility(View.GONE);
        syncTrakt.setChecked(false);
    } else {
        traktPass.setText("password");
        traktUser.setEnabled(false);
        traktPass.setEnabled(false);
        traktLogIn.setVisibility(View.GONE);
        traktSyncNow.setVisibility(View.VISIBLE);
        traktRemoveAccount.setVisibility(View.VISIBLE);
        syncTrakt.setVisibility(View.VISIBLE);
        ;
    }
}