Merge "Don't clear focus during transition animations" into pi-dev
am: 09ba7e0bae
Change-Id: I7243f32a7b5770f7e8ac64af329794101ac35c70
This commit is contained in:
@@ -311,6 +311,38 @@ public class ChangeBounds extends Transition {
|
|||||||
++numChanges;
|
++numChanges;
|
||||||
}
|
}
|
||||||
if (numChanges > 0) {
|
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;
|
Animator anim;
|
||||||
if (!mResizeClip) {
|
if (!mResizeClip) {
|
||||||
view.setLeftTopRightBottom(startLeft, startTop, startRight, startBottom);
|
view.setLeftTopRightBottom(startLeft, startTop, startRight, startBottom);
|
||||||
@@ -398,38 +430,6 @@ public class ChangeBounds extends Transition {
|
|||||||
anim = TransitionUtils.mergeAnimators(positionAnimator,
|
anim = TransitionUtils.mergeAnimators(positionAnimator,
|
||||||
clipAnimator);
|
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;
|
return anim;
|
||||||
}
|
}
|
||||||
} else {
|
} 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/
|
// 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.
|
// 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 (newWidth <= 0 || newHeight <= 0) {
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
clearFocus();
|
clearFocus();
|
||||||
|
|||||||
Reference in New Issue
Block a user