Example usage for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS

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

Introduction

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

Prototype

int HIDE_NOT_ALWAYS

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

Click Source Link

Document

Flag for #hideSoftInputFromWindow and InputMethodService#requestShowSelf(int) to indicate that the soft input window should normally be hidden, unless it was originally shown with #SHOW_FORCED .

Usage

From source file:com.normsstuff.maps4norm.Dialogs.java

/**
 * @param c the Context//from   w  w  w.j  a v  a  2 s.c o m
 * @return a dialog allowing the user to gain access to the evelation
 * feature
 */
/*    
    public static Dialog getElevationAccessDialog(final Map c, final IInAppBillingService service) {
AlertDialog.Builder builder = new AlertDialog.Builder(c);
builder.setMessage(R.string.buy_pro);
builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(final DialogInterface dialog, int which) {
        try {
            Bundle buyIntentBundle = service.getBuyIntent(3, c.getPackageName(),
                    "de.j4velin.mapsmeasure.billing.pro", "inapp", c.getPackageName());
            if (buyIntentBundle.getInt("RESPONSE_CODE") == 0) {
                PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
                c.startIntentSenderForResult(pendingIntent.getIntentSender(), 42, null, 0,
                        0, 0);
            }
        } catch (Exception e) {
            Toast.makeText(c, e.getClass().getName() + ": " + e.getMessage(),
                    Toast.LENGTH_LONG).show();
            e.printStackTrace();
        }
        dialog.dismiss();
    }
});
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
    @Override
    public void onClick(final DialogInterface dialog, int which) {
        dialog.dismiss();
    }
});
return builder.create();
    }
*/
public static Dialog getSearchDialog(final MyMapActivity map) {
    AlertDialog.Builder builder = new AlertDialog.Builder(map);
    final EditText search = new EditText(map);
    search.setHint(android.R.string.search_go);
    builder.setView(search);
    builder.setPositiveButton(android.R.string.search_go, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, int which) {
            new GeocoderTask(map).execute(search.getText().toString());
            // hide softinput keyboard
            InputMethodManager inputManager = (InputMethodManager) map
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(search.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            dialog.dismiss();
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, int which) {
            // hide softinput keyboard
            InputMethodManager inputManager = (InputMethodManager) map
                    .getSystemService(Context.INPUT_METHOD_SERVICE);
            inputManager.hideSoftInputFromWindow(search.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            dialog.dismiss();
        }
    });
    return builder.create();
}

From source file:com.happynetwork.vrestate.activitys.ContactlistFragment.java

void hideSoftKeyboard() {
    EMLog.d(TAG, "hideSoftKeyboard:====");
    if (mActivity.getWindow()
            .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
        if (mActivity.getCurrentFocus() != null)
            inputMethodManager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
    }//ww  w .j ava2s  .co m
    EMLog.d(TAG, "hideSoftKeyboard:success");
}

From source file:com.slim.turboeditor.activity.MainActivity.java

private void closeKeyBoard() throws NullPointerException {
    // Central system API to the overall input method framework (IMF) architecture
    InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);

    // Base interface for a remotable object
    if (getCurrentFocus() != null) {
        IBinder windowToken = getCurrentFocus().getWindowToken();

        // Hide type
        int hideType = InputMethodManager.HIDE_NOT_ALWAYS;

        // Hide the KeyBoard
        inputManager.hideSoftInputFromWindow(windowToken, hideType);
    }//w  ww  . ja  va2  s  . c o  m
}

From source file:edu.cmu.cylab.starslinger.view.ComposeFragment.java

public void updateKeypad() {
    // if soft input open, close it...
    InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
    View focus = getActivity().getCurrentFocus();
    if (focus != null) {
        imm.hideSoftInputFromWindow(focus.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
    }//from w  w  w. ja  v  a2  s  .com
}

From source file:de.uni_koblenz_landau.apow.PatientDetailEditFragment.java

/**
 * Called by update task, when update is finished.
 *//*from ww  w .j a  va2  s.c  o  m*/
@Override
public void onDataUpdateFinished() {
    mPatientUpdateTask = null;
    InputMethodManager inputManager = (InputMethodManager) getActivity()
            .getSystemService(FragmentActivity.INPUT_METHOD_SERVICE);
    if (getActivity().getCurrentFocus() != null) {
        inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                InputMethodManager.HIDE_NOT_ALWAYS);
    }
    Intent back = new Intent(getActivity(), PatientListActivity.class);
    back.putExtra(PatientListActivity.ARG_CHANGED, true);
    NavUtils.navigateUpTo(getActivity(), back);
}

From source file:apps.junkuvo.alertapptowalksafely.MainActivity.java

@Override
public void onClick(View v) {
    switch (v.getId()) {
    case R.id.rtlMain:

        //                long cacheExpirationSeconds = BuildConfig.DEBUG ? 10 : 60 * 60;// Cache()
        //                FirebaseRemoteConfigUtil.fetch(cacheExpirationSeconds);
        //                Toast.makeText(getApplicationContext(), FirebaseRemoteConfig.getInstance().getString("test_string"), Toast.LENGTH_SHORT).show();

        FlurryAgent.logEvent("onClick aside from Start button");

        // ?//from  w  ww.  j a v  a2s  .  co m
        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);

        if (!mAlertService.IsRunningAlertService()) {
            createToastShort(getString(R.string.toast_instruction)).show();
            mbtnStart.startAnimation(mAnimationBlink);
        }
        break;
    case R.id.fabStart:
        startBtnClick(v);
        break;

    }
}

From source file:com.lastsoft.plog.adapter.PlayAdapter.java

public void playPopup(View v, final int position) {

    try {/*from   w  ww .j  a  va2  s .  c o m*/
        InputMethodManager inputManager = (InputMethodManager) mActivity
                .getSystemService(Context.INPUT_METHOD_SERVICE);

        inputManager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(),
                InputMethodManager.HIDE_NOT_ALWAYS);
    } catch (Exception ignored) {
    }

    PopupMenu popup = new PopupMenu(mActivity, v);

    MenuInflater inflater = popup.getMenuInflater();
    inflater.inflate(R.menu.play_overflow, popup.getMenu());

    if (!fromDrawer) {
        popup.getMenu().removeItem(R.id.view_plays);
    }

    popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
        @Override
        public boolean onMenuItemClick(MenuItem item) {
            mPosition = position;
            switch (item.getItemId()) {
            case R.id.view_plays:
                //((PlaysFragment)mFragment).setSearchText(GamesPerPlay.getBaseGame(plays.get(position)).gameName);
                ((MainActivity) mActivity).openPlays(GamesPerPlay.getBaseGame(plays.get(position)).gameName,
                        false, 0, mActivity.getString(R.string.title_plays), currentYear);
                return true;
            case R.id.edit_play:
                ((MainActivity) mActivity).openAddPlay(mFragment,
                        GamesPerPlay.getBaseGame(plays.get(position)).gameName, plays.get(position).getId(),
                        false);
                return true;
            case R.id.copy_play:
                ((MainActivity) mActivity).openAddPlay(mFragment,
                        GamesPerPlay.getBaseGame(plays.get(position)).gameName, plays.get(position).getId(),
                        true);
                return true;
            case R.id.delete_play:
                //delete the play
                //refresh play list
                ((MainActivity) mActivity).deletePlay(plays.get(position).getId());
                return true;
            default:
                return false;
            }
        }
    });
    popup.show();
}

From source file:com.hx.hxchat.activity.ContactlistFragment.java

void hideSoftKeyboard(Activity activity) {
    if (activity.getWindow()
            .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
        if (activity.getCurrentFocus() != null)
            inputMethodManager.hideSoftInputFromWindow(activity.getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
    }//from   w ww . j a  va  2 s  .  c  om
}

From source file:com.bitants.wally.fragments.SearchFragment.java

public void dismissKeyboard() {
    if (getActivity() != null && getActivity().getCurrentFocus() != null) {
        InputMethodManager inputManager = (InputMethodManager) getActivity()
                .getSystemService(Context.INPUT_METHOD_SERVICE);
        inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                InputMethodManager.HIDE_NOT_ALWAYS);
        getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
    }//w w w .j av  a  2  s.  com
}

From source file:com.easemob.chatuidemo.activity.ContactlistFragment.java

void hideSoftKeyboard() {
    if (getActivity().getWindow()
            .getAttributes().softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN) {
        if (getActivity().getCurrentFocus() != null)
            inputMethodManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(),
                    InputMethodManager.HIDE_NOT_ALWAYS);
    }/*from   ww  w  . j  a  v a  2  s  . co m*/
}