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
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -4062,7 +4062,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
cf.top = vf.top = mStableTop;
|
||||
cf.right = vf.right = mStableRight;
|
||||
vf.bottom = mStableBottom;
|
||||
cf.bottom = mContentBottom;
|
||||
|
||||
if (adjust == SOFT_INPUT_ADJUST_RESIZE) {
|
||||
cf.bottom = mContentBottom;
|
||||
} else {
|
||||
cf.bottom = mDockBottom;
|
||||
vf.bottom = mContentBottom;
|
||||
}
|
||||
} else {
|
||||
|
||||
// Default policy decor for the default display
|
||||
|
||||
Reference in New Issue
Block a user