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:io.github.vomitcuddle.SearchViewAllowEmpty.SearchView.java

/**
 * Updates the auto-complete text view./*w  w  w. ja va  2s. c o m*/
 */
private void updateSearchAutoComplete() {
    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);
    }
}

From source file:android.support.v7.widget.SearchView.java

/**
 * Updates the auto-complete text view.//from   w  ww.ja  v  a2  s.  c om
 */
@TargetApi(Build.VERSION_CODES.FROYO)
private void updateSearchAutoComplete() {
    mSearchSrcTextView.setThreshold(mSearchable.getSuggestThreshold());
    mSearchSrcTextView.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;
        }
    }
    mSearchSrcTextView.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);
        mSearchSrcTextView.setAdapter(mSuggestionsAdapter);
        ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement(
                mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY);
    }
}

From source file:com.iiordanov.bVNC.RemoteCanvas.java

@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
    android.util.Log.d(TAG, "onCreateInputConnection called");
    int version = android.os.Build.VERSION.SDK_INT;
    BaseInputConnection bic = null;//w w  w  .jav  a 2s .  c  o m
    if (!bb && version >= Build.VERSION_CODES.JELLY_BEAN) {
        bic = new BaseInputConnection(this, false) {
            final static String junk_unit = "%%%%%%%%%%";
            final static int multiple = 1000;
            Editable e;

            @Override
            public Editable getEditable() {
                if (e == null) {
                    int numTotalChars = junk_unit.length() * multiple;
                    String junk = new String();
                    for (int i = 0; i < multiple; i++) {
                        junk += junk_unit;
                    }
                    e = Editable.Factory.getInstance().newEditable(junk);
                    Selection.setSelection(e, numTotalChars);
                    if (RemoteCanvas.this.keyboard != null) {
                        RemoteCanvas.this.keyboard.skippedJunkChars = false;
                    }
                }
                return e;
            }
        };
    } else {
        bic = new BaseInputConnection(this, false);
    }

    outAttrs.actionLabel = null;
    outAttrs.inputType = InputType.TYPE_NULL;
    // Workaround for IME's that don't support InputType.TYPE_NULL.
    if (version >= 21) {
        outAttrs.inputType = InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
        outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_FULLSCREEN;
    }
    return bic;
}

From source file:cm.aptoide.com.actionbarsherlock.widget.SearchView.java

/**
 * Updates the auto-complete text view.//from  ww w.  jav a 2  s  .  c  o  m
 */
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);
    }
}

From source file:com.example.navigationsearchview.NavigationSearchView.java

/**
 * Updates the auto-complete text view./*from  w ww.  j av  a2  s. c  om*/
 */
@TargetApi(Build.VERSION_CODES.FROYO)
private void updateSearchAutoComplete() {
    mSearchSrcTextView.setThreshold(mSearchable.getSuggestThreshold());
    mSearchSrcTextView.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;
        }
    }
    mSearchSrcTextView.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);
        mSearchSrcTextView.setAdapter(mSuggestionsAdapter);
        ((SuggestionsAdapter) mSuggestionsAdapter).setQueryRefinement(
                mQueryRefinement ? SuggestionsAdapter.REFINE_ALL : SuggestionsAdapter.REFINE_BY_ENTRY);
    }
}

From source file:com.maskyn.fileeditorpro.activity.MainActivity.java

void aPreferenceValueWasChanged(List<PreferenceChangeType> types) {

    if (types.contains(PreferenceChangeType.THEME_CHANGE)) {
        ThemeUtils.setWindowsBackground(this);
        AccessoryView accessoryView = (AccessoryView) findViewById(R.id.accessoryView);
        accessoryView.updateTextColors();
    }/*from  w  w  w  .  j  a  va 2 s  .c  om*/

    if (types.contains(PreferenceChangeType.WRAP_CONTENT)) {
        if (PreferenceHelper.getWrapContent(this)) {
            horizontalScroll.removeView(mEditor);
            verticalScroll.removeView(horizontalScroll);
            verticalScroll.addView(mEditor);
        } else {
            verticalScroll.removeView(mEditor);
            verticalScroll.addView(horizontalScroll);
            horizontalScroll.addView(mEditor);
        }
    } else if (types.contains(PreferenceChangeType.LINE_NUMERS)) {
        mEditor.disableTextChangedListener();
        mEditor.replaceTextKeepCursor(null);
        mEditor.enableTextChangedListener();
        mEditor.updatePadding();
    } else if (types.contains(PreferenceChangeType.SYNTAX)) {
        mEditor.disableTextChangedListener();
        mEditor.replaceTextKeepCursor(mEditor.getText().toString());
        mEditor.enableTextChangedListener();
    } else if (types.contains(PreferenceChangeType.MONOSPACE)) {
        if (PreferenceHelper.getUseMonospace(this))
            mEditor.setTypeface(Typeface.MONOSPACE);
        else
            mEditor.setTypeface(Typeface.DEFAULT);
    } else if (types.contains(PreferenceChangeType.THEME_CHANGE)) {
        if (PreferenceHelper.getLightTheme(this)) {
            mEditor.setTextColor(getResources().getColor(R.color.textColorInverted));
        } else {
            mEditor.setTextColor(getResources().getColor(R.color.textColor));
        }
    } else if (types.contains(PreferenceChangeType.TEXT_SUGGESTIONS)
            || types.contains(PreferenceChangeType.READ_ONLY)) {
        if (PreferenceHelper.getReadOnly(this)) {
            mEditor.setReadOnly(true);
        } else {
            mEditor.setReadOnly(false);
            if (PreferenceHelper.getSuggestionActive(this)) {
                mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE
                        | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
            } else {
                mEditor.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE
                        | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
                        | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD
                        | InputType.TYPE_TEXT_FLAG_IME_MULTI_LINE);
            }
        }
        // sometimes it becomes monospace after setting the input type
        if (PreferenceHelper.getUseMonospace(this))
            mEditor.setTypeface(Typeface.MONOSPACE);
        else
            mEditor.setTypeface(Typeface.DEFAULT);
    } else if (types.contains(PreferenceChangeType.FONT_SIZE)) {
        mEditor.updatePadding();
        mEditor.setTextSize(PreferenceHelper.getFontSize(this));
    } else if (types.contains(PreferenceChangeType.ACCESSORY_VIEW)) {
        HorizontalScrollView parentAccessoryView = (HorizontalScrollView) findViewById(
                R.id.parent_accessory_view);
        ViewUtils.setVisible(parentAccessoryView, PreferenceHelper.getUseAccessoryView(this));
        mEditor.updatePadding();
    } else if (types.contains(PreferenceChangeType.ENCODING)) {
        String oldEncoding, newEncoding;
        oldEncoding = currentEncoding;
        newEncoding = PreferenceHelper.getEncoding(this);
        try {
            final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding);
            mEditor.disableTextChangedListener();
            mEditor.replaceTextKeepCursor(new String(oldText, newEncoding));
            mEditor.enableTextChangedListener();
            currentEncoding = newEncoding;
        } catch (UnsupportedEncodingException ignored) {
            try {
                final byte[] oldText = mEditor.getText().toString().getBytes(oldEncoding);
                mEditor.disableTextChangedListener();
                mEditor.replaceTextKeepCursor(new String(oldText, "UTF-16"));
                mEditor.enableTextChangedListener();
            } catch (UnsupportedEncodingException ignored2) {
            }
        }
    }
}

From source file:dentex.youtube.downloader.DashboardActivity.java

public void spawnSearchBar() {
    Utils.logger("d", "showing searchbar...", DEBUG_TAG);

    EditText inputSearch = new EditText(DashboardActivity.this);
    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    inputSearch.setLayoutParams(layoutParams);

    if (TextUtils.isEmpty(searchText)) {
        inputSearch.setHint(R.string.menu_search);
    } else {//from   w w w  . ja v a2 s. co m
        inputSearch.setText(searchText);
    }

    inputSearch.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP);
    inputSearch.setSingleLine();
    inputSearch.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
    inputSearch.setId(999);

    LinearLayout layout = (LinearLayout) findViewById(R.id.dashboard);
    layout.addView(inputSearch, 0);
    isSearchBarVisible = true;

    inputSearch.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            Utils.logger("d", "Text [" + s + "] - Start [" + start + "] - Before [" + before + "] - Count ["
                    + count + "]", DEBUG_TAG);

            if (count < before)
                da.resetData();
            da.getFilter().filter(s.toString());
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
        }
    });
}

From source file:com.tandong.sa.sherlock.widget.SearchView.java

/**
 * Updates the auto-complete text view.//from  w  ww  . ja v a  2 s .  c o  m
 */
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);
    }
}

From source file:com.aliyun.homeshell.Folder.java

protected void myonFinishInflate(Folder v) {
    setContent((CellLayout) findViewById(R.id.folder_content));
    mContent.setGridSize(0, 0);//from w ww.java2 s.  c  o  m
    mContent.getShortcutsAndWidgets().setMotionEventSplittingEnabled(false);
    mContent.setInvertIfRtl(true);
    mContentList.add(mContent);
    mFolderName = (FolderEditText) findViewById(R.id.folder_name);
    mFolderName.setFolder(v);
    mFolderName.setOnFocusChangeListener(v);
    /*YUNOS BEGIN*/
    //##date:2014/9/25 ##author:yangshan.ys BugId:5255762
    mContentAdapter = new FolderContentAdapter();
    mFolderViewPager = (FolderSelectPager) findViewById(R.id.folder_view_pager);
    mFolderViewPager.setOffscreenPageLimit(40);
    mFolderViewPager.setAdapter(mContentAdapter);
    mFolderViewPager.setOnPageChangeListener(pageChangeListener);
    mFolderViewPager.setOnClickListener(v);
    mPageIndicator = (PageIndicatorView) findViewById(R.id.folder_page_indicator);
    mPageIndicator.setNeedLine(false);
    /*YUNOS END*/
    // We find out how tall the text view wants to be (it is set to wrap_content), so that
    // we can allocate the appropriate amount of space for it.
    int measureSpec = MeasureSpec.UNSPECIFIED;
    mFolderName.measure(measureSpec, measureSpec);
    /*YUNOS BEGIN*/
    //##module(component name)
    //##date:2014/06/06 ##author:jun.dongj@alibaba-inc.com##BugID:124683
    //folder name show wrong, when the system font is super big
    mFolderNameHeight = mFolderName.getMeasuredHeight();
    /*YUNOS END*/

    mFolderNameContentGap = getResources().getDimensionPixelSize(R.dimen.folder_name_content_gap);
    // We disable action mode for now since it messes up the view on phones
    mFolderName.setOnEditorActionListener(v);
    mFolderName.addTextChangedListener(new TextWatcher() {
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {
        }

        @Override
        public void afterTextChanged(Editable s) {
            mFolderName.requestLayout();
        }
    });
    mFolderName.setSelectAllOnFocus(true);
    //topwise zyf add for fixedfolder ???
    mFolderName.setEnabled(false);
    //topwise zyf add end
    mFolderName.setInputType(mFolderName.getInputType() | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS
            | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
    showFolderNameOutline(false);
    updateFolderLayout(mIconManager.supprtCardIcon());
    mLastOrientation = getResources().getConfiguration().orientation;
}