Example usage for android.view.inputmethod InputMethodManager HIDE_IMPLICIT_ONLY

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

Introduction

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

Prototype

int HIDE_IMPLICIT_ONLY

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

Click Source Link

Document

Flag for #hideSoftInputFromWindow and InputMethodService#requestHideSelf(int) to indicate that the soft input window should only be hidden if it was not explicitly shown by the user.

Usage

From source file:Main.java

/**
 * Toggle Soft Input./*from   w ww  .  j a  va 2 s  .  co  m*/
 * @param context
 * @param showFlags
 */
public static void toggleSoftInput(Context context, int showFlags) {
    InputMethodManager inputManager = (InputMethodManager) context
            .getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.toggleSoftInput(showFlags, InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:Main.java

public static void showKeyboard(Activity activity) {
    getInputMethodManager(activity).toggleSoftInput(InputMethodManager.SHOW_FORCED,
            InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:org.transdroid.core.gui.FilterEntryDialog.java

/**
 * Opens a dialog that allows entry of a filter string, which (on confirmation) will be used to filter the list of 
 * torrents.//from   w  ww .ja  v  a  2s.c  om
 * @param activity The activity that opens (and owns) this dialog
 */
@SuppressLint("ValidFragment")
public static void startFilterEntry(final TorrentsActivity activity) {
    new DialogFragment() {
        public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState) {
            final EditText filterInput = new EditText(activity);
            filterInput.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
            ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE))
                    .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            return new AlertDialog.Builder(activity).setView(filterInput)
                    .setPositiveButton(android.R.string.ok, new OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            String filterText = filterInput.getText().toString();
                            if (activity != null)
                                activity.filterTorrents(filterText);
                        }
                    }).setNegativeButton(android.R.string.cancel, null).create();
        };
    }.show(activity.getSupportFragmentManager(), "filterentry");
}

From source file:org.transdroid.core.gui.search.UrlEntryDialog.java

/**
 * Opens a dialog that allows entry of a single URL string, which (on confirmation) will be supplied to the calling
 * activity's {@link TorrentsActivity#addTorrentByUrl(String, String) method}.
 * @param activity The activity that opens (and owns) this dialog
 *//* w w  w.jav  a  2s  . c o  m*/
@SuppressLint("ValidFragment")
public static void startUrlEntry(final TorrentsActivity activity) {
    new DialogFragment() {
        public android.app.Dialog onCreateDialog(android.os.Bundle savedInstanceState) {
            final EditText urlInput = new EditText(activity);
            urlInput.setInputType(InputType.TYPE_TEXT_VARIATION_URI);
            ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE))
                    .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            return new AlertDialog.Builder(activity).setView(urlInput)
                    .setPositiveButton(android.R.string.ok, new OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            // Assume text entry box input as URL and treat the filename (after the last /) as title
                            String url = urlInput.getText().toString();
                            Uri uri = Uri.parse(url);
                            if (activity != null && !TextUtils.isEmpty(url)) {
                                String title = NavigationHelper.extractNameFromUri(uri);
                                if (uri.getScheme() != null && uri.getScheme().equals("magnet")) {
                                    activity.addTorrentByMagnetUrl(url, title);
                                } else {
                                    activity.addTorrentByUrl(url, title);
                                }
                            }
                        }
                    }).setNegativeButton(android.R.string.cancel, null).create();
        };
    }.show(activity.getSupportFragmentManager(), "urlentry");
}

From source file:com.simplaapliko.trips.presentation.fragment.BaseFragment.java

protected void showKeyboard(SearchView view) {
    view.requestFocus();/*w w  w .j  a v  a  2  s.  c  o m*/
    InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:org.openmidaas.app.activities.EnterURLDialogFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.dialog_fragment, container, false);
    mActivity = getActivity();// w  w  w  . ja va  2s.c  o  m

    imgr = (InputMethodManager) mActivity.getSystemService(Context.INPUT_METHOD_SERVICE);
    imgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
    edUrl = (EditText) view.findViewById(R.id.edDialogFragment);
    edUrl.requestFocus();
    mParentScrollView = (ScrollView) view.findViewById(R.id.svParentURLFragment);
    onTapOutsideBehaviour(mParentScrollView);

    btnPositive = (Button) view.findViewById(R.id.btnOkayDialogFragment);
    btnPositive.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //Get the URL
            View tv = getActivity().findViewById(R.id.edDialogFragment);
            String merchantUrl = ((EditText) tv).getText().toString();
            ((MainTabActivity) getActivity()).processUrl(merchantUrl);
        }
    });

    btnClear = (Button) view.findViewById(R.id.btnClearDialogFragment);
    btnClear.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            //Clear the text to set it to default
            View ed = getActivity().findViewById(R.id.edDialogFragment);
            ((EditText) ed).setText(getResources().getString(R.string.enterUrlHint));
            ((EditText) ed).setSelection(((EditText) ed).getText().length());
        }
    });
    return view;
}

From source file:io.trigger.forge.android.modules.keyboard.API.java

public static void show() {
    InputMethodManager mgr = getKeyboard();
    mgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
}

From source file:io.trigger.forge.android.modules.keyboard.API.java

public static void hide() {
    InputMethodManager mgr = getKeyboard();
    mgr.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
    //ForgeApp.getActivity().getWindow().setSoftInputMode(
    //         WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}

From source file:com.vikingbrain.dmt.view.RemoteControlActivity.java

/**
 * Hide the keyboard.//from w w w  .  j  a va 2 s .co  m
 */
private void hideKeyboard() {
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
        imm.toggleSoftInput(0, InputMethodManager.HIDE_IMPLICIT_ONLY);
        isKeyboardShowing = false;
    }
}

From source file:com.jefftharris.passwdsafe.lib.view.GuiUtils.java

/**
 * Set the keyboard visibility on a view
 *//* www  . j  a v a2  s  .c  om*/
public static void setKeyboardVisible(View v, Context ctx, boolean visible) {
    InputMethodManager imm = (InputMethodManager) ctx.getSystemService(Context.INPUT_METHOD_SERVICE);
    if (visible) {
        if (ApiCompat.SDK_VERSION >= ApiCompat.SDK_HONEYCOMB) {
            imm.showSoftInput(v, InputMethodManager.SHOW_IMPLICIT);
        } else {
            imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
        }
    } else {
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }
}