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

Commit c68d577f authored by John Spurlock's avatar John Spurlock
Browse files

Allow IMEs to extend below nav bar, remove SystemUI veto.

Layout IMEs below the nav bar, offset by bottom padding and
associated guard rectangle with a black background to ensure
they do not appear as islands during transitions.

This makes it safe to remove the SystemUI forced opaque transition
when showing an IME, making the overall transition less expensive,
quicker and smoother overall.

Bug:11058746
Change-Id: I460912ee7c117480c57b947ed31eca330819f32c
parent dcd05b44
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -687,6 +687,8 @@ public class InputMethodService extends AbstractInputMethodService {
        mThemeAttrs = obtainStyledAttributes(android.R.styleable.InputMethodService);
        mRootView = mInflater.inflate(
                com.android.internal.R.layout.input_method, null);
        mRootView.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
        mWindow.setContentView(mRootView);
        mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
        if (Settings.Global.getInt(getContentResolver(),
+61 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.inputmethod;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.LinearLayout;

public class InputMethodRoot extends LinearLayout {
    private final Rect mGuardRect = new Rect();
    private final Paint mGuardPaint = new Paint();

    public InputMethodRoot(Context context) {
        this(context, null);
    }

    public InputMethodRoot(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public InputMethodRoot(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs);
        setWillNotDraw(false);
        mGuardPaint.setColor(context.getResources()
                .getColor(com.android.internal.R.color.input_method_navigation_guard));
    }

    @Override
    protected boolean fitSystemWindows(Rect insets) {
        setPadding(0, 0, 0, insets.bottom);
        return true;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        // draw navigation bar guard
        final int w = getMeasuredWidth();
        final int h = getMeasuredHeight();
        mGuardRect.set(0, h - getPaddingBottom(), w, h);
        canvas.drawRect(mGuardRect, mGuardPaint);
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.android.internal.inputmethod.InputMethodRoot xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/parentPanel"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
@@ -52,4 +52,4 @@
        android:layout_height="wrap_content"
        android:visibility="gone">
    </FrameLayout>
</LinearLayout>
</com.android.internal.inputmethod.InputMethodRoot>
+1 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@

    <drawable name="input_method_fullscreen_background">#fff9f9f9</drawable>
    <drawable name="input_method_fullscreen_background_holo">@drawable/screen_background_holo_dark</drawable>
    <color name="input_method_navigation_guard">#ff000000</color>

    <!-- For date picker widget -->
    <drawable name="selected_day_background">#ff0092f4</drawable>
+1 −0
Original line number Diff line number Diff line
@@ -1441,6 +1441,7 @@
  <java-symbol type="bool" name="config_wimaxEnabled" />
  <java-symbol type="bool" name="show_ongoing_ime_switcher" />
  <java-symbol type="color" name="config_defaultNotificationColor" />
  <java-symbol type="color" name="input_method_navigation_guard" />
  <java-symbol type="drawable" name="ic_notification_ime_default" />
  <java-symbol type="drawable" name="ic_notify_wifidisplay" />
  <java-symbol type="drawable" name="ic_menu_refresh" />
Loading