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 26 class IntraBlueprintTransition( 27 config: IntraBlueprintTransition.Config, 28 clockViewModel: KeyguardClockViewModel, 29 smartspaceViewModel: KeyguardSmartspaceViewModel, 30 ) : TransitionSet() { 31 32 enum class Type( 33 val priority: Int, 34 val animateNotifChanges: Boolean, 35 ) { 36 ClockSize(100, true), 37 ClockCenter(99, false), 38 DefaultClockStepping(98, false), 39 SmartspaceVisibility(2, true), 40 DefaultTransition(1, false), 41 // When transition between blueprint, we don't need any duration or interpolator but we need 42 // all elements go to correct state 43 NoTransition(0, false), 44 } 45 46 data class Config( 47 val type: Type, 48 val checkPriority: Boolean = true, 49 val terminatePrevious: Boolean = true, 50 val rebuildSections: List<KeyguardSection> = listOf(), 51 ) { 52 companion object { 53 val DEFAULT = Config(Type.NoTransition) 54 } 55 } 56 57 init { 58 ordering = ORDERING_TOGETHER 59 when (config.type) { 60 Type.NoTransition -> {} 61 Type.DefaultClockStepping -> 62 addTransition( <lambda>null63 clockViewModel.currentClock.value?.let { DefaultClockSteppingTransition(it) } 64 ) 65 else -> addTransition(ClockSizeTransition(config, clockViewModel)) 66 } 67 } 68 } 69