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

Commit dc5b4535 authored by Adrian Roos's avatar Adrian Roos
Browse files

Scroll to RemoteInputView

Scrolls to the RemoteInputView when it's beneath the IME.
Also fixes ViewRootImpl to take into account translation
when calculating the location of the focused rect.

Bug: 22452379
Change-Id: I9b9649edeabf9bcab8fc487fe92dec62f388737e
parent 613e5a0e
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -23,16 +23,16 @@
        android:id="@+id/remote_input"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:paddingStart="16dp"
        android:paddingEnd="12dp"
        android:paddingBottom="4dp"
        android:paddingTop="2dp">
        android:paddingEnd="12dp">

    <view class="com.android.systemui.statusbar.policy.RemoteInputView$RemoteEditText"
            android:id="@+id/remote_input_text"
            android:layout_height="match_parent"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:paddingTop="2dp"
            android:paddingBottom="4dp"
            android:paddingStart="16dp"
            android:paddingEnd="12dp"
            android:gravity="start|center_vertical"
            android:textAppearance="?android:attr/textAppearance"
@@ -47,7 +47,9 @@
    <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical">
            android:layout_gravity="center_vertical"
            android:paddingTop="2dp"
            android:paddingBottom="4dp">

        <ImageButton
                android:layout_width="wrap_content"
+6 −0
Original line number Diff line number Diff line
@@ -134,6 +134,12 @@ public class StatusBarWindowManager implements RemoteInputController.Callback {
            mLpChanged.flags |= WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
            mLpChanged.flags &= ~WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
        }

        if (state.remoteInputActive) {
            mLpChanged.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN;
        } else {
            mLpChanged.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
        }
    }

    private void applyHeight(State state) {
+16 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.app.PendingIntent;
import android.app.RemoteInput;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Editable;
@@ -174,8 +175,8 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
    }

    public void focus() {
        mEditText.setInnerFocusable(true);
        mController.addRemoteInput(mEntry);
        mEditText.setInnerFocusable(true);
        mEditText.mShowImeOnInputConnection = true;
        mEditText.setText(mEntry.remoteInputText);
        mEditText.setSelection(mEditText.getText().length());
@@ -256,6 +257,20 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
            defocusIfNeeded();
        }

        @Override
        public boolean requestRectangleOnScreen(Rect r) {
            r.top = mScrollY;
            r.bottom = mScrollY + (mBottom - mTop);
            return super.requestRectangleOnScreen(r);
        }

        @Override
        public void getFocusedRect(Rect r) {
            super.getFocusedRect(r);
            r.top = mScrollY;
            r.bottom = mScrollY + (mBottom - mTop);
        }

        @Override
        public boolean onKeyPreIme(int keyCode, KeyEvent event) {
            if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) {
+7 −1
Original line number Diff line number Diff line
@@ -4062,8 +4062,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            cf.top = vf.top = mStableTop;
            cf.right = vf.right = mStableRight;
            vf.bottom = mStableBottom;

            if (adjust == SOFT_INPUT_ADJUST_RESIZE) {
                cf.bottom = mContentBottom;
            } else {
                cf.bottom = mDockBottom;
                vf.bottom = mContentBottom;
            }
        } else {

            // Default policy decor for the default display
            dcf.left = mSystemLeft;