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

Commit 96aa1654 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Remove divider height before first view in shade" into tm-dev

parents d8320ce1 bef187f9
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ constructor(
    private var maxKeyguardNotifications by notNull<Int>()

    /** Minimum space between two notifications, see [calculateGapAndDividerHeight]. */
    private var dividerHeight by notNull<Int>()
    private var dividerHeight by notNull<Float>()

    init {
        updateResources()
@@ -142,9 +142,13 @@ constructor(
                if (i == children.lastIndex) {
                    0f // No shelf needed.
                } else {
                    val firstViewInShelfIndex = i + 1
                    val spaceBeforeShelf =
                        calculateGapAndDividerHeight(
                            stack, previous = currentNotification, current = children[i + 1], i)
                            stack,
                            previous = currentNotification,
                            current = children[firstViewInShelfIndex],
                            currentIndex = firstViewInShelfIndex)
                    spaceBeforeShelf + shelfIntrinsicHeight
                }

@@ -156,7 +160,8 @@ constructor(
        maxKeyguardNotifications =
            infiniteIfNegative(resources.getInteger(R.integer.keyguard_max_notification_count))

        dividerHeight = max(1, resources.getDimensionPixelSize(R.dimen.notification_divider_height))
        dividerHeight =
            max(1f, resources.getDimensionPixelSize(R.dimen.notification_divider_height).toFloat())
    }

    private val NotificationStackScrollLayout.childrenSequence: Sequence<ExpandableView>
@@ -164,8 +169,8 @@ constructor(

    @VisibleForTesting
    fun onLockscreen(): Boolean {
        return statusBarStateController.state == KEYGUARD
                && lockscreenShadeTransitionController.fractionToShade == 0f
        return statusBarStateController.state == KEYGUARD &&
            lockscreenShadeTransitionController.fractionToShade == 0f
    }

    @VisibleForTesting
@@ -207,11 +212,12 @@ constructor(
        stack: NotificationStackScrollLayout,
        previous: ExpandableView?,
        current: ExpandableView?,
        visibleIndex: Int
        currentIndex: Int
    ): Float {
        var height = stack.calculateGapHeight(previous, current, visibleIndex)
        height += dividerHeight
        return height
        if (currentIndex == 0) {
            return 0f
        }
        return stack.calculateGapHeight(previous, current, currentIndex) + dividerHeight
    }

    private fun NotificationStackScrollLayout.showableChildren() =
+5 −7
Original line number Diff line number Diff line
@@ -125,8 +125,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
        // Each row in separate section.
        setGapHeight(gapHeight)
        val spaceUsed =
            listOf(
                    dividerHeight + rowHeight,
            listOf(rowHeight,
                    dividerHeight + gapHeight + rowHeight,
                    dividerHeight + gapHeight + shelfHeight)
                .sum()
@@ -149,8 +148,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {
        val rowHeight = rowHeight
        val shelfHeight = shelfHeight
        val spaceUsed =
            listOf(
                dividerHeight + rowHeight,
            listOf(rowHeight,
                    dividerHeight + shelfHeight)
                .sum()
        val availableSpace = spaceUsed + 1
@@ -195,7 +193,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {

        val space = sizeCalculator.spaceNeeded(expandableView, visibleIndex = 0,
                previousView = null, stack = stackLayout, onLockscreen = true)
        assertThat(space).isEqualTo(5 + dividerHeight)
        assertThat(space).isEqualTo(5)
    }

    @Test
@@ -209,7 +207,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() {

        val space = sizeCalculator.spaceNeeded(expandableView, visibleIndex = 0,
                previousView = null, stack = stackLayout, onLockscreen = false)
        assertThat(space).isEqualTo(10 + dividerHeight)
        assertThat(space).isEqualTo(10)
    }

    private fun computeMaxKeyguardNotifications(