Merge "Fixing issue with cards being rendered under the nav bar after a configuration change due to improperly setting the system insets."

This commit is contained in:
Winson Chung
2014-03-18 02:09:37 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 6 deletions

View File

@@ -58,12 +58,13 @@ class SystemUIMessageHandler extends Handler {
Bundle data = msg.getData();
Rect windowRect = (Rect) data.getParcelable("windowRect");
Rect systemInsets = (Rect) data.getParcelable("systemInsets");
RecentsConfiguration.getInstance().updateSystemInsets(systemInsets);
// Create a dummy task stack & compute the rect for the thumbnail to animate to
TaskStack stack = new TaskStack(context);
TaskStackView tsv = new TaskStackView(context, stack);
tsv.computeRects(windowRect.width(), windowRect.height() - systemInsets.top);
// Since the nav bar height is already accounted for in the windowRect, don't pass
// in a bottom inset
tsv.computeRects(windowRect.width(), windowRect.height() - systemInsets.top, 0);
tsv.boundScroll();
TaskViewTransform transform = tsv.getStackTransform(0);
Rect taskRect = new Rect(transform.rect);

View File

@@ -428,16 +428,15 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
}
/** Computes the stack and task rects */
public void computeRects(int width, int height) {
public void computeRects(int width, int height, int insetBottom) {
// Note: We let the stack view be the full height because we want the cards to go under the
// navigation bar if possible. However, the stack rects which we use to calculate
// max scroll, etc. need to take the nav bar into account
// Compute the stack rects
RecentsConfiguration config = RecentsConfiguration.getInstance();
mRect.set(0, 0, width, height);
mStackRect.set(mRect);
mStackRect.bottom -= config.systemInsets.bottom;
mStackRect.bottom -= insetBottom;
int smallestDimension = Math.min(width, height);
int padding = (int) (Constants.Values.TaskStackView.StackPaddingPct * smallestDimension / 2f);
@@ -466,7 +465,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
" awaitingFirstLayout: " + mAwaitingFirstLayout, Console.AnsiGreen);
// Compute our stack/task rects
computeRects(width, height);
RecentsConfiguration config = RecentsConfiguration.getInstance();
computeRects(width, height, config.systemInsets.bottom);
// Debug logging
if (Constants.DebugFlags.UI.MeasureAndLayout) {