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

Commit 2edd6826 authored by Leon Scroggins's avatar Leon Scroggins
Browse files

Create a new ImeOption that disables fullscreen in landscape, and use it.

EditorInfo:
Add a flag to tell the InputMethodService to never go into fullscreen
mode.

InputMethodService:
When the new flag is set, onEvaluateFullscreenMode always returns
false.

WebTextView:
Use the new flag, along with IME_FLAG_NO_EXTRACT_UI.  Fixes
http://b/issue?id=2358360
parent fef4874a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -841,7 +841,14 @@ public class InputMethodService extends AbstractInputMethodService {
     */
    public boolean onEvaluateFullscreenMode() {
        Configuration config = getResources().getConfiguration();
        return config.orientation == Configuration.ORIENTATION_LANDSCAPE;
        if (config.orientation != Configuration.ORIENTATION_LANDSCAPE) {
            return false;
        }
        if (mInputEditorInfo != null
                && (mInputEditorInfo.imeOptions & EditorInfo.IME_FLAG_NO_FULLSCREEN) != 0) {
            return false;
        }
        return true;
    }
    
    /**
+9 −1
Original line number Diff line number Diff line
@@ -112,6 +112,14 @@ public class EditorInfo implements InputType, Parcelable {
     */
    public static final int IME_FLAG_NO_ENTER_ACTION = 0x40000000;

    /**
     * Flag of {@link #imeOptions}: used to request that the IME never go
     * into fullscreen mode.  Applications need to be aware that the flag is not
     * a guarantee, and not all IMEs will respect it.
     * @hide
     */
    public static final int IME_FLAG_NO_FULLSCREEN = 0x80000000;

    /**
     * Generic unspecified type for {@link #imeOptions}.
     */
+8 −5
Original line number Diff line number Diff line
@@ -807,19 +807,21 @@ import java.util.ArrayList;
        int maxLength = -1;
        int inputType = EditorInfo.TYPE_CLASS_TEXT
                | EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT;
        int imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI
                | EditorInfo.IME_FLAG_NO_FULLSCREEN;
        switch (type) {
            case 1: // TEXT_AREA
                single = false;
                inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE
                        | EditorInfo.TYPE_TEXT_FLAG_CAP_SENTENCES
                        | EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT;
                setImeOptions(EditorInfo.IME_ACTION_NONE);
                imeOptions |= EditorInfo.IME_ACTION_NONE;
                break;
            case 2: // PASSWORD
                inPassword = true;
                break;
            case 3: // SEARCH
                setImeOptions(EditorInfo.IME_ACTION_SEARCH);
                imeOptions |= EditorInfo.IME_ACTION_SEARCH;
                break;
            case 4: // EMAIL
                // TYPE_TEXT_VARIATION_WEB_EDIT_TEXT prevents EMAIL_ADDRESS
@@ -858,14 +860,14 @@ import java.util.ArrayList;
                switch (action) {
                    // Keep in sync with CachedRoot::ImeAction
                    case 0: // NEXT
                        setImeOptions(EditorInfo.IME_ACTION_NEXT);
                        imeOptions |= EditorInfo.IME_ACTION_NEXT;
                        break;
                    case 1: // GO
                        setImeOptions(EditorInfo.IME_ACTION_GO);
                        imeOptions |= EditorInfo.IME_ACTION_GO;
                        break;
                    case -1: // FAILURE
                    case 2: // DONE
                        setImeOptions(EditorInfo.IME_ACTION_DONE);
                        imeOptions |= EditorInfo.IME_ACTION_DONE;
                        break;
                }
            }
@@ -874,6 +876,7 @@ import java.util.ArrayList;
        setMaxLength(maxLength);
        setHorizontallyScrolling(single);
        setInputType(inputType);
        setImeOptions(imeOptions);
        setInPassword(inPassword);
        AutoCompleteAdapter adapter = null;
        setAdapterCustom(adapter);