use of android.view.inputmethod.InputMethodManager in project Fairphone by Kwamecorp.
the class LauncherTransitionable method onNewIntent.
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
// Close the menu
if (Intent.ACTION_MAIN.equals(intent.getAction())) {
// also will cancel mWaitingForResult.
closeSystemDialogs();
final boolean alreadyOnHome = ((intent.getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
Runnable processIntent = new Runnable() {
public void run() {
if (mWorkspace == null) {
// 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();
// 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 AllApps to its initial state
if (!alreadyOnHome && mAppsCustomizeTabHost != null) {
mAppsCustomizeTabHost.reset();
}
}
};
if (alreadyOnHome && !mWorkspace.hasWindowFocus()) {
// Delay processing of the intent to allow the status bar
// animation to finish
// first in order to avoid janky animations.
mWorkspace.postDelayed(processIntent, 350);
} else {
// Process the intent immediately.
processIntent.run();
}
}
}
use of android.view.inputmethod.InputMethodManager in project CircleDemo by Naoki2015.
the class CommonUtils method hideSoftInput.
public static void hideSoftInput(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
//强制隐藏键盘
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
use of android.view.inputmethod.InputMethodManager in project CircleDemo by Naoki2015.
the class CommonUtils method showSoftInput.
public static void showSoftInput(Context context, View view) {
InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
//imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
use of android.view.inputmethod.InputMethodManager in project phonegap-facebook-plugin by Wizcorp.
the class CordovaWebView method onKeyDown.
/*
* onKeyDown
*/
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyDownCodes.contains(keyCode)) {
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
// only override default behavior is event bound
LOG.d(TAG, "Down Key Hit");
this.loadUrl("javascript:cordova.fireDocumentEvent('volumedownbutton');");
return true;
} else // If volumeup key
if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
LOG.d(TAG, "Up Key Hit");
this.loadUrl("javascript:cordova.fireDocumentEvent('volumeupbutton');");
return true;
} else {
return super.onKeyDown(keyCode, event);
}
} else if (keyCode == KeyEvent.KEYCODE_BACK) {
return !(this.startOfHistory()) || this.bound;
} else if (keyCode == KeyEvent.KEYCODE_MENU) {
//How did we get here? Is there a childView?
View childView = this.getFocusedChild();
if (childView != null) {
//Make sure we close the keyboard if it's present
InputMethodManager imm = (InputMethodManager) cordova.getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(childView.getWindowToken(), 0);
cordova.getActivity().openOptionsMenu();
return true;
} else {
return super.onKeyDown(keyCode, event);
}
}
return super.onKeyDown(keyCode, event);
}
use of android.view.inputmethod.InputMethodManager in project phonegap-facebook-plugin by Wizcorp.
the class PlacePickerFragment method onAttach.
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (searchBox != null) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(searchBox, InputMethodManager.SHOW_IMPLICIT);
}
}
Aggregations