List of usage examples for android.view.inputmethod InputMethodManager HIDE_IMPLICIT_ONLY
int HIDE_IMPLICIT_ONLY
To view the source code for android.view.inputmethod InputMethodManager HIDE_IMPLICIT_ONLY.
Click Source Link
From source file:edu.missouri.bas.activities.AdminManageActivity.java
private void setListeners() { // TODO Auto-generated method stub Log.d(TAG, "Ontabchangedlistener!!~~~"); tabHost.setOnTabChangedListener(new OnTabChangeListener() { @Override/*from w w w.j av a2 s. c om*/ public void onTabChanged(String arg0) { // TODO Auto-generated method stub Log.d(TAG, "~~" + arg0); setHints(); if (arg0.equals("Assign ID")) { imm.toggleSoftInput(0, InputMethodManager.RESULT_HIDDEN); Log.d(TAG, "assign id "); } else { imm.toggleSoftInput(0, InputMethodManager.RESULT_SHOWN); imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); Log.d(TAG, "deassign id"); } } }); AssignButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Log.d(TAG, "assign btn " + asID.getText().toString()); //editor.putString(ASID, asID.getText().toString()); //format check //editor.putString(ASPWD, ""); //editor.commit(); //setHints(); //check networking String asedID = asID.getText().toString(); Log.d(TAG, "get from edittext is " + asedID); HttpPost request = new HttpPost( "http://dslsrv8.cs.missouri.edu/~rs79c/Server/Crt/validateUser.php"); List<NameValuePair> params = new ArrayList<NameValuePair>(); //file_name params.add(new BasicNameValuePair("userID", asedID)); //function params.add(new BasicNameValuePair("pre", "2")); //data //params.add(new BasicNameValuePair("password","")); try { request.setEntity(new UrlEncodedFormEntity(params, HTTP.UTF_8)); HttpResponse response = new DefaultHttpClient().execute(request); if (response.getStatusLine().getStatusCode() == 200) { String result = EntityUtils.toString(response.getEntity()); Log.d("~~~~~~~~~~http post result2 ", result); if (result.equals("UserIDIsNotSet")) { //add in web page first String s1 = "This ID is not in Database, please double check or add it via web page by administrator first."; buildDialog1(ctx, s1).show(); setResult(9); } else if (result.equals("UserIDIsUsed")) { String s2 = "This ID has been used before. Delete it via web page by administrator first."; buildDialog2(ctx, s2).show(); setResult(9); } else if (result.equals("UserIDIsNotActive")) { //assign String s3 = "Do you want to assign this ID: " + asedID; buildDialog2(ctx, s3).show(); } else { String s4 = "The ID format seems not applicable, please try again."; buildDialog1(ctx, s4).show(); setResult(9); } } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); String s4 = "The ID format seems not applicable, please try again."; buildDialog1(ctx, s4).show(); setResult(9); } } }); RemoveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Log.d(TAG, "remove btn "); //add a confirm dialog setHints(); Log.d(TAG, "cur is " + currentAssID); if (!currentAssID.equals("")) { Dialog alertDialog = new AlertDialog.Builder(ctx).setCancelable(false) .setTitle("Confirm Remove") .setMessage( "Do you really want to remove this ID and all related data from the device? ") .setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub editor.putString(ASID, ""); editor.putString(ASPWD, ""); editor.commit(); editor2.putString(SensorService.BED_TIME_INFO, "none"); editor2.putString(SensorService.BED_HOUR_INFO, "none"); editor2.putString(SensorService.BED_MIN_INFO, "none"); editor2.putInt("RandomSurveyStartHour", 11); editor2.putInt("RandomSurveyStartMin", 59); //editor2.putBoolean("MornReportDone", false); editor2.commit(); setHints(); SensorService.mIsRunning = false; ctx.stopService(new Intent(AdminManageActivity.this, SensorService.class)); setResult(9); finish(); } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub } }).create(); alertDialog.show(); } } }); }
From source file:com.ywesee.amiko.MainActivity.java
/** * Hide soft keyboard/*w ww. jav a 2s . c om*/ */ private void hideSoftKeyboard(int duration) { mSearch.requestFocus(); mSearch.postDelayed(new Runnable() { @Override public void run() { // Remove keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Service.INPUT_METHOD_SERVICE); if (imm != null && mSearch.getWindowToken() != null) imm.hideSoftInputFromWindow(mSearch.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); } }, duration); }
From source file:com.vaquerosisd.projectmanager.TaskList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.task_menu, menu); MenuItem searchItem = menu.findItem(R.id.actionBar_SearchTaskItem); Button clearSearchTask = (Button) searchItem.getActionView().findViewById(R.id.actionBar_ClearSearch); final AutoCompleteTextView searchTask = (AutoCompleteTextView) searchItem.getActionView() .findViewById(R.id.actionBar_SearchItemEditText); //Get all tasks names and add them to an adapter for the AutoCompleteTextView List<Task> allTasks = db.getAllTasks(projectId); String[] tasksNames = new String[allTasks.size()]; for (int i = 0; i < allTasks.size(); i++) tasksNames[i] = allTasks.get(i).getTaskName(); ArrayAdapter<String> tasksAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, tasksNames);// w w w . j a v a 2s . c o m searchTask.setAdapter(tasksAdapter); searchTask.setThreshold(1); //Clear text of search AutoCompleteTextView clearSearchTask.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { searchTask.setText(""); } }); searchTask.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_IMPLICIT, 0); } else { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0); } } }); //Search task searchTask.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { //When the user press "DONE" key, select the task if (actionId == EditorInfo.IME_ACTION_DONE) { String project = searchTask.getText().toString(); searchTask(project); //Hide keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(searchTask.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); return true; } return false; } }); return true; }
From source file:com.barbrdo.app.activities.UserProfileActivity.java
@Override public void onSuccessRedirection(int taskID) { InputMethodManager imm;//www .j a v a 2s.c om switch (taskID) { case Constants.TaskID.SHOP_BARBERS: utilObj.stopLoader(); if (appInstance.shopDetail != null) setData(); break; case Constants.TaskID.PROFILE_PICTURE: utilObj.stopLoader(); if (appInstance.accountUpdate != null) { appInstance.userDetail.user = appInstance.accountUpdate.user; sessionManager.saveUser(appInstance.userDetail); if (!TextUtils.isEmpty(appInstance.userDetail.user.picture)) { imageLoader.displayImage(sessionManager.getImageBaseUrl() + appInstance.userDetail.user.picture, imageViewProfilePicture, options); } } break; case Constants.TaskID.ACCOUNT: isEdit = false; invalidateOptionsMenu(); editTextPhone.setEnabled(false); editTextFirstName.setEnabled(false); editTextLastName.setEnabled(false); editTextPassword.setEnabled(false); editTextConfirmPassword.setEnabled(false); textViewSearchRadius.setEnabled(false); editTextBio.setEnabled(false); textViewMemberSince.setEnabled(false); editTextPassword.setText(""); editTextConfirmPassword.setText(""); getView(R.id.cv_password_change).setVisibility(View.GONE); if (appInstance.accountUpdate != null) { utilObj.showToast(mContext, appInstance.message, 2); appInstance.userDetail.user = appInstance.accountUpdate.user; sessionManager.saveUser(appInstance.userDetail); String fullName = ""; if (!TextUtils.isEmpty(appInstance.userDetail.user.firstName)) fullName = appInstance.userDetail.user.firstName; if (!TextUtils.isEmpty(appInstance.userDetail.user.firstName) && !TextUtils.isEmpty(appInstance.userDetail.user.lastName)) fullName = appInstance.userDetail.user.firstName + " " + appInstance.userDetail.user.lastName; textViewUsername.setText(fullName); } if (user.userType.equalsIgnoreCase(getString(R.string.shop_))) { updateShop(); return; } imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editTextFirstName, InputMethodManager.HIDE_IMPLICIT_ONLY); utilObj.stopLoader(); break; case Constants.TaskID.USER_PROFILE: utilObj.stopLoader(); setData(); break; case Constants.TaskID.UPDATE_SHOP: utilObj.stopLoader(); editTextShopName.setEnabled(false); editTextAddress.setEnabled(false); editTextCity.setEnabled(false); editTextState.setEnabled(false); editTextZip.setEnabled(false); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(editTextFirstName, InputMethodManager.HIDE_IMPLICIT_ONLY); break; } }
From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealTabsFragment.java
private void handleSearchManual() { if (card_search_manual.getVisibility() == View.VISIBLE) { searchManual.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animatorHide = ViewAnimationUtils.createCircularReveal(card_search_manual, card_search_manual.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), (float) Math.hypot(card_search_manual.getWidth(), card_search_manual.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override//from w w w . ja va 2 s . c o m public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { card_search_manual.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchManual.getWindowToken(), 0); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { card_search_manual.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchManual.getWindowToken(), 0); } } else { searchManual.setVisibility(View.INVISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animator = ViewAnimationUtils.createCircularReveal(card_search_manual, card_search_manual.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), 0, (float) Math.hypot(card_search_manual.getWidth(), card_search_manual.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { manualSearch.requestFocus(); } @Override public void onAnimationEnd(Animator animation) { ((InputMethodManager) getActivity().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) { } }); card_search_manual.setVisibility(View.VISIBLE); if (card_search_manual.getVisibility() == View.VISIBLE) { animator.setDuration(300); animator.start(); card_search_manual.setEnabled(true); } } else { manualSearch.requestFocus(); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); card_search_manual.setVisibility(View.VISIBLE); } } }
From source file:com.doplgangr.secrecy.views.VaultsListFragment.java
void open(final String vault, final View mView, final int i) { // vault name // View of lisitem // position of listitem in list switchView(mView, R.id.vault_decrypt_layout); mView.findViewById(R.id.open_ok).setOnClickListener(new View.OnClickListener() { @Override//from w w w .ja v a 2s . co m public void onClick(View view) { String value = ((EditText) mView.findViewById(R.id.open_password)).getText().toString(); mOnVaultSelected.onVaultSelected(vault, value); imm.hideSoftInputFromWindow(kbdView.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); } }); mView.findViewById(R.id.open_cancel).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { switchView(mView, R.id.vault_name_layout); imm.hideSoftInputFromWindow(kbdView.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY); } }); }
From source file:com.xabber.android.ui.activity.ContactList.java
private void setUpSearchView(final Menu menu) { searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setQueryHint(getString(R.string.contact_search_hint)); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override/*from w w w.j a v a2s.c o m*/ public boolean onClose() { menu.findItem(R.id.action_search).collapseActionView(); return true; } }); MenuItemCompat.setOnActionExpandListener(menu.findItem(R.id.action_search), new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { searchView.requestFocus(); ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput( InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { searchView.setQuery("", true); searchView.clearFocus(); return true; } }); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { Fragment fragmentById = getSupportFragmentManager().findFragmentById(R.id.container); ((ContactListFragment) fragmentById).getFilterableAdapter().getFilter().filter(newText); return true; } }); }
From source file:com.xabber.android.ui.activity.ContactListActivity.java
private void setUpSearchView(final Menu menu) { searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setQueryHint(getString(R.string.contact_search_hint)); searchView.setOnCloseListener(new SearchView.OnCloseListener() { @Override//from w w w . ja v a2 s . c o m public boolean onClose() { menu.findItem(R.id.action_search).collapseActionView(); return true; } }); MenuItemCompat.setOnActionExpandListener(menu.findItem(R.id.action_search), new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { searchView.requestFocus(); ((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE)).toggleSoftInput( InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); return true; } @Override public boolean onMenuItemActionCollapse(MenuItem item) { searchView.setQuery("", true); searchView.clearFocus(); return true; } }); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { Fragment fragmentById = getFragmentManager().findFragmentById(R.id.container); ((ContactListFragment) fragmentById).getFilterableAdapter().getFilter().filter(newText); return true; } }); }
From source file:com.eugene.fithealthmaingit.UI.ChooseAddMealTabsFragment.java
private void handleSearchFavorite() { if (card_search_fav.getVisibility() == View.VISIBLE) { searchFavorite.setVisibility(View.VISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animatorHide = ViewAnimationUtils.createCircularReveal(card_search_fav, card_search_fav.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), (float) Math.hypot(card_search_fav.getWidth(), card_search_fav.getHeight()), 0); animatorHide.addListener(new Animator.AnimatorListener() { @Override//from w w w.j a v a 2s .com public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { card_search_fav.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchFavorite.getWindowToken(), 0); } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animatorHide.setDuration(200); animatorHide.start(); } else { favSearch.requestFocus(); card_search_fav.setVisibility(View.GONE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(searchFavorite.getWindowToken(), 0); } } else { searchFavorite.setVisibility(View.INVISIBLE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { final Animator animator = ViewAnimationUtils.createCircularReveal(card_search_fav, card_search_fav.getWidth() - (int) convertDpToPixel(24, getActivity()), (int) convertDpToPixel(23, getActivity()), 0, (float) Math.hypot(card_search_fav.getWidth(), card_search_fav.getHeight())); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { favSearch.requestFocus(); } @Override public void onAnimationEnd(Animator animation) { favSearch.requestFocus(); ((InputMethodManager) getActivity().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) { } }); card_search_fav.setVisibility(View.VISIBLE); if (card_search_fav.getVisibility() == View.VISIBLE) { animator.setDuration(300); animator.start(); } } else { favSearch.requestFocus(); card_search_fav.setVisibility(View.VISIBLE); ((InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE)) .toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); } } }
From source file:es.farfuteam.vncpp.controller.CanvasActivity.java
/** * @brief Makes a toggle of the keyboard * @details Makes a toggle of the keyboard *///from w w w . j av a 2 s .com public void showKeyboard() { inputMgr.toggleSoftInput(InputMethodManager.SHOW_FORCED, InputMethodManager.HIDE_IMPLICIT_ONLY); menu.toggle(); }