Merge "Don't clear focus during transition animations" into pi-dev
This commit is contained in:
@@ -311,6 +311,38 @@ public class ChangeBounds extends Transition {
|
||||
++numChanges;
|
||||
}
|
||||
if (numChanges > 0) {
|
||||
if (view.getParent() instanceof ViewGroup) {
|
||||
final ViewGroup parent = (ViewGroup) view.getParent();
|
||||
parent.suppressLayout(true);
|
||||
TransitionListener transitionListener = new TransitionListenerAdapter() {
|
||||
boolean mCanceled = false;
|
||||
|
||||
@Override
|
||||
public void onTransitionCancel(Transition transition) {
|
||||
parent.suppressLayout(false);
|
||||
mCanceled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionEnd(Transition transition) {
|
||||
if (!mCanceled) {
|
||||
parent.suppressLayout(false);
|
||||
}
|
||||
transition.removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionPause(Transition transition) {
|
||||
parent.suppressLayout(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionResume(Transition transition) {
|
||||
parent.suppressLayout(true);
|
||||
}
|
||||
};
|
||||
addListener(transitionListener);
|
||||
}
|
||||
Animator anim;
|
||||
if (!mResizeClip) {
|
||||
view.setLeftTopRightBottom(startLeft, startTop, startRight, startBottom);
|
||||
@@ -398,38 +430,6 @@ public class ChangeBounds extends Transition {
|
||||
anim = TransitionUtils.mergeAnimators(positionAnimator,
|
||||
clipAnimator);
|
||||
}
|
||||
if (view.getParent() instanceof ViewGroup) {
|
||||
final ViewGroup parent = (ViewGroup) view.getParent();
|
||||
parent.suppressLayout(true);
|
||||
TransitionListener transitionListener = new TransitionListenerAdapter() {
|
||||
boolean mCanceled = false;
|
||||
|
||||
@Override
|
||||
public void onTransitionCancel(Transition transition) {
|
||||
parent.suppressLayout(false);
|
||||
mCanceled = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionEnd(Transition transition) {
|
||||
if (!mCanceled) {
|
||||
parent.suppressLayout(false);
|
||||
}
|
||||
transition.removeListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionPause(Transition transition) {
|
||||
parent.suppressLayout(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransitionResume(Transition transition) {
|
||||
parent.suppressLayout(true);
|
||||
}
|
||||
};
|
||||
addListener(transitionListener);
|
||||
}
|
||||
return anim;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -20850,7 +20850,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
|
||||
}
|
||||
// If this isn't laid out yet, focus assignment will be handled during the "deferment/
|
||||
// backtracking" of requestFocus during layout, so don't touch focus here.
|
||||
if (!sCanFocusZeroSized && isLayoutValid()) {
|
||||
if (!sCanFocusZeroSized && isLayoutValid()
|
||||
// Don't touch focus if animating
|
||||
&& !(mParent instanceof ViewGroup && ((ViewGroup) mParent).isLayoutSuppressed())) {
|
||||
if (newWidth <= 0 || newHeight <= 0) {
|
||||
if (hasFocus()) {
|
||||
clearFocus();
|
||||
|
||||
Reference in New Issue
Block a user