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

Commit e61ad560 authored by Uwais Ashraf's avatar Uwais Ashraf
Browse files

Align empty recents message+icon to center of View.

Seems like it was previously aligned to center of task which doesn't always look good.

Screenshots:
Handheld before - https://screenshot.googleplex.com/6GmqhTjUhUpwwBs
Handheld after - https://screenshot.googleplex.com/3QMYCQaS6USMQYy

Tablet before - https://screenshot.googleplex.com/7tsERFGVsa6QSNY
Tablet after - https://screenshot.googleplex.com/8itDgQ2jDTHk463

Unfolded before - https://screenshot.googleplex.com/AJaqC9LqP2Dwfz2
Unfolded after - https://screenshot.googleplex.com/8aaa7ZhemqHXHRh

Fix: 299100892
Test: OverviewEmptyMessageImageTest and observed on tablet, handheld and unfolded.
Change-Id: I538d25e5a98e25351e71718de3ca572fd00438ad
parent 5bec1164
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -4980,12 +4980,13 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T

    protected void maybeDrawEmptyMessage(Canvas canvas) {
        if (mShowEmptyMessage && mEmptyTextLayout != null) {
            // Offset to center in the visible (non-padded) part of RecentsView
            mTempRect.set(mInsets.left + getPaddingLeft(), mInsets.top + getPaddingTop(),
                    mInsets.right + getPaddingRight(), mInsets.bottom + getPaddingBottom());
            // Offsets icon and text up so that the vertical center of screen (accounting for
            // insets) is between icon and text.
            int offset = (mEmptyIcon.getIntrinsicHeight() + mEmptyMessagePadding) / 2;

            canvas.save();
            canvas.translate(getScrollX() + (mTempRect.left - mTempRect.right) / 2,
                    (mTempRect.top - mTempRect.bottom) / 2);
            canvas.translate(getScrollX() + (mInsets.left - mInsets.right) / 2f,
                    (mInsets.top - mInsets.bottom) / 2f - offset);
            mEmptyIcon.draw(canvas);
            canvas.translate(mEmptyMessagePadding,
                    mEmptyIcon.getBounds().bottom + mEmptyMessagePadding);