Search in sources :

Example 86 with InputMethodManager

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();
        }
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) AppWidgetHostView(android.appwidget.AppWidgetHostView) View(android.view.View) TextView(android.widget.TextView)

Example 87 with InputMethodManager

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);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 88 with InputMethodManager

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);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 89 with InputMethodManager

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);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) View(android.view.View) WebView(android.webkit.WebView)

Example 90 with InputMethodManager

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);
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Aggregations

InputMethodManager (android.view.inputmethod.InputMethodManager)631 View (android.view.View)120 TextView (android.widget.TextView)67 Paint (android.graphics.Paint)43 Spannable (android.text.Spannable)34 Editable (android.text.Editable)33 EditText (android.widget.EditText)33 ImageView (android.widget.ImageView)31 Intent (android.content.Intent)29 RemoteException (android.os.RemoteException)23 KeyEvent (android.view.KeyEvent)22 TextPaint (android.text.TextPaint)21 Point (android.graphics.Point)18 InputMethodInfo (android.view.inputmethod.InputMethodInfo)18 AdapterView (android.widget.AdapterView)18 Button (android.widget.Button)16 RemoteView (android.widget.RemoteViews.RemoteView)16 Resources (android.content.res.Resources)15 ListView (android.widget.ListView)15 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)14