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

Commit 384e60e9 authored by Matthew Ng's avatar Matthew Ng
Browse files

Fixes header bar sizes when changing display sizes

Fixed by capturing the correct task algorithm margin sizes and
conducting a re-inflate on the TaskStackHeader upon configuration changes.

Bug: 30370789
Fixes: 30370789
Test: manual - changed display sizes and toggled rencents
Change-Id: Ia1b823433ea1920293cdeca6b7e48ffe15f78b61
parent c0f50362
Loading
Loading
Loading
Loading
+5 −11
Original line number Diff line number Diff line
@@ -181,10 +181,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        ssp.registerTaskStackListener(mTaskStackListener);

        // Initialize the static configuration resources
        LayoutInflater inflater = LayoutInflater.from(mContext);
        mDummyStackView = new TaskStackView(mContext);
        mHeaderBar = (TaskViewHeader) inflater.inflate(R.layout.recents_task_view_header,
                null, false);
        reloadResources();
    }

@@ -205,14 +202,6 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
        Resources res = mContext.getResources();
        reloadResources();
        mDummyStackView.reloadOnConfigurationChange();
        // Update the header bar direction directly as it is not attached to anything and does not
        // layout except in updateHeaderBarLayout()
        mHeaderBar.setLayoutDirection(res.getConfiguration().getLayoutDirection());
        mHeaderBar.onConfigurationChanged();
        mHeaderBar.forceLayout();
        mHeaderBar.measure(
                MeasureSpec.makeMeasureSpec(mHeaderBar.getMeasuredWidth(), MeasureSpec.EXACTLY),
                MeasureSpec.makeMeasureSpec(mHeaderBar.getMeasuredHeight(), MeasureSpec.EXACTLY));
    }

    /**
@@ -586,6 +575,11 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
                R.dimen.recents_task_view_header_height_tablet_land,
                R.dimen.recents_task_view_header_height,
                R.dimen.recents_task_view_header_height_tablet_land);

        LayoutInflater inflater = LayoutInflater.from(mContext);
        mHeaderBar = (TaskViewHeader) inflater.inflate(R.layout.recents_task_view_header,
                null, false);
        mHeaderBar.setLayoutDirection(res.getConfiguration().getLayoutDirection());
    }

    /**
+12 −13
Original line number Diff line number Diff line
@@ -344,19 +344,6 @@ public class TaskStackLayoutAlgorithm {
        mContext = context;
        mCb = cb;
        mFreeformLayoutAlgorithm = new FreeformWorkspaceLayoutAlgorithm(context);
        mMinMargin = res.getDimensionPixelSize(R.dimen.recents_layout_min_margin);
        mBaseTopMargin = getDimensionForDevice(context,
                R.dimen.recents_layout_top_margin_phone,
                R.dimen.recents_layout_top_margin_tablet,
                R.dimen.recents_layout_top_margin_tablet_xlarge);
        mBaseSideMargin = getDimensionForDevice(context,
                R.dimen.recents_layout_side_margin_phone,
                R.dimen.recents_layout_side_margin_tablet,
                R.dimen.recents_layout_side_margin_tablet_xlarge);
        mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin);
        mFreeformStackGap =
                res.getDimensionPixelSize(R.dimen.recents_freeform_layout_bottom_margin);

        reloadOnConfigurationChange(context);
    }

@@ -390,6 +377,18 @@ public class TaskStackLayoutAlgorithm {
                R.dimen.recents_layout_initial_bottom_offset_tablet,
                R.dimen.recents_layout_initial_bottom_offset_tablet);
        mFreeformLayoutAlgorithm.reloadOnConfigurationChange(context);
        mMinMargin = res.getDimensionPixelSize(R.dimen.recents_layout_min_margin);
        mBaseTopMargin = getDimensionForDevice(context,
                R.dimen.recents_layout_top_margin_phone,
                R.dimen.recents_layout_top_margin_tablet,
                R.dimen.recents_layout_top_margin_tablet_xlarge);
        mBaseSideMargin = getDimensionForDevice(context,
                R.dimen.recents_layout_side_margin_phone,
                R.dimen.recents_layout_side_margin_tablet,
                R.dimen.recents_layout_side_margin_tablet_xlarge);
        mBaseBottomMargin = res.getDimensionPixelSize(R.dimen.recents_layout_bottom_margin);
        mFreeformStackGap =
                res.getDimensionPixelSize(R.dimen.recents_freeform_layout_bottom_margin);
    }

    /**