Example usage for android.view.inputmethod InputMethodManager SHOW_IMPLICIT

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

Introduction

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

Prototype

int SHOW_IMPLICIT

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

Click Source Link

Document

Flag for #showSoftInput to indicate that this is an implicit request to show the input window, not as the result of a direct request by the user.

Usage

From source file:org.gluu.super_gluu.app.activities.MainNavDrawerActivity.java

@Override
public void onCancel(PinCodeFragment.EntryType entryType) {

    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(
            Activity.INPUT_METHOD_SERVICE);
    if (inputMethodManager != null) {
        inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
    }/*from  w ww . j  a  v a2s. c  o m*/

    if (entryType == PinCodeFragment.EntryType.SETTING_NEW) {
        Settings.setPinCodeEnabled(getBaseContext(), false);
        Settings.clearPinCode(getBaseContext());
    }

    onBackPressed();
}

From source file:com.geecko.QuickLyric.fragment.LyricsViewFragment.java

private void startEditTagsMode() {
    ImageButton editButton = (ImageButton) getActivity().findViewById(R.id.edit_tags_btn);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        editButton.setImageResource(R.drawable.ic_edit_anim);
        ((Animatable) editButton.getDrawable()).start();
    } else//from   w ww . ja  v  a  2s. co  m
        editButton.setImageResource(R.drawable.ic_done);

    ((DrawerLayout) ((MainActivity) getActivity()).drawer)
            .setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
    mRefreshLayout.setEnabled(false);
    getActivity().findViewById(R.id.refresh_fab).setEnabled(false);
    ((RefreshIcon) getActivity().findViewById(R.id.refresh_fab)).hide();
    ((Toolbar) getActivity().findViewById(R.id.toolbar)).getMenu().clear();

    TextSwitcher textSwitcher = ((TextSwitcher) getActivity().findViewById(R.id.switcher));
    EditText songTV = (EditText) getActivity().findViewById(R.id.song);
    TextView artistTV = ((TextView) getActivity().findViewById(R.id.artist));

    EditText newLyrics = (EditText) getActivity().findViewById(R.id.edit_lyrics);
    newLyrics.setTypeface(LyricsTextFactory.FontCache.get("light", getActivity()));
    newLyrics.setText(((TextView) textSwitcher.getCurrentView()).getText(), TextView.BufferType.EDITABLE);

    textSwitcher.setVisibility(View.GONE);
    newLyrics.setVisibility(View.VISIBLE);

    songTV.setInputType(InputType.TYPE_CLASS_TEXT);
    artistTV.setInputType(InputType.TYPE_CLASS_TEXT);
    songTV.setBackgroundResource(R.drawable.abc_textfield_search_material);
    artistTV.setBackgroundResource(R.drawable.abc_textfield_search_material);

    if (songTV.requestFocus()) {
        InputMethodManager imm = (InputMethodManager) getActivity().getApplicationContext()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.SHOW_IMPLICIT);
    }
}

From source file:com.silentcircle.accounts.AccountStep3.java

private void authTokenError() {
    View view = getView();/*  ww  w. j av a  2s .co  m*/
    if (view == null)
        return;

    // Two-factor authentication token required. Rearrange the UI, the show the error text, input field, and Back and Next buttons
    mProgress.setVisibility(View.INVISIBLE);
    getView().findViewById(R.id.ProvisioningInProgress).setVisibility(View.INVISIBLE);
    mScroll.setVisibility(View.VISIBLE);
    mButtons.setVisibility(View.VISIBLE);
    view.findViewById(R.id.CheckBoxTCText).setVisibility(View.GONE);
    mTcCheckbox.setVisibility(View.GONE);
    mAuthToken.setVisibility(View.VISIBLE);
    mAuthToken.setText("");
    mAuthToken.requestFocus();
    View v = mParent.getCurrentFocus();
    if (v != null) {
        InputMethodManager imm = (InputMethodManager) mParent.getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
    }

    TextView errorText = (TextView) view.findViewById(R.id.license_error);

    errorText.setText(getString(R.string.provisioning_auth_token_text));
    errorText.setVisibility(View.VISIBLE);
}

From source file:com.jtschohl.androidfirewall.MainActivity.java

/**
 * search function//from w  w w  .j a  v a2  s .  c om
 */

public void searchapps() {
    final EditText filterText = (EditText) findViewById(R.id.search);
    filterText.addTextChangedListener(filterTextWatcher);
    filterText.post(new Runnable() {
        @Override
        public void run() {
            filterText.requestFocus();
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(filterText, InputMethodManager.SHOW_IMPLICIT);
        }
    });
}

From source file:com.raspi.chatapp.ui.chatting.SendImageFragment.java

/**
 * initialize the emojiconKeyboard// w  w w  . j av  a 2s . c  o m
 */
private void initEmoji(View view) {

    // save the views I will use
    final EmojiconEditText emojiconEditText = (EmojiconEditText) getActivity()
            .findViewById(R.id.send_image_description);
    final ImageButton emojiBtn = (ImageButton) view.findViewById(R.id.send_image_emoti_switch);
    mListener.setCurrentEmojiconEditText(emojiconEditText);
    // open/close the emojicon keyboard when pressing the button
    emojiBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (emojiconEditText == null)
                return;
            getActivity().getSupportFragmentManager().beginTransaction()
                    .replace(R.id.emojicon_keyboard, EmojiconsFragment.newInstance(!emojiKeyBoardOpen))
                    .commit();
            emojiconEditText.setFocusableInTouchMode(true);
            emojiconEditText.requestFocus();
            InputMethodManager inputMethodManager = (InputMethodManager) getActivity()
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            if (emojiKeyBoardOpen)
                inputMethodManager.showSoftInput(emojiconEditText, InputMethodManager.SHOW_IMPLICIT);
            else
                inputMethodManager.hideSoftInputFromWindow(emojiconEditText.getWindowToken(), 0);

            emojiKeyBoardOpen = !emojiKeyBoardOpen;
        }
    });
}

From source file:de.ddast.xandra.MainActivity.java

private void showSoftKeyboard(View view) {
    if (view.requestFocus()) {
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }/*from ww w.  j  a v  a 2s.c o  m*/
    if (mSpecialKeysVisibility == View.VISIBLE) {
        mLayoutKeys = (HorizontalScrollView) findViewById(R.id.layout_keys);
        Assert.assertNotNull(mLayoutKeys);
        mLayoutKeys.setVisibility(View.VISIBLE);
    }
}

From source file:com.novemser.voicetest.ui.MainActivity.java

public void sendMessage(View view) {
    msg = mMsg.getText().toString();//from w  ww  .  j  a  va2 s  . c o m
    if (TextUtils.isEmpty(msg)) {
        Toast.makeText(this, getResources().getText(R.string.noTextWarning), Toast.LENGTH_LONG).show();
        return;
    }

    ChatMessage to = new ChatMessage(ChatMessage.Type.OUTPUT, msg);
    to.setDate(new Date());
    mDatas.add(to);

    mAdapter.notifyDataSetChanged();
    mChatView.setSelection(mDatas.size() - 1);

    mMsg.setText("");

    // 
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    // InputMethodManager
    if (imm.isActive()) {
        // ?
        imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_NOT_ALWAYS);
        // ?????
    }

    understander.understandText(msg, textUnderstanderListener);
}

From source file:com.filterdevice.ProfileScanningFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();//from   w  ww . jav  a  2s  .  co  m
    inflater.inflate(R.menu.global, menu);
    final EditText mEditText = (EditText) menu.findItem(R.id.search).getActionView();
    mEditText.addTextChangedListener(textWatcher);

    MenuItem pairCache = menu.findItem(R.id.pairing);
    if (Utils.getBooleanSharedPreference(getActivity(), Constants.PREF_PAIR_CACHE_STATUS)) {
        pairCache.setChecked(true);
    } else {
        pairCache.setChecked(false);
    }

    MenuItem mSearch = menu.findItem(R.id.search);
    mSearch.setVisible(true);
    mSearch.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
        @Override
        public boolean onMenuItemActionCollapse(MenuItem item) {
            // Do something when collapsed
            View view = getActivity().getCurrentFocus();
            if (view != null) {
                InputMethodManager imm = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
            }
            Logger.e("Collapsed");
            return true; // Return true to collapse action view
        }

        @Override
        public boolean onMenuItemActionExpand(MenuItem item) {
            Logger.e("Expanded");
            mEditText.requestFocus();
            View view = getActivity().getCurrentFocus();
            if (view != null) {
                InputMethodManager inputManager = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                inputManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
            }
            return true; // Return true to expand action view
        }
    });

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.doplgangr.secrecy.views.VaultsListFragment.java

void switchView(final View parentView, final int showView) {
    getActivity().runOnUiThread(new Runnable() {
        @Override// w  w  w  .j a va2s  . c  o m
        public void run() {
            EditText passwordView = (EditText) parentView.findViewById(R.id.open_password);
            final View renameView = parentView.findViewById(R.id.rename_name);
            ViewAnimator viewAnimator = (ViewAnimator) parentView.findViewById(R.id.viewAnimator);
            viewAnimator.setInAnimation(context, R.anim.slide_down);

            int viewIndex = 0;
            switch (showView) {
            case R.id.vault_name_layout:
                viewIndex = 0;
                break;
            case R.id.vault_decrypt_layout:
                viewIndex = 1;
                if (passwordView != null) {
                    passwordView.requestFocus();
                    passwordView.setText(""); //Reset password field everytime
                }

                // Only one vault selected at that time
                passwordView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                    @Override
                    public void onFocusChange(View v, boolean hasFocus) {
                        if (!hasFocus) {
                            ViewAnimator viewAnimator = (ViewAnimator) parentView
                                    .findViewById(R.id.viewAnimator);
                            viewAnimator.setDisplayedChild(0);
                        }
                    }
                });
                kbdView = passwordView;
                imm.showSoftInput(passwordView, InputMethodManager.SHOW_IMPLICIT);
                break;
            case R.id.vault_delete_layout:
                viewIndex = 2;
                break;
            case R.id.vault_rename_layout:
                viewIndex = 3;
                if (renameView != null)
                    renameView.requestFocus();

                // Only one vault selected at that time
                renameView.setOnFocusChangeListener(new View.OnFocusChangeListener() {
                    @Override
                    public void onFocusChange(View v, boolean hasFocus) {
                        if (!hasFocus) {
                            ViewAnimator viewAnimator = (ViewAnimator) parentView
                                    .findViewById(R.id.viewAnimator);
                            viewAnimator.setDisplayedChild(0);
                        }
                    }
                });
                kbdView = renameView;
                imm.showSoftInput(renameView, InputMethodManager.SHOW_IMPLICIT);
                break;
            }

            viewAnimator.setDisplayedChild(viewIndex);
        }
    });
}

From source file:org.gluu.super_gluu.app.GluuMainActivity.java

@Override
public void onCorrectPinCode(boolean isPinCodeCorrect) {
    if (isPinCodeCorrect) {
        if (isOXRequestProtected) {
            //Hide keyboard
            ((InputMethodManager) this.getSystemService(Activity.INPUT_METHOD_SERVICE))
                    .toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0);
            this.onBackPressed();
            doQrRequest(oxPush2RequestProtected);
            isOXRequestProtected = false;
        } else {/*w w w. ja  v a 2s.com*/
            showAlertView("New Pin Added!");
        }
    } else {
        //to change pin code, first need check if user knows current one
        Intent intent = new Intent(GluuMainActivity.this, MainActivity.class);
        startActivity(intent);
        finish();
    }
}