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

Commit 1ad38e26 authored by Michał Brzeziński's avatar Michał Brzeziński Committed by Android (Google) Code Review
Browse files

Merge "Collapsing shade when user clicks on shade_header_system_icons from...

Merge "Collapsing shade when user clicks on shade_header_system_icons from shade header" into udc-qpr-dev
parents cfcb3663 2b97d96a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1076,6 +1076,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

        mTapAgainViewController.init();
        mShadeHeaderController.init();
        mShadeHeaderController.setShadeCollapseAction(
                () -> collapse(/* delayed= */ false , /* speedUpFactor= */ 1.0f));
        mKeyguardUnfoldTransition.ifPresent(u -> u.setup(mView));
        mNotificationPanelUnfoldAnimationController.ifPresent(controller ->
                controller.setup(mNotificationContainerParent));
+4 −0
Original line number Diff line number Diff line
@@ -122,6 +122,8 @@ constructor(
            }
    }

    var shadeCollapseAction: Runnable? = null

    private lateinit var iconManager: StatusBarIconController.TintedIconManager
    private lateinit var carrierIconSlots: List<String>
    private lateinit var mShadeCarrierGroupController: ShadeCarrierGroupController
@@ -469,9 +471,11 @@ constructor(
        if (largeScreenActive) {
            logInstantEvent("Large screen constraints set")
            header.setTransition(LARGE_SCREEN_HEADER_TRANSITION_ID)
            systemIcons.setOnClickListener { shadeCollapseAction?.run() }
        } else {
            logInstantEvent("Small screen constraints set")
            header.setTransition(HEADER_TRANSITION_ID)
            systemIcons.setOnClickListener(null)
        }
        header.jumpToState(header.startState)
        updatePosition()
+14 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.view.DisplayCutout
import android.view.View
import android.view.ViewPropertyAnimator
import android.view.WindowInsets
import android.widget.LinearLayout
import android.widget.TextView
import androidx.constraintlayout.motion.widget.MotionLayout
import androidx.constraintlayout.widget.ConstraintSet
@@ -127,6 +128,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
    var viewVisibility = View.GONE
    var viewAlpha = 1f

    private val systemIcons = LinearLayout(context)
    private lateinit var shadeHeaderController: ShadeHeaderController
    private lateinit var carrierIconSlots: List<String>
    private val configurationController = FakeConfigurationController()
@@ -146,6 +148,7 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
            .thenReturn(batteryMeterView)

        whenever<StatusIconContainer>(view.findViewById(R.id.statusIcons)).thenReturn(statusIcons)
        whenever<View>(view.findViewById(R.id.shade_header_system_icons)).thenReturn(systemIcons)

        viewContext = Mockito.spy(context)
        whenever(view.context).thenReturn(viewContext)
@@ -450,6 +453,17 @@ class ShadeHeaderControllerTest : SysuiTestCase() {
        verify(view).setTransition(ShadeHeaderController.HEADER_TRANSITION_ID)
    }

    @Test
    fun testLargeScreenActive_collapseActionRun_onSystemIconsClick() {
        shadeHeaderController.largeScreenActive = true
        var wasRun = false
        shadeHeaderController.shadeCollapseAction = Runnable { wasRun = true }

        systemIcons.performClick()

        assertThat(wasRun).isTrue()
    }

    @Test
    fun testShadeExpandedFraction() {
        // View needs to be visible for this to actually take effect