Example usage for android.view.inputmethod InputMethodManager SHOW_FORCED

List of usage examples for android.view.inputmethod InputMethodManager SHOW_FORCED

Introduction

In this page you can find the example usage for android.view.inputmethod InputMethodManager SHOW_FORCED.

Prototype

int SHOW_FORCED

To view the source code for android.view.inputmethod InputMethodManager SHOW_FORCED.

Click Source Link

Document

Flag for #showSoftInput to indicate that the user has forced the input method open (such as by long-pressing menu) so it should not be closed until they explicitly do so.

Usage

From source file:net.evendanan.android.thumbremote.ui.RemoteUiActivity.java

private void showOnScreenKeyboard() {
    mKeyboardText.setVisibility(View.VISIBLE);
    mKeyboardText.requestFocus();
    mImeManager.showSoftInput(mKeyboardText, InputMethodManager.SHOW_FORCED);
}

From source file:net.momodalo.app.vimtouch.VimTouch.java

private void doToggleSoftKeyboard() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    // force leave fullscreen first
    WindowManager.LayoutParams attrs = getWindow().getAttributes();
    if ((attrs.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0) {
        attrs.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().setAttributes(attrs);
        mFullscreen = false;//  w  ww .  j  av a2s . c  o m
        mOptionMenu.findItem(R.id.menu_fullscreen).setChecked(mFullscreen);
    }
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

}

From source file:com.saphion.stencilweather.activities.MainActivity.java

private void InitiateSearch() {

    initThreading();/*www  . j  a  v a 2 s  .co  m*/

    setAdapters();

    toolbar.inflateMenu(R.menu.menu_add);

    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            int menuItem = item.getItemId();
            switch (menuItem) {
            case R.id.action_search:
                IsAdapterEmpty();
                InitiateSearch.handleToolBar(MainActivity.this, card_search, toolbar, /*view_search,*/ listView,
                        edit_text_search, materialMenu);
                showDark();
                break;
            case R.id.action_more:
                initiateActions(true);
                return true;
            default:
                break;
            }
            return false;
        }
    });
    listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

            if (!(parent.getItemAtPosition(position).toString().equalsIgnoreCase("Loading...")
                    || parent.getItemAtPosition(position).toString().equalsIgnoreCase("No suggestions")
                    || parent.getItemAtPosition(position).toString().equalsIgnoreCase(
                            "Unable To Connect to Internet, Please Check Your Network Settings."))) {

                new GetLL(getBaseContext(), (WLocation) parent.getItemAtPosition(position)).execute();

                if (card_search.getVisibility() == View.VISIBLE) {
                    InitiateSearch.handleToolBar(MainActivity.this, card_search, toolbar,
                            /*view_search,*/ listView, edit_text_search, materialMenu);
                    hideDark();
                }
                listView.setVisibility(View.GONE);
                edit_text_search.setText("");
                ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
                        .hideSoftInputFromWindow(edit_text_search.getWindowToken(), 0);

            }
        }
    });

    edit_text_search.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence s, int start, int count, int after) {

        }

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if (edit_text_search.getText().toString().length() == 0) {
                clearSearch.setVisibility(View.GONE);
                suggestionAdapter.clear();
                IsAdapterEmpty();
                listView.setVisibility(View.GONE);
                pb.setVisibility(View.GONE);

                if (suggestionPending != null)
                    suggestionPending.cancel(true);

            } else {
                clearSearch.setImageResource(R.drawable.ic_close);
                IsAdapterEmpty();

                pb.setVisibility(View.VISIBLE);
                clearSearch.setVisibility(View.GONE);
                suggestionAdapter.clear();
                queueUpdate(1000 /* milliseconds */);

            }
        }

        @Override
        public void afterTextChanged(Editable s) {

        }
    });
    clearSearch.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (edit_text_search.getText().toString().length() > 0) {
                //                    mAsyncTask.cancel(true);
                edit_text_search.setText("");
                listView.setVisibility(View.GONE);
                suggestionAdapter.clear();
                //                    clearItems();
                ((InputMethodManager) MainActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE))
                        .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
                IsAdapterEmpty();
            }
        }
    });

}

From source file:org.onebusaway.android.util.UIUtils.java

/**
 * Open the soft keyboard//  w  ww .  jav a  2s  .c  o  m
 */
public static void openKeyboard(Context context) {
    InputMethodManager inputMethodManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_NOT_ALWAYS);
}

From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java

private void toggleBtnEmojicon(boolean visible) {
    if (visible) {
        if (isKeyBoardVisible) {
            backScroll();// w  w w. j  ava2 s  .  c o m
            mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                mPagerLayout.setVisibility(View.VISIBLE);
                mEmojiconsLayout.setVisibility(View.VISIBLE);
                mSharesLayout.setVisibility(View.GONE);
                mEditText.requestFocus();
            }
        }, 200);
    } else {
        if (!isKeyBoardVisible) {
            mInputManager.toggleSoftInputFromWindow(mEditText.getWindowToken(), InputMethodManager.SHOW_FORCED,
                    0);
        }
        mEmojiconsLayout.setVisibility(View.GONE);
        mPagerLayout.setVisibility(View.GONE);
    }

    mEditText.setOnFocusChangeListener(new android.view.View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                // ?
                mEmojiconsLayout.setVisibility(View.GONE);
                mPagerLayout.setVisibility(View.GONE);
            } else {
                // ?
            }
        }
    });

}

From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java

private void toggleBtnAdd(boolean visible) {
    if (visible) {
        if (isKeyBoardVisible) {
            backScroll();//from   w  ww  .jav a 2s.  c o  m
            mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                //??  2015-08-12
                if (isKeyBoardVisible) {
                    mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
                }
                mPagerLayout.setVisibility(View.VISIBLE);
                mSharesLayout.setVisibility(View.VISIBLE);
                mEmojiconsLayout.setVisibility(View.GONE);
                mBtnVoice.setSelected(false);
                mBtnVoiceInput.setVisibility(View.GONE);
                mEditLayout.setVisibility(View.VISIBLE);
                mEditText.requestFocus();
            }
        }, 200);
    } else {
        if (!isKeyBoardVisible) {
            mInputManager.toggleSoftInputFromWindow(mEditText.getWindowToken(), InputMethodManager.SHOW_FORCED,
                    0);
        }
        mSharesLayout.setVisibility(View.GONE);
        mPagerLayout.setVisibility(View.GONE);
    }
    mEditText.setOnFocusChangeListener(new android.view.View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (!hasFocus) {
                // ?
                mEmojiconsLayout.setVisibility(View.GONE);
                mPagerLayout.setVisibility(View.GONE);
            } else {
                // ?
            }
        }
    });
}

From source file:indrora.atomic.activity.ConversationActivity.java

/**
 * Open the soft keyboard (helper function)
 *//*from   w  w w . j  av a  2s  .  c o m*/
private void openSoftKeyboard(View view) {
    ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)).showSoftInput(view,
            InputMethodManager.SHOW_FORCED);
}

From source file:com.moonpi.tapunlock.MainActivity.java

@Override
protected void onNewIntent(Intent intent) {
    String action = intent.getAction();

    if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action)) {
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

        // Get tag ID and turn into String
        byte[] tagIDbytes = tag.getId();
        tagID = bytesToHex(tagIDbytes);/*from   w  ww.j a va2s . c  o  m*/

        if (!tagID.equals("")) {
            // Dismiss the 'Scan NFC Tag' dialog and show the 'Set tag name' dialog
            dismissDialog(DIALOG_READ);

            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

            MainActivity.this.showDialog(DIALOG_SET_TAGNAME);
        }
    }
}

From source file:org.protocoderrunner.apprunner.api.PUI.java

@ProtocoderScript
@APIMethod(description = "Show the virtual keyboard", example = "")
@APIParam(params = { "boolean" })
public void showVirtualKeys(boolean show) {
    initializeLayout();/*w  w w  .j a va 2 s  .  c  o m*/
    InputMethodManager imm = (InputMethodManager) a.get().getSystemService(a.get().INPUT_METHOD_SERVICE);

    if (show) {
        imm.showSoftInput(appRunnerActivity.get().getCurrentFocus(), InputMethodManager.SHOW_FORCED);
        uiAbsoluteLayout.setFocusable(true);
        uiAbsoluteLayout.setFocusableInTouchMode(true);

    } else {
        imm.hideSoftInputFromWindow(appRunnerActivity.get().getCurrentFocus().getWindowToken(), 0);
    }
}

From source file:org.zywx.wbpalmstar.plugin.chatkeyboard.ACEChatKeyboardView.java

private void toggleBtnVoice() {
    if (mBtnVoiceInput.getVisibility() == View.GONE) {
        if (isKeyBoardVisible) {
            backScroll();/*from   w ww .  j  av a 2  s  . c  o  m*/
            mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
        }
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                mBtnVoice.setSelected(true);
                mBtnVoiceInput.setVisibility(View.VISIBLE);
                mEditLayout.setVisibility(View.GONE);
                mEmojiconsLayout.setVisibility(View.GONE);
                mSharesLayout.setVisibility(View.GONE);
                mPagerLayout.setVisibility(View.GONE);
            }
        }, 200);
    } else {
        if (!isKeyBoardVisible) {
            mEditText.requestFocus();
            mInputManager.toggleSoftInputFromWindow(mEditText.getWindowToken(), InputMethodManager.SHOW_FORCED,
                    0);
        }
        mBtnVoice.setSelected(false);
        mBtnVoiceInput.setVisibility(View.GONE);
        mEditLayout.setVisibility(View.VISIBLE);
        mEmojiconsLayout.setVisibility(View.GONE);
        mSharesLayout.setVisibility(View.GONE);
        mPagerLayout.setVisibility(View.GONE);
    }
}