Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 571354fd authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Do not open the keyboard when opening Find from CAB.

Bug:3312049

Do not start Find on page if the action mode fails to
start.  Clean up showFindDialog.

Requires a change to packages/apps/Browser

Change-Id: I204315665d3bf9f3ac78e78c4059c5a6f24695db
parent 2cdee233
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -234695,7 +234695,7 @@
</parameter>
</method>
<method name="showFindDialog"
 return="void"
 return="boolean"
 abstract="false"
 native="false"
 synchronized="false"
@@ -234706,6 +234706,8 @@
>
<parameter name="text" type="java.lang.String">
</parameter>
<parameter name="showIme" type="boolean">
</parameter>
</method>
<method name="stopLoading"
 return="void"
@@ -257493,7 +257495,7 @@
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="arg0" type="T">
<parameter name="t" type="T">
</parameter>
</method>
</interface>
+4 −1
Original line number Diff line number Diff line
@@ -134,6 +134,10 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        }
    }

    public void showSoftInput() {
        mInput.showSoftInput(mEditText, 0);
    }

    /*
     * Update the string which tells the user how many matches were found, and
     * which match is currently highlighted.
@@ -165,7 +169,6 @@ class FindActionModeCallback implements ActionMode.Callback, TextWatcher,
        mMatchesFound = false;
        mMatches.setText("0");
        mEditText.requestFocus();
        mInput.showSoftInput(mEditText, 0);
        return true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ class SelectActionModeCallback implements ActionMode.Callback {
            case com.android.internal.R.id.find:
                String sel= mWebView.getSelection();
                mode.finish();
                mWebView.showFindDialog(sel);
                mWebView.showFindDialog(sel, false);
                break;
            case com.android.internal.R.id.websearch:
                mode.finish();
+17 −3
Original line number Diff line number Diff line
@@ -2951,19 +2951,33 @@ public class WebView extends AbsoluteLayout
     * @param text If non-null, will be the initial text to search for.
     *             Otherwise, the last String searched for in this WebView will
     *             be used to start.
     * @param showIme If true, show the IME, assuming the user will begin typing.
     *             If false and text is non-null, perform a find all.
     * @return boolean True if the find dialog is shown, false otherwise.
     */
    public void showFindDialog(String text) {
    public boolean showFindDialog(String text, boolean showIme) {
        mFindCallback = new FindActionModeCallback(mContext);
        if (startActionMode(mFindCallback) == null) {
            // Could not start the action mode, so end Find on page
            mFindCallback = null;
            return false;
        }
        setFindIsUp(true);
        mFindCallback.setWebView(this);
        View titleBar = mTitleBar;
        startActionMode(mFindCallback);
        if (showIme) {
            mFindCallback.showSoftInput();
        } else if (text != null) {
            mFindCallback.setText(text);
            mFindCallback.findAll();
            return true;
        }
        if (text == null) {
            text = mLastFind;
        }
        if (text != null) {
            mFindCallback.setText(text);
        }
        return true;
    }

    /**