• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.android.systemui.statusbar.phone
2 
3 import com.android.systemui.animation.ActivityLaunchAnimator
4 
5 /**
6  * A [ActivityLaunchAnimator.Controller] that takes care of collapsing the status bar at the right
7  * time.
8  */
9 class StatusBarLaunchAnimatorController(
10     private val delegate: ActivityLaunchAnimator.Controller,
11     private val statusBar: StatusBar,
12     private val isLaunchForActivity: Boolean = true
<lambda>null13 ) : ActivityLaunchAnimator.Controller by delegate {
14     override fun onIntentStarted(willAnimate: Boolean) {
15         delegate.onIntentStarted(willAnimate)
16         if (!willAnimate) {
17             statusBar.collapsePanelOnMainThread()
18         }
19     }
20 
21     override fun onLaunchAnimationStart(isExpandingFullyAbove: Boolean) {
22         delegate.onLaunchAnimationStart(isExpandingFullyAbove)
23         statusBar.notificationPanelViewController.setIsLaunchAnimationRunning(true)
24         if (!isExpandingFullyAbove) {
25             statusBar.collapsePanelWithDuration(ActivityLaunchAnimator.ANIMATION_DURATION.toInt())
26         }
27     }
28 
29     override fun onLaunchAnimationEnd(isExpandingFullyAbove: Boolean) {
30         delegate.onLaunchAnimationEnd(isExpandingFullyAbove)
31         statusBar.notificationPanelViewController.setIsLaunchAnimationRunning(false)
32         statusBar.onLaunchAnimationEnd(isExpandingFullyAbove)
33     }
34 
35     override fun onLaunchAnimationProgress(
36         state: ActivityLaunchAnimator.State,
37         progress: Float,
38         linearProgress: Float
39     ) {
40         delegate.onLaunchAnimationProgress(state, progress, linearProgress)
41         statusBar.notificationPanelViewController.applyLaunchAnimationProgress(linearProgress)
42     }
43 
44     override fun onLaunchAnimationCancelled() {
45         delegate.onLaunchAnimationCancelled()
46         statusBar.onLaunchAnimationCancelled(isLaunchForActivity)
47     }
48 }