Merge "Fix clobbered RemoteInputView when changing position" into nyc-dev

This commit is contained in:
Adrian Roos
2016-03-10 19:09:23 +00:00
committed by Android (Google) Code Review
3 changed files with 27 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ public abstract class ExpandableView extends FrameLayout {
private boolean mWillBeGone;
private int mMinClipTopAmount = 0;
private boolean mClipToActualHeight = true;
private boolean mChangingPosition = false;
public ExpandableView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -407,6 +408,14 @@ public abstract class ExpandableView extends FrameLayout {
return 0;
}
public void setChangingPosition(boolean changingPosition) {
mChangingPosition = changingPosition;
}
public boolean isChangingPosition() {
return mChangingPosition;
}
/**
* A listener notifying when {@link #getActualHeight} changes.
*/

View File

@@ -154,9 +154,22 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
setVisibility(INVISIBLE);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (mEntry.row.isChangingPosition()) {
if (getVisibility() == VISIBLE && mEditText.isFocusable()) {
mEditText.requestFocus();
}
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
if (mEntry.row.isChangingPosition()) {
return;
}
mController.removeRemoteInput(mEntry);
}
@@ -229,6 +242,9 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
}
private void defocusIfNeeded() {
if (mDefocusListener.mEntry.row.isChangingPosition()) {
return;
}
if (isFocusable() && isEnabled()) {
setInnerFocusable(false);
if (mDefocusListener != null) {

View File

@@ -2252,8 +2252,10 @@ public class NotificationStackScrollLayout extends ViewGroup
int currentIndex = indexOfChild(child);
if (child != null && child.getParent() == this && currentIndex != newIndex) {
mChangePositionInProgress = true;
((ExpandableView)child).setChangingPosition(true);
removeView(child);
addView(child, newIndex);
((ExpandableView)child).setChangingPosition(false);
mChangePositionInProgress = false;
if (mIsExpanded && mAnimationsEnabled && child.getVisibility() != View.GONE) {
mChildrenChangingPositions.add(child);