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

Commit 1fd48811 authored by András Kurucz's avatar András Kurucz
Browse files

Fix Notification group dismissing animations

When dismissing a notification group, keep the notifiication children in their parent to ensure correct animations.

Fixes: 251058695
Fixes: 253266681
Fixes: 254277797

Bug: 259217907

Test: atest ShadeViewDifferTest
Test: atest NotifCollectionTest
Test: atest ExpandableNotificationRowTest
Test: Manually dismiss Notification Groups (both app created groups and
auto-grouped notifs)

Change-Id: Ia5b6e5a1f058b5608896e33d0db2bd5b8fa39667
parent 63cd60ee
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -676,9 +676,6 @@ public final class NotificationEntry extends ListEntry {
        return row != null && row.areChildrenExpanded();
    }

    public boolean keepInParent() {
        return row != null && row.keepInParent();
    }

    //TODO: probably less confusing to say "is group fully visible"
    public boolean isGroupNotFullyVisible() {
@@ -698,10 +695,6 @@ public final class NotificationEntry extends ListEntry {
        return row != null && row.isSummaryWithChildren();
    }

    public void setKeepInParent(boolean keep) {
        if (row != null) row.setKeepInParent(keep);
    }

    public void onDensityOrFontScaleChanged() {
        if (row != null) row.onDensityOrFontScaleChanged();
    }
+4 −0
Original line number Diff line number Diff line
@@ -55,4 +55,8 @@ class MediaContainerController @Inject constructor(

    override val view: View
        get() = mediaContainerView!!

    override fun offerToKeepInParentForAnimation(): Boolean = false
    override fun removeFromParentIfKeptForAnimation(): Boolean = false
    override fun resetKeepInParentForAnimation() {}
}
 No newline at end of file
+23 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import java.lang.StringBuilder
 * below.
 */
interface NodeController {

    /** A string that uniquely(ish) represents the node in the tree. Used for debugging. */
    val nodeLabel: String

@@ -64,6 +65,27 @@ interface NodeController {

    /** Called when this view has been removed */
    fun onViewRemoved() {}

    /**
     * Called before removing a node from its parent
     *
     * If returned true, the ShadeViewDiffer won't detach this row and the view system is
     * responsible for ensuring the row is in eventually removed from the parent.
     *
     * @return false to opt out from this feature
     */
    fun offerToKeepInParentForAnimation(): Boolean

    /**
     * Called before a node is reattached. Removes the view from its parent
     * if it was flagged to be kept before.
     *
     * @return whether it did a removal
     */
    fun removeFromParentIfKeptForAnimation(): Boolean

    /** Called when a node is being reattached */
    fun resetKeepInParentForAnimation()
}

/**
@@ -90,7 +112,7 @@ fun treeSpecToStr(tree: NodeSpec): String {
}

private fun treeSpecToStrHelper(tree: NodeSpec, sb: StringBuilder, indent: String) {
    sb.append("${indent}{${tree.controller.nodeLabel}}\n")
    sb.append("$indent{${tree.controller.nodeLabel}}\n")
    if (tree.children.isNotEmpty()) {
        val childIndent = "$indent  "
        for (child in tree.children) {
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ class RootNodeController(
    override val view: View
) : NodeController, PipelineDumpable {
    override val nodeLabel: String = "<root>"
    override fun offerToKeepInParentForAnimation(): Boolean = false
    override fun removeFromParentIfKeptForAnimation(): Boolean = false
    override fun resetKeepInParentForAnimation() {}

    override fun getChildAt(index: Int): View? {
        return listContainer.getContainerChildAt(index)
+3 −0
Original line number Diff line number Diff line
@@ -100,4 +100,7 @@ internal class SectionHeaderNodeControllerImpl @Inject constructor(

    override val view: View
        get() = _view!!
    override fun offerToKeepInParentForAnimation(): Boolean = false
    override fun removeFromParentIfKeptForAnimation(): Boolean = false
    override fun resetKeepInParentForAnimation() {}
}
 No newline at end of file
Loading