Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb5278b6 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing issue with cards being rendered under the nav bar after a configuration...

Fixing issue with cards being rendered under the nav bar after a configuration change due to improperly setting the system insets.
parent 47c4c695
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
+4 −4
Original line number Diff line number Diff line
@@ -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) {