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

Commit c0a648da authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix race condition btwn row and shelf icon init" into rvc-dev am:...

Merge "Fix race condition btwn row and shelf icon init" into rvc-dev am: c9ca670c am: 62dd30fa am: 41267edf am: 03262f25

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11959993

Change-Id: I0b7c4e002b6437cc0b640c8c70905bb5016d1040
parents 66f4fc1e 03262f25
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -178,6 +178,7 @@ public final class NotificationEntry extends ListEntry {
    private int mBucket = BUCKET_ALERTING;
    private int mBucket = BUCKET_ALERTING;
    @Nullable private Long mPendingAnimationDuration;
    @Nullable private Long mPendingAnimationDuration;
    private boolean mIsMarkedForUserTriggeredMovement;
    private boolean mIsMarkedForUserTriggeredMovement;
    private boolean mShelfIconVisible;


    /**
    /**
     * @param sbn the StatusBarNotification from system server
     * @param sbn the StatusBarNotification from system server
@@ -431,6 +432,7 @@ public final class NotificationEntry extends ListEntry {
    //TODO: This will go away when we have a way to bind an entry to a row
    //TODO: This will go away when we have a way to bind an entry to a row
    public void setRow(ExpandableNotificationRow row) {
    public void setRow(ExpandableNotificationRow row) {
        this.row = row;
        this.row = row;
        updateShelfIconVisibility();
    }
    }


    public ExpandableNotificationRowController getRowController() {
    public ExpandableNotificationRowController getRowController() {
@@ -951,6 +953,18 @@ public final class NotificationEntry extends ListEntry {
        return mIsMarkedForUserTriggeredMovement;
        return mIsMarkedForUserTriggeredMovement;
    }
    }


    /** Whether or not the icon for this notification is visible in the shelf. */
    public void setShelfIconVisible(boolean shelfIconVisible) {
        mShelfIconVisible = shelfIconVisible;
        updateShelfIconVisibility();
    }

    private void updateShelfIconVisibility() {
        if (row != null) {
            row.setShelfIconVisible(mShelfIconVisible);
        }
    }

    /**
    /**
     * Mark this entry for movement triggered by a user action (ex: changing the priorirty of a
     * Mark this entry for movement triggered by a user action (ex: changing the priorirty of a
     * conversation). This can then be used for custom animations.
     * conversation). This can then be used for custom animations.
+2 −4
Original line number Original line Diff line number Diff line
@@ -96,13 +96,11 @@ class IconManager @Inject constructor(
        val shelfIcon = iconBuilder.createIconView(entry)
        val shelfIcon = iconBuilder.createIconView(entry)
        shelfIcon.scaleType = ImageView.ScaleType.CENTER_INSIDE
        shelfIcon.scaleType = ImageView.ScaleType.CENTER_INSIDE


        shelfIcon.visibility = View.INVISIBLE
        // TODO: This doesn't belong here
        // TODO: This doesn't belong here
        shelfIcon.setOnVisibilityChangedListener { newVisibility: Int ->
        shelfIcon.setOnVisibilityChangedListener { newVisibility: Int ->
            if (entry.row != null) {
            entry.setShelfIconVisible(newVisibility == View.VISIBLE)
                entry.row.setShelfIconVisible(newVisibility == View.VISIBLE)
            }
        }
        }
        shelfIcon.visibility = View.INVISIBLE


        // Construct the aod icon view.
        // Construct the aod icon view.
        val aodIcon = iconBuilder.createIconView(entry)
        val aodIcon = iconBuilder.createIconView(entry)