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

Commit 816c8e47 authored by Selim Cinek's avatar Selim Cinek
Browse files

Legacy custom views now get properly layed out again

Since the minheight grew, all notifications grew.
Legacy custom notifications need to stay the same
height though.

Change-Id: I469c448014c3d3c31526466d06a60ac44838b274
parent 90dcf6d7
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -51,6 +51,9 @@
    <!-- Height of a small notification in the status bar-->
    <dimen name="notification_min_height">84dp</dimen>

    <!-- Height of a small notification in the status bar which was used before android N -->
    <dimen name="notification_min_height_legacy">64dp</dimen>

    <!-- Height of a large notification in the status bar -->
    <dimen name="notification_max_height">276dp</dimen>

+1 −1
Original line number Diff line number Diff line
@@ -509,7 +509,7 @@ public class ExpandHelper implements Gefingerpoken {
        if (canBeExpanded) {
            if (DEBUG) Log.d(TAG, "working on an expandable child");
            mNaturalHeight = mScaler.getNaturalHeight();
            mSmallSize = v.getMinHeight();
            mSmallSize = v.getMinExpandHeight();
        } else {
            if (DEBUG) Log.d(TAG, "working on a non-expandable child");
            mNaturalHeight = mOldHeight;
+10 −2
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ public abstract class BaseStatusBar extends SystemUI implements
    protected IDreamManager mDreamManager;
    PowerManager mPowerManager;
    protected StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    protected int mRowMinHeightLegacy;
    protected int mRowMinHeight;
    protected int mRowMaxHeight;

@@ -1338,7 +1339,6 @@ public abstract class BaseStatusBar extends SystemUI implements
        PackageManager pmUser = getPackageManagerForUser(mContext,
                entry.notification.getUser().getIdentifier());

        int maxHeight = mRowMaxHeight;
        final StatusBarNotification sbn = entry.notification;
        entry.cacheContentViews(mContext, null);

@@ -1537,7 +1537,7 @@ public abstract class BaseStatusBar extends SystemUI implements
            }
        }
        entry.row = row;
        entry.row.setHeightRange(mRowMinHeight, maxHeight);
        updateNotificationHeightRange(entry);
        entry.row.setOnActivatedListener(this);
        entry.row.setExpandable(bigContentViewLocal != null);

@@ -1555,6 +1555,14 @@ public abstract class BaseStatusBar extends SystemUI implements
        return true;
    }

    private void updateNotificationHeightRange(Entry entry) {
        boolean customView = entry.getContentView().getId()
                != com.android.internal.R.id.status_bar_latest_event_content;
        boolean beforeN = entry.targetSdk < Build.VERSION_CODES.N;
        int minHeight = customView && beforeN ? mRowMinHeightLegacy : mRowMinHeight;
        entry.row.setHeightRange(minHeight, mRowMaxHeight);
    }

    /**
     * Adds RemoteInput actions from the WearableExtender; to be removed once more apps support this
     * via first-class API.
+9 −2
Original line number Diff line number Diff line
@@ -525,6 +525,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
    public void setHeightRange(int rowMinHeight, int rowMaxHeight) {
        mRowMinHeight = rowMinHeight;
        mMaxViewHeight = rowMaxHeight;
        mPrivateLayout.setSmallHeight(mRowMinHeight);
        mPublicLayout.setSmallHeight(mRowMinHeight);
    }

    public boolean isExpandable() {
@@ -890,12 +892,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {

    @Override
    public int getMinHeight() {
        NotificationContentView showingLayout = getShowingLayout();
        return showingLayout.getMinHeight();
    }

    @Override
    public int getMinExpandHeight() {
        if (mIsSummaryWithChildren && !mOnKeyguard) {
            return mChildrenContainer.getMinHeight()
                    + mNotificationHeader.getHeight();
        }
        NotificationContentView showingLayout = getShowingLayout();
        return showingLayout.getMinHeight();
        return getMinHeight();
    }

    @Override
+9 −0
Original line number Diff line number Diff line
@@ -194,6 +194,15 @@ public abstract class ExpandableView extends FrameLayout {
        return getHeight();
    }

    /**
     * @return The minimum height this child chan be expanded to. Note that this might be different
     * than {@link #getMinHeight()} because some elements can't be collapsed by an expand gesture
     * to it's absolute minimal height
     */
    public int getMinExpandHeight() {
        return getHeight();
    }

    /**
     * Sets the notification as dimmed. The default implementation does nothing.
     *
Loading