• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.keyguard.ui.view.layout.blueprints.transitions
18 
19 import android.transition.TransitionSet
20 import com.android.systemui.keyguard.shared.model.KeyguardSection
21 import com.android.systemui.keyguard.ui.view.layout.sections.transitions.ClockSizeTransition
22 import com.android.systemui.keyguard.ui.view.layout.sections.transitions.DefaultClockSteppingTransition
23 import com.android.systemui.keyguard.ui.viewmodel.KeyguardClockViewModel
24 import com.android.systemui.keyguard.ui.viewmodel.KeyguardSmartspaceViewModel
25 import com.android.systemui.log.LogBuffer
26 
27 class IntraBlueprintTransition(
28     config: IntraBlueprintTransition.Config,
29     clockViewModel: KeyguardClockViewModel,
30     smartspaceViewModel: KeyguardSmartspaceViewModel,
31     logBuffer: LogBuffer,
32 ) : TransitionSet() {
33 
34     enum class Type(val priority: Int, val animateNotifChanges: Boolean) {
35         ClockSize(100, true),
36         ClockCenter(99, false),
37         DefaultClockStepping(98, false),
38         SmartspaceVisibility(3, true),
39         DefaultTransition(2, false),
40         // When transition between blueprint, we don't need any duration or interpolator but we need
41         // all elements go to correct state
42         NoTransition(1, false),
43         // Similar to NoTransition, except also does not explicitly update any alpha. Used in
44         // OFF->LOCKSCREEN transition
45         Init(0, false),
46     }
47 
48     data class Config(
49         val type: Type,
50         val checkPriority: Boolean = true,
51         val terminatePrevious: Boolean = true,
52         val rebuildSections: List<KeyguardSection> = listOf(),
53     ) {
54         companion object {
55             val DEFAULT = Config(Type.NoTransition)
56         }
57     }
58 
59     init {
60         ordering = ORDERING_TOGETHER
61         when (config.type) {
62             Type.Init -> {}
63             Type.NoTransition -> {}
64             Type.DefaultClockStepping ->
65                 addTransition(
<lambda>null66                     clockViewModel.currentClock.value?.let { DefaultClockSteppingTransition(it) }
67                 )
68             else -> addTransition(ClockSizeTransition(config, clockViewModel, logBuffer))
69         }
70     }
71 }
72