• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.statusbar.phone
2 
3 import android.view.View
4 import com.android.systemui.animation.ActivityLaunchAnimator
5 import com.android.systemui.animation.LaunchAnimator
6 
7 /**
8  * A [ActivityLaunchAnimator.Controller] that takes care of collapsing the status bar at the right
9  * time.
10  */
11 class StatusBarLaunchAnimatorController(
12     private val delegate: ActivityLaunchAnimator.Controller,
13     private val centralSurfaces: CentralSurfaces,
14     private val isLaunchForActivity: Boolean = true
<lambda>null15 ) : ActivityLaunchAnimator.Controller by delegate {
16     // Always sync the opening window with the shade, given that we draw a hole punch in the shade
17     // of the same size and position as the opening app to make it visible.
18     override val openingWindowSyncView: View?
19         get() = centralSurfaces.notificationShadeWindowView
20 
21     override fun onIntentStarted(willAnimate: Boolean) {
22         delegate.onIntentStarted(willAnimate)
23         if (willAnimate) {
24             centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(true)
25         } else {
26             centralSurfaces.collapsePanelOnMainThread()
27         }
28     }
29 
30     override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
31         delegate.onLaunchAnimationStart(isExpandingFullyAbove)
32         centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(true)
33         if (!isExpandingFullyAbove) {
34             centralSurfaces.notificationPanelViewController.collapseWithDuration(
35                 ActivityLaunchAnimator.TIMINGS.totalDuration.toInt())
36         }
37     }
38 
39     override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
40         delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
41         centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(false)
42         centralSurfaces.onLaunchAnimationEnd(isExpandingFullyAbove)
43     }
44 
45     override fun onLaunchAnimationProgress(
46         state: LaunchAnimator.State,
47         progress: Float,
48         linearProgress: Float
49     ) {
50         delegate.onLaunchAnimationProgress(state, progress, linearProgress)
51         centralSurfaces.notificationPanelViewController.applyLaunchAnimationProgress(linearProgress)
52     }
53 
54     override fun onLaunchAnimationCancelled(newKeyguardOccludedState: Boolean?) {
55         delegate.onLaunchAnimationCancelled()
56         centralSurfaces.notificationPanelViewController.setIsLaunchAnimationRunning(false)
57         centralSurfaces.onLaunchAnimationCancelled(isLaunchForActivity)
58     }
59 }