List of usage examples for android.content Context INPUT_METHOD_SERVICE
String INPUT_METHOD_SERVICE
To view the source code for android.content Context INPUT_METHOD_SERVICE.
Click Source Link
From source file:com.sft.blackcatapp.SearchCoachActivity.java
private void initData() { searchCoach.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchCoach.setOnEditorActionListener(new OnEditorActionListener() { @Override/*from w ww .ja v a 2 s . c o m*/ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { // ?? ((InputMethodManager) searchCoach.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(SearchCoachActivity.this.getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); // ? LogUtil.print("?"); coachname = searchCoach.getText().toString().trim(); searchcoach(true); return true; } return false; } }); }
From source file:com.mastercard.masterpasswallet.fragments.addcard.VerifyCardFragment.java
private void prePopulateWidgets() { if (mListener.hasCardNumber()) { mEdtCardNumber.setText(mListener.getCardNumber()); mTxtScannedCardPan.setText(getString(R.string.masked_pan, mListener.getCardNumber().substring(mListener.getCardNumber().length() - 4))); // set the focus to the next field if (mListener.hasCardExpiry()) { mEdtCvc.requestFocus();/*from w w w . j ava 2 s . c o m*/ } else { mEdtExpiry.requestFocus(); } // show the keyboard InputMethodManager imm = (InputMethodManager) getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(mEdtCvc, InputMethodManager.SHOW_IMPLICIT); if (mListener.hasCardExpiry()) { // Otherwise attempt to use the expiry date String cardExpiryMonth = String.format("%02d", Integer.parseInt(mListener.getCardExpiryMonth())); String cardExpiryYear = mListener.getCardExpiryYear().substring(2); mEdtExpiry.setText(String.format("%s/%s", cardExpiryMonth, cardExpiryYear)); } // Use the image we've decided upon, this will either be the correct one for the card // or default to the green one mImgScannedCard.setImageResource(Card.getDefaultCardImageFull()); // Set the cardholder name mEdtCardholderName.setText(mListener.getCardholderName()); } else { // If no card was scanned then we don't show any image mLayScannedCard.setVisibility(View.GONE); } }
From source file:com.push.app.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); fragmentStack = new Stack<>(); sharedPreferences = getSharedPreferences("preferences", Activity.MODE_PRIVATE); aq = new AQuery(this); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); isNotification = getIntent().getBooleanExtra("is_notification", false); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.activity_main_swipe_refresh_layout); mHomeLayout = (FrameLayout) findViewById(R.id.mHomeLayout); mSearchView = (FrameLayout) findViewById(R.id.mSearchView); mToolbarView = (Toolbar) findViewById(R.id.toolbar); getSupportActionBar().setDisplayShowHomeEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setLogo(R.mipmap.logo); getSupportActionBar().setTitle(""); imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); //Setup the drawer //setUpDrawer(); mListView = (ObservableListView) findViewById(R.id.mList); initViews();//w w w .j ava 2 s . co m mListView.setBackgroundColor(Color.WHITE); mSwipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { checkForNewContent(); } }); if (isNotification) { String extra = getIntent().getExtras() .getString(Notification.DefaultNotificationHandler.INTENT_EXTRAS_KEY); Utils.log("Extras -> " + extra); try { JSONObject extrasObject = new JSONObject(extra); JSONObject extras = extrasObject.getJSONObject("payload").getJSONObject("extras"); JSONObject additionalInfo = extras.getJSONObject("additionalInfo"); Utils.log("Extras payload -> " + extras); if (additionalInfo.has("action") && additionalInfo.getString("action").equalsIgnoreCase("donation")) { Utils.log("Displaying donation page"); displayView(1); return; } else if (additionalInfo.has("article_id")) { mSwipeRefreshLayout.setRefreshing(true); if (restAPI == null) { setUpRestApi(); } restAPI.getArticle(additionalInfo.getString("article_id"), new Callback<ArticlePost>() { @Override public void success(ArticlePost articlePost, Response response) { mSwipeRefreshLayout.setRefreshing(false); Intent i = new Intent(HomeActivity.this, DetailPostActivity.class); PostFragmentAdapter.postItems.clear(); PostFragmentAdapter.postItems.add(articlePost.getResults().get(0)); i.putExtra("postPosition", 0); i.putExtra("postTitle", articlePost.getResults().get(0).getHeadline()); i.putExtra("description", articlePost.getResults().get(0).getDescription()); cachePosts("searchResults", articlePost);//cache these results startActivity(i); } @Override public void failure(RetrofitError error) { mSwipeRefreshLayout.setRefreshing(false); Log.e("ERROR", "Failed to parse JSON ", error); } }); } } catch (JSONException ex) { Utils.log("Error loading post -> " + ex.getMessage()); } } }
From source file:org.projecthdata.weight.WeightTrackerActivity.java
public void onSave(View v) { try {//from w ww. j av a 2 s . c o m WeightReading reading = new WeightReading(); EditText weightEditText = (EditText) findViewById(R.id.weight_edit_text); Double entry = Double.parseDouble(weightEditText.getText().toString()); reading.setResultValue(entry); getDatabaseHelper().getWeightDao().create(reading); // go back to displaying the weight list getSupportFragmentManager().popBackStack(); // hide the soft keyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(weightEditText.getWindowToken(), 0); } catch (SQLException e) { e.printStackTrace(); } }
From source file:com.easemob.helpdeskdemo.ui.SatisfactionActivity.java
@Override public boolean dispatchTouchEvent(MotionEvent ev) { // Edittext //w w w . j a va2s .co m if (ev.getAction() == MotionEvent.ACTION_DOWN) { View v = getCurrentFocus(); if (isShouldHideInput(v, ev)) { InputMethodManager inputManager = (InputMethodManager) getSystemService( Context.INPUT_METHOD_SERVICE); if (inputManager != null) { inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); } } return super.dispatchTouchEvent(ev); } // ????TouchEvent if (getWindow().superDispatchTouchEvent(ev)) { return true; } return onTouchEvent(ev); }
From source file:com.netpace.expressit.activity.UploadVideoStoryActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: this.onBackPressed(); return true; case R.id.menu_item_video_gallery: if (isValidate()) { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(titleTextView.getWindowToken(), 0); getMediaKeyFromRemoteServer(); }/*from www.j a va 2 s. co m*/ return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.firesoft.member.Activity.B0_SigninActivity.java
private void CloseKeyBoard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mMobile.getWindowToken(), 0); }
From source file:com.phonegap.childBrowser.ChildBrowser.java
/** * Navigate to the new page//from w ww. java2s . co m * * @param url to load */ private void navigate(String url) { InputMethodManager imm = (InputMethodManager) this.ctx.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0); if (!url.startsWith("http")) { this.webview.loadUrl("http://" + url); } this.webview.loadUrl(url); this.webview.requestFocus(); }
From source file:com.sft.fragment.SchoolsFragment.java
private void initData() { searchSchool.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchSchool.setOnEditorActionListener(new OnEditorActionListener() { @Override/* w ww . j a v a 2s .co m*/ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEARCH) { // ?? ((InputMethodManager) searchSchool.getContext().getSystemService(Context.INPUT_METHOD_SERVICE)) .hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); // ? LogUtil.print("?"); schoolname = searchSchool.getText().toString().trim(); searchSchool(true); return true; } return false; } }); }
From source file:com.phonegap.plugin.ChildBrowser.java
/** * Navigate to the new page/*from ww w. j a v a2 s . c om*/ * * @param url to load */ private void navigate(String url) { InputMethodManager imm = (InputMethodManager) this.ctx.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0); if (!url.startsWith("http") || !url.startsWith("file:")) { this.webview.loadUrl("http://" + url); } else { this.webview.loadUrl(url); } this.webview.requestFocus(); }