List of usage examples for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS
int HIDE_NOT_ALWAYS
To view the source code for android.view.inputmethod InputMethodManager HIDE_NOT_ALWAYS.
Click Source Link
From source file:com.aegamesi.steamtrade.MainActivity.java
public void toggleDrawer() { if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START); } else {//from ww w .j a v a 2s. co m // hide IME InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (inputManager != null && this.getCurrentFocus() != null) inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); drawerLayout.openDrawer(GravityCompat.START); } }
From source file:xj.property.activity.HXBaseActivity.HXBaseActivity.java
protected void hideKeyboard() { ((InputMethodManager) getSystemService(INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:com.liuwei1995.red.fragment.presenter.EyeFragmentPresenter.java
/** * :?/*from ww w . j av a 2s . co m*/ */ private void watchSearch() { if (type == H_TYPE_ONE) actv_license_plate_number.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { // ?? ((InputMethodManager) actv_license_plate_number.getContext() .getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow( ((Activity) mContext).getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); // ???... search(); return true; } return false; } }); }
From source file:de.uni_koblenz_landau.apow.LoginActivity.java
/** * Shows the progress UI and hides the login form. *///from ww w . j ava 2 s. c o m private void showProgress(final boolean show) { mProgress = show; InputMethodManager inputManager = (InputMethodManager) getActivity() .getSystemService(FragmentActivity.INPUT_METHOD_SERVICE); if (getActivity().getCurrentFocus() != null) { inputManager.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime); mStatusView.setVisibility(View.VISIBLE); mStatusView.animate().setDuration(shortAnimTime).alpha(show ? 1 : 0) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mStatusView.setVisibility(show ? View.VISIBLE : View.GONE); } }); if (mFirstRun) { mSetupFormView.setVisibility(View.VISIBLE); mSetupFormView.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mSetupFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }); } else { mLoginFormView.setVisibility(View.VISIBLE); mLoginFormView.animate().setDuration(shortAnimTime).alpha(show ? 0 : 1) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE); } }); } }
From source file:com.lastsoft.plog.GamesFragment.java
@Override public void onDetach() { super.onDetach(); mListener = null;/*w ww . java 2 s . c o m*/ try { InputMethodManager inputManager = (InputMethodManager) mActivity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception e) { } if (mActivity != null) { if (!fromDrawer) { ((MainActivity) mActivity).setUpActionBar(7); } mActivity = null; } }
From source file:com.fvd.nimbus.BrowseActivity.java
void hideKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(findViewById(R.id.etAddess).getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }//ww w . java 2 s .c om }
From source file:com.wikitude.phonegap.WikitudePlugin.java
/** * add architectView to current screen/*from www. j a va 2 s. c om*/ * @param apiKey developers's api key to use (hides watermarking/intro-animation if it matches your package-name) * @param filePath the url (starting with http:// for online use; starting with LOCAL_ASSETS_PATH_ROOT if oyu want to load assets within your app-assets folder) * @throws IOException might be thrown from ARchitect-SDK */ private void addArchitectView(final String apiKey, String filePath) throws IOException { if (this.architectView == null) { this.architectView = new ArchitectViewPhoneGap(this.cordova.getActivity(), new OnKeyDownListener() { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (WikitudePlugin.this.architectView != null && keyCode == KeyEvent.KEYCODE_BACK) { WikitudePlugin.this.locationProvider.onPause(); removeArchitectView(); return true; } return false; } }); this.architectView.setFocusableInTouchMode(true); this.architectView.requestFocus(); this.locationListener = new LocationListener() { @Override public void onStatusChanged(String provider, int status, Bundle extras) { } @Override public void onProviderEnabled(String provider) { } @Override public void onProviderDisabled(String provider) { } @Override public void onLocationChanged(final Location location) { if (location != null) { WikitudePlugin.this.lastKnownLocaton = location; if (WikitudePlugin.this.architectView != null) { if (location.hasAltitude()) { WikitudePlugin.this.architectView.setLocation(location.getLatitude(), location.getLongitude(), location.getAltitude(), location.getAccuracy()); } else { WikitudePlugin.this.architectView.setLocation(location.getLatitude(), location.getLongitude(), location.getAccuracy()); } } } } }; /* add content view and fake initial life-cycle */ (this.cordova.getActivity()).addContentView(this.architectView, new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); /* fake life-cycle calls, because activity is already up and running */ this.architectView.onCreate(getArchitectConfig(apiKey)); this.architectView.onPostCreate(); /* register self as url listener to fwd these native calls to PhoneGap */ this.architectView.registerUrlListener(WikitudePlugin.this); /* load asset from local directory if prefix is used */ if (filePath.startsWith(WikitudePlugin.LOCAL_ASSETS_PATH_ROOT)) { filePath = filePath.substring(WikitudePlugin.LOCAL_ASSETS_PATH_ROOT.length()); } this.architectView.load(filePath); /* also a fake-life-cycle call (the last one before it is really shown in UI */ this.architectView.onResume(); this.locationProvider = new LocationProvider(this.cordova.getActivity(), this.locationListener); this.locationProvider.onResume(); } // hide keyboard when adding AR view on top of views InputMethodManager inputManager = (InputMethodManager) (this.cordova.getActivity()) .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow((this.cordova.getActivity()).getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }
From source file:com.example.emachine.FXcalcActivity.java
private void hideKeyboard() { // Check if no view has focus: View view = this.getCurrentFocus(); if (view != null) { InputMethodManager inputManager = (InputMethodManager) this .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }/*w ww . ja va2 s. c o m*/ }
From source file:com.kncwallet.wallet.ui.SendCoinsFragment.java
private void forceHideKeyboard() { InputMethodManager inputManager = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); View view = activity.getCurrentFocus(); if (view != null) { inputManager.hideSoftInputFromWindow(view.getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); }// w w w.j a v a 2s . com }
From source file:com.lastsoft.plog.GamesFragment.java
public void captureBox(Game game) { theGame = game;//from w w w.ja v a2s . c o m try { InputMethodManager inputManager = (InputMethodManager) mActivity .getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.hideSoftInputFromWindow(mActivity.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } catch (Exception ignored) { } Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(mActivity.getPackageManager()) != null) { // Create the File where the photo should go photoFile = null; try { photoFile = createImageFile(); } catch (IOException ex) { // Error occurred while creating the File } // Continue only if the File was successfully created if (photoFile != null) { photoUri = Uri.fromFile(photoFile); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri); startActivityForResult(takePictureIntent, 0); } } }