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:edu.missouri.niaaa.ema.activity.AdminManageActivity.java

@Override
protected void onDestroy() {
    super.onDestroy();
    DialadminPin.dismiss();/*from  w w  w  .j a  v  a  2 s  .  c  om*/

    imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN);
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}

From source file:br.liveo.searchliveo.SearchLiveo.java

/**
 * Show SearchLiveo/*w w w  .  j a v a2s  .c  o m*/
 */
public SearchLiveo show() {
    setActive(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        try {
            showAnimation();
        } catch (ClassCastException e) {
            throw new ClassCastException(mContext.getString(R.string.warning_with));
        }

    } else {

        Animation mFadeIn = AnimationUtils.loadAnimation(mContext.getApplicationContext(),
                android.R.anim.fade_in);
        mViewSearch.setEnabled(true);
        mViewSearch.setVisibility(View.VISIBLE);
        mViewSearch.setAnimation(mFadeIn);

        mContext.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                        .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            }
        });
    }

    mEdtSearch.requestFocus();
    return this;
}

From source file:br.liveo.searchliveo.SearchCardLiveo.java

/**
 * Show SearchCardLiveo/*from  w  w  w  . ja va2  s.  co m*/
 */
public SearchCardLiveo show() {
    setActive(true);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

        try {
            showAnimation();
        } catch (ClassCastException e) {
            throw new ClassCastException(mContext.getString(R.string.warning_with));
        }

    } else {

        Animation mFadeIn = AnimationUtils.loadAnimation(mContext.getApplicationContext(),
                android.R.anim.fade_in);
        mCardSearch.setEnabled(true);
        mCardSearch.setVisibility(View.VISIBLE);
        mCardSearch.setAnimation(mFadeIn);

        mContext.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                        .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            }
        });
    }

    mEdtSearch.requestFocus();
    return this;
}

From source file:org.mozilla.gecko.tests.BaseTest.java

public void toggleVKB() {
    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
}

From source file:de.incoherent.suseconferenceclient.activities.HomeActivity.java

@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
    final EditText searchText = (EditText) item.getActionView();
    searchText.post(new Runnable() {
        @Override//w w w  . ja  v  a2 s.  com
        public void run() {
            Log.d("SUSEConferences", "Closing keyboard");
            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
        }
    });

    return true;
}

From source file:br.liveo.searchliveo.SearchLiveo.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void showAnimation() {
    try {/*w w  w  .  ja  va2 s .  c o m*/

        if (getStatusBarShowColor() != -1) {
            mContext.getWindow().setStatusBarColor(getStatusBarShowColor());
        } else {
            mContext.getWindow()
                    .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark));
        }

        final Animator animator = ViewAnimationUtils.createCircularReveal(mViewSearch,
                mViewSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext),
                0, (float) Math.hypot(mViewSearch.getWidth(), mViewSearch.getHeight()));
        animator.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                mContext.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                                .toggleSoftInput(InputMethodManager.SHOW_FORCED,
                                        InputMethodManager.HIDE_IMPLICIT_ONLY);
                    }
                });
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

        animator.setDuration(300);
        animator.start();
    } catch (Exception e) {
        e.getStackTrace();
        mContext.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                        .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            }
        });
    }

    mViewSearch.setVisibility(View.VISIBLE);
}

From source file:br.liveo.searchliveo.SearchCardLiveo.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void showAnimation() {
    try {/*from www. java  2s.c  o m*/

        if (getStatusBarShowColor() != -1) {
            mContext.getWindow().setStatusBarColor(getStatusBarShowColor());
        } else {
            mContext.getWindow()
                    .setStatusBarColor(ContextCompat.getColor(mContext, R.color.search_liveo_primary_dark));
        }

        final Animator animator = ViewAnimationUtils.createCircularReveal(mCardSearch,
                mCardSearch.getWidth() - (int) dpToPixel(24, this.mContext), (int) dpToPixel(23, this.mContext),
                0, (float) Math.hypot(mCardSearch.getWidth(), mCardSearch.getHeight()));
        animator.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                mContext.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                                .toggleSoftInput(InputMethodManager.SHOW_FORCED,
                                        InputMethodManager.HIDE_IMPLICIT_ONLY);
                    }
                });
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });

        animator.setDuration(300);
        animator.start();
    } catch (Exception e) {
        e.getStackTrace();
        mContext.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ((InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE))
                        .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY);
            }
        });
    }

    mCardSearch.setVisibility(View.VISIBLE);
}

From source file:com.barbrdo.app.activities.UserProfileActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.iv_profile_picture:
        captureImage();/*from  w ww.  ja  v  a2s  . co m*/
        break;

    case R.id.tv_radius:
        showRadiusDialog(textViewSearchRadius.getText().toString());
        break;

    case R.id.tv_change_password:
        getView(R.id.cv_password_change).setVisibility(View.VISIBLE);
        isEdit = true;
        invalidateOptionsMenu();
        editTextPassword.requestFocus();
        editTextPassword.setEnabled(true);
        editTextConfirmPassword.setEnabled(true);
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.showSoftInput(editTextPassword, InputMethodManager.HIDE_IMPLICIT_ONLY);
        break;

    case R.id.tv_cancel:
        utilObj.showAlertDialog(this, R.string.cancel_subscription,
                R.string.are_you_sure_you_want_to_cancel_subscription, R.string.ok, R.string.cancel,
                new DialogActionCallback() {
                    @Override
                    public void doOnPositive() {
                        final String appPackageName = getPackageName();
                        startActivity(new Intent(Intent.ACTION_VIEW,
                                Uri.parse("https://play.google.com/store/apps/details?id=" + appPackageName)));
                    }

                    @Override
                    public void doOnNegative() {
                    }
                });
        break;

    case R.id.tv_upgrade:
        Intent intent = new Intent(mContext, SubscriptionDialogActivity.class);
        if (user.subscriptionPrice == 0)
            intent.putExtra(Constants.BundleKeyTag.IS_UPGRADE, false);
        else
            intent.putExtra(Constants.BundleKeyTag.IS_UPGRADE, true);
        intent.putExtra(Constants.BundleKeyTag.IS_USER_PROFILE, true);
        startActivityForResult(intent, Constants.RequestCodes.APP_SUBSCRIPTION);

        break;
    }
}

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

private void InitiateSearch() {

    initThreading();/*from   w  w w.j  a  va 2 s .  c  o  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:com.igniva.filemanager.activities.MainActivity.java

/**
 * hide search view with a circular reveal animation
 *//*from w  w w .j ava 2 s .  co  m*/
public void hideSearchView() {

    final int END_RADIUS = 16;
    int startRadius = Math.max(searchViewLayout.getWidth(), searchViewLayout.getHeight());
    Animator animator;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(searchViewLayout, searchCoords[0] + 32,
                searchCoords[1] - 16, startRadius, END_RADIUS);
    } else {
        // TODO: ViewAnimationUtils.createCircularReveal
        animator = new ObjectAnimator().ofFloat(searchViewLayout, "alpha", 1f, 0f);
    }

    // removing background fade view
    utils.revealShow(mFabBackground, false);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(600);
    animator.start();
    animator.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {

        }

        @Override
        public void onAnimationEnd(Animator animation) {

            searchViewLayout.setVisibility(View.GONE);
            isSearchViewEnabled = false;
            InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
            inputMethodManager.hideSoftInputFromWindow(searchViewEditText.getWindowToken(),
                    InputMethodManager.HIDE_IMPLICIT_ONLY);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });
}