List of usage examples for android.view.inputmethod InputMethodManager hideSoftInputFromWindow
public boolean hideSoftInputFromWindow(IBinder windowToken, int flags)
From source file:com.android.mms.ui.ComposeMessageActivity.java
private void hideKeyboard() { InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.hideSoftInputFromWindow(mTextEditor.getWindowToken(), 0); }
From source file:com.skytree.epubtest.BookViewActivity.java
public void dismissKeyboard() { InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(noteEditor.getWindowToken(), 0); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); makeFullScreen();//from w ww. ja va2 s. co m }
From source file:com.android.launcher3.Launcher.java
@Override protected void onNewIntent(Intent intent) { long startTime = 0; if (DEBUG_RESUME_TIME) { startTime = System.currentTimeMillis(); }//from w w w.ja v a 2s . c o m super.onNewIntent(intent); boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); // Check this condition before handling isActionMain, as this will get reset. boolean shouldMoveToDefaultScreen = alreadyOnHome && mState == State.WORKSPACE && getTopFloatingView() == null; boolean isActionMain = Intent.ACTION_MAIN.equals(intent.getAction()); if (isActionMain) { // also will cancel mWaitingForResult. closeSystemDialogs(); if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE return; } // In all these cases, only animate if we're already on home mWorkspace.exitWidgetResizeMode(); closeFolder(alreadyOnHome); closeShortcutsContainer(alreadyOnHome); exitSpringLoadedDragMode(); // If we are already on home, then just animate back to the workspace, // otherwise, just wait until onResume to set the state back to Workspace if (alreadyOnHome) { showWorkspace(true); } else { mOnResumeState = State.WORKSPACE; } final View v = getWindow().peekDecorView(); if (v != null && v.getWindowToken() != null) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } // Reset the apps view if (!alreadyOnHome && mAppsView != null) { mAppsView.scrollToTop(); } // Reset the widgets view if (!alreadyOnHome && mWidgetsView != null) { mWidgetsView.scrollToTop(); } if (mLauncherCallbacks != null) { mLauncherCallbacks.onHomeIntent(); } } if (mLauncherCallbacks != null) { mLauncherCallbacks.onNewIntent(intent); } // Defer moving to the default screen until after we callback to the LauncherCallbacks // as slow logic in the callbacks eat into the time the scroller expects for the snapToPage // animation. if (isActionMain) { boolean callbackAllowsMoveToDefaultScreen = mLauncherCallbacks != null ? mLauncherCallbacks.shouldMoveToDefaultScreenOnHomeIntent() : true; if (shouldMoveToDefaultScreen && !mWorkspace.isTouchActive() && callbackAllowsMoveToDefaultScreen) { // We use this flag to suppress noisy callbacks above custom content state // from onResume. mMoveToDefaultScreenFromNewIntent = true; mWorkspace.post(new Runnable() { @Override public void run() { if (mWorkspace != null) { mWorkspace.moveToDefaultScreen(true); } } }); } } if (DEBUG_RESUME_TIME) { Log.d(TAG, "Time spent in onNewIntent: " + (System.currentTimeMillis() - startTime)); } }
From source file:com.android.soma.Launcher.java
@Override protected void onNewIntent(Intent intent) { long startTime = 0; if (DEBUG_RESUME_TIME) { startTime = System.currentTimeMillis(); }/* w w w .j a v a 2 s . c o m*/ super.onNewIntent(intent); // Close the menu if (Intent.ACTION_MAIN.equals(intent.getAction())) { // also will cancel mWaitingForResult. closeSystemDialogs(); final boolean alreadyOnHome = mHasFocus && ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT); if (mWorkspace == null) { // Can be cases where mWorkspace is null, this prevents a NPE return; } Folder openFolder = mWorkspace.getOpenFolder(); // In all these cases, only animate if we're already on home mWorkspace.exitWidgetResizeMode(); if (alreadyOnHome && mState == State.WORKSPACE && !mWorkspace.isTouchActive() && openFolder == null) { mWorkspace.moveToDefaultScreen(true); } closeFolder(); exitSpringLoadedDragMode(); // If we are already on home, then just animate back to the workspace, // otherwise, just wait until onResume to set the state back to Workspace if (alreadyOnHome) { showWorkspace(true); } else { mOnResumeState = State.WORKSPACE; } final View v = getWindow().peekDecorView(); if (v != null && v.getWindowToken() != null) { InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(v.getWindowToken(), 0); } // Reset the apps customize page if (mAppsCustomizeTabHost != null) { mAppsCustomizeTabHost.reset(); } } if (DEBUG_RESUME_TIME) { Log.d(TAG, "Time spent in onNewIntent: " + (System.currentTimeMillis() - startTime)); } }
From source file:com.appunite.list.AbsHorizontalListView.java
/** * Return an InputConnection for editing of the filter text. */// w ww .ja va 2 s.c om @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { if (isTextFilterEnabled()) { // XXX we need to have the text filter created, so we can get an // InputConnection to proxy to. Unfortunately this means we pretty // much need to make it as soon as a list view gets focus. createTextFilter(false); if (mPublicInputConnection == null) { mDefInputConnection = new BaseInputConnection(this, false); mPublicInputConnection = new InputConnectionWrapper(mTextFilter.onCreateInputConnection(outAttrs), true) { @Override public boolean reportFullscreenMode(boolean enabled) { // Use our own input connection, since it is // the "real" one the IME is talking with. return mDefInputConnection.reportFullscreenMode(enabled); } @Override public boolean performEditorAction(int editorAction) { // The editor is off in its own window; we need to be // the one that does this. if (editorAction == EditorInfo.IME_ACTION_DONE) { InputMethodManager imm = (InputMethodManager) getContext() .getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(getWindowToken(), 0); } return true; } return false; } @Override public boolean sendKeyEvent(KeyEvent event) { // Use our own input connection, since the filter // text view may not be shown in a window so has // no ViewAncestor to dispatch events with. return mDefInputConnection.sendKeyEvent(event); } }; } outAttrs.inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_VARIATION_FILTER; outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE; return mPublicInputConnection; } return null; }
From source file:me.ububble.speakall.fragment.ConversationGroupFragment.java
public void onPause() { super.onPause(); if (!dontClose) { SpeakSocket.conversationGroupFragment = null; if (isShowKeyboard) { final InputMethodManager imm = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); keyboardLayout.setVisibility(View.GONE); isShowKeyboard = false;//from w ww . j a v a 2s. c o m } if (animaciones.size() > 0) { for (String keys : animaciones.keySet()) { if (animaciones.get(keys) != null) if (animaciones.get(keys).isRunning()) { animaciones.get(keys).cancel(); } } animaciones.clear(); } } System.gc(); }
From source file:me.ububble.speakall.fragment.ConversationChatFragment.java
protected void hideKeyBoard() { isShowCustomKeyboard = false;/*from w w w. j a v a 2 s . c om*/ isShowKeyboard = false; keyboardLayout.setVisibility(View.GONE); customKeyboardLayout.setVisibility(View.GONE); customKeyboardAudio.setVisibility(View.GONE); final InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); }
From source file:me.ububble.speakall.fragment.ConversationChatFragment.java
public void onPause() { super.onPause(); System.gc();/*from ww w . j ava 2 s . c om*/ hideKeyBoard(); if (!dontClose) { handlerContactStatus.removeCallbacks(runnableContactStatus); SpeakSocket.conversationChatFragment = null; if (isShowKeyboard) { final InputMethodManager imm = (InputMethodManager) activity .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getView().getWindowToken(), 0); keyboardLayout.setVisibility(View.GONE); isShowKeyboard = false; } if (animaciones.size() > 0) { for (String keys : animaciones.keySet()) { if (animaciones.get(keys) != null) if (animaciones.get(keys).isRunning()) { animaciones.get(keys).cancel(); } } animaciones.clear(); } if (mediaPlayer != null) { mediaPlayer.stop(); mediaPlayer.release(); } if (activeAudioSeekBarr != null) { activeAudioSeekBarr.setProgress(0); activeAudioSeekBarr.setOnSeekBarChangeListener(null); } if (activeAudioTime != null) { activeAudioTime.setText(activeAudioDuration); } if (!activeAudioDuration.equals("")) { activeAudioDuration = ""; } seekHandler.removeCallbacks(runAudio); } }