Merge "Only modify window layout params when necessary." into cw-f-dev

This commit is contained in:
Michael Kwan
2017-02-14 00:48:10 +00:00
committed by Android (Google) Code Review

View File

@@ -3016,10 +3016,14 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
@Override @Override
public void onSwipeCancelled(SwipeDismissLayout layout) { public void onSwipeCancelled(SwipeDismissLayout layout) {
WindowManager.LayoutParams newParams = getAttributes(); WindowManager.LayoutParams newParams = getAttributes();
newParams.x = 0; // Swipe changes only affect the x-translation and alpha, check to see if
newParams.alpha = 1; // those values have changed first before resetting them.
setAttributes(newParams); if (newParams.x != 0 || newParams.alpha != 1) {
setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN | FLAG_LAYOUT_NO_LIMITS); newParams.x = 0;
newParams.alpha = 1;
setAttributes(newParams);
setFlags(FLAG_FULLSCREEN, FLAG_FULLSCREEN | FLAG_LAYOUT_NO_LIMITS);
}
} }
}); });
} }