Search in sources :

Example 1 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project cw-omnibus by commonsguy.

the class RichTextSearchActivity method onEditorAction.

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
        searchFor(search.getText().toString());
        InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }
    return (true);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 2 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project Launcher3 by chislon.

the class LauncherTransitionable method onNewIntent.

@Override
protected void onNewIntent(Intent intent) {
    long startTime = 0;
    if (DEBUG_RESUME_TIME) {
        startTime = System.currentTimeMillis();
    }
    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();
        // 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));
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) AppWidgetHostView(android.appwidget.AppWidgetHostView)

Example 3 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project cw-omnibus by commonsguy.

the class ActionBarFragment method onEditorAction.

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    if (event == null || event.getAction() == KeyEvent.ACTION_UP) {
        adapter.add(v.getText().toString());
        v.setText("");
        InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
    }
    return (true);
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 4 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project cw-omnibus by commonsguy.

the class SearchView method setImeVisibility.

private void setImeVisibility(final boolean visible) {
    if (visible) {
        post(mShowImeRunnable);
    } else {
        removeCallbacks(mShowImeRunnable);
        InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        if (imm != null) {
            imm.hideSoftInputFromWindow(getWindowToken(), 0);
        }
    }
}
Also used : InputMethodManager(android.view.inputmethod.InputMethodManager)

Example 5 with InputMethodManager

use of android.view.inputmethod.InputMethodManager in project android by cSploit.

the class HijackerWebView method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences themePrefs = getSharedPreferences("THEME", 0);
    Boolean isDark = themePrefs.getBoolean("isDark", false);
    if (isDark)
        setTheme(R.style.DarkTheme);
    else
        setTheme(R.style.AppTheme);
    super.onCreate(savedInstanceState);
    supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    supportRequestWindowFeature(Window.FEATURE_PROGRESS);
    setTitle(System.getCurrentTarget() + " > MITM > Session Hijacker");
    setContentView(R.layout.plugin_mitm_hijacker_webview);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    mWebView = (WebView) findViewById(R.id.webView);
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    mProgressBar = (ProgressBar) findViewById(R.id.webprogress);
    mURLet = (EditText) findViewById(R.id.url);
    mProgressBar.setVisibility(View.GONE);
    mProgressBar.setMax(100);
    mSettings = mWebView.getSettings();
    mSettings.setJavaScriptEnabled(true);
    mSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    mSettings.setBuiltInZoomControls(true);
    mSettings.setAppCacheEnabled(false);
    mSettings.setUserAgentString(DEFAULT_USER_AGENT);
    mSettings.setUseWideViewPort(true);
    mURLet.setOnEditorActionListener(new EditText.OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_DONE || actionId == EditorInfo.IME_ACTION_NEXT) {
                mWebView.loadUrl(mURLet.getText().toString());
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(mWebView.getWindowToken(), 0);
                mWebView.requestFocus();
                return true;
            }
            return false;
        }
    });
    mURLet.setOnKeyListener(new EditText.OnKeyListener() {

        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {
            if (event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
                mWebView.loadUrl(mURLet.getText().toString());
                InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(mWebView.getWindowToken(), 0);
                mWebView.requestFocus();
                return true;
            }
            return false;
        }
    });
    mWebView.setWebViewClient(new WebViewClient() {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            mURLet.setText(url);
            return true;
        }
    });
    mWebView.setWebChromeClient(new WebChromeClient() {

        public void onProgressChanged(WebView view, int progress) {
            if ((mWebView != null) && (mURLet != null) && (progress == 0))
                ;
            {
                getSupportActionBar().setSubtitle(mWebView.getUrl());
                mURLet.setText(mWebView.getUrl());
            }
            if (mProgressBar != null) {
                mProgressBar.setVisibility(View.VISIBLE);
                // Normalize our progress along the progress bar's scale
                mProgressBar.setProgress(progress);
                if (progress == 100) {
                    mProgressBar.setVisibility(View.GONE);
                }
            }
        }
    });
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        CookieManager cm = CookieManager.getInstance();
        cm.flush();
    } else {
        CookieSyncManager.createInstance(this);
        CookieManager.getInstance().removeAllCookie();
    }
    Session session = (Session) System.getCustomData();
    if (session != null) {
        String domain = null, rawcookie = null;
        for (HttpCookie cookie : session.mCookies.values()) {
            domain = cookie.getDomain();
            rawcookie = cookie.getName() + "=" + cookie.getValue() + "; domain=" + domain + "; path=/" + (session.mHTTPS ? ";secure" : "");
            CookieManager.getInstance().setCookie(domain, rawcookie);
        }
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            CookieManager cm = CookieManager.getInstance();
            cm.flush();
        } else {
            CookieSyncManager.getInstance().startSync();
        }
        if (session.mUserAgent != null && session.mUserAgent.isEmpty() == false)
            mSettings.setUserAgentString(session.mUserAgent);
        String url = (session.mHTTPS ? "https" : "http") + "://";
        if (domain != null && !Patterns.IP_ADDRESS.matcher(domain).matches())
            url += "www.";
        url += domain;
        mWebView.loadUrl(url);
        mWebView.requestFocus();
    }
}
Also used : EditText(android.widget.EditText) SharedPreferences(android.content.SharedPreferences) InputMethodManager(android.view.inputmethod.InputMethodManager) View(android.view.View) WebView(android.webkit.WebView) TextView(android.widget.TextView) KeyEvent(android.view.KeyEvent) WebChromeClient(android.webkit.WebChromeClient) TextView(android.widget.TextView) WebView(android.webkit.WebView) HttpCookie(java.net.HttpCookie) CookieManager(android.webkit.CookieManager) WebViewClient(android.webkit.WebViewClient)

Aggregations

InputMethodManager (android.view.inputmethod.InputMethodManager)601 View (android.view.View)113 TextView (android.widget.TextView)61 Paint (android.graphics.Paint)43 Spannable (android.text.Spannable)34 Editable (android.text.Editable)32 EditText (android.widget.EditText)30 Intent (android.content.Intent)29 ImageView (android.widget.ImageView)29 RemoteException (android.os.RemoteException)23 TextPaint (android.text.TextPaint)21 KeyEvent (android.view.KeyEvent)20 Point (android.graphics.Point)18 InputMethodInfo (android.view.inputmethod.InputMethodInfo)18 AdapterView (android.widget.AdapterView)17 Button (android.widget.Button)17 RemoteView (android.widget.RemoteViews.RemoteView)16 Resources (android.content.res.Resources)15 ListView (android.widget.ListView)15 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)14