• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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.bouncer.shared.constants
18 
19 import com.android.app.animation.Interpolators
20 import com.android.internal.R.color as colors
21 import com.android.systemui.Flags
22 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND
23 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BACKGROUND_PRESSED
24 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_BUTTON
25 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_KEY
26 import com.android.systemui.bouncer.shared.constants.KeyguardBouncerConstants.ColorId.NUM_PAD_PRESSED
27 import com.android.systemui.res.R
28 
29 object KeyguardBouncerConstants {
30     /**
31      * Values for the bouncer expansion represented as the panel expansion. Panel expansion 1f =
32      * panel fully showing = bouncer fully hidden Panel expansion 0f = panel fully hiding = bouncer
33      * fully showing
34      */
35     const val EXPANSION_HIDDEN = 1f
36     const val EXPANSION_VISIBLE = 0f
37     const val ALPHA_EXPANSION_THRESHOLD = 0.95f
38 
39     /**
40      * This value is used for denoting the PIN length at which we want to layout the view in which
41      * PIN hinting is enabled
42      */
43     const val DEFAULT_PIN_LENGTH = 6
44 
45     object ColorId {
46         private const val DEPRECATION_MSG =
47             "Colors will not be used after bouncerUiRevamp2 flag is launched"
48 
49         @Deprecated(DEPRECATION_MSG)
50         const val TITLE = com.android.internal.R.color.materialColorOnSurface
51 
52         @Deprecated(DEPRECATION_MSG)
53         const val PIN_SHAPES = com.android.internal.R.color.materialColorOnSurfaceVariant
54 
55         @Deprecated(DEPRECATION_MSG)
56         const val NUM_PAD_BACKGROUND =
57             com.android.internal.R.color.materialColorSurfaceContainerHigh
58 
59         @Deprecated(DEPRECATION_MSG)
60         const val NUM_PAD_BACKGROUND_PRESSED =
61             com.android.internal.R.color.materialColorPrimaryFixed
62 
63         @Deprecated(DEPRECATION_MSG)
64         const val NUM_PAD_PRESSED = com.android.internal.R.color.materialColorOnPrimaryFixed
65 
66         @Deprecated(DEPRECATION_MSG)
67         const val NUM_PAD_KEY = com.android.internal.R.color.materialColorOnSurface
68 
69         @Deprecated(DEPRECATION_MSG)
70         const val NUM_PAD_BUTTON = com.android.internal.R.color.materialColorOnSecondaryFixed
71 
72         @Deprecated(DEPRECATION_MSG)
73         const val EMERGENCY_BUTTON = com.android.internal.R.color.materialColorTertiaryFixed
74     }
75 
76     object Color {
77         @JvmField val actionButtonText = colors.materialColorOnSecondaryContainer
78         @JvmField val actionButtonBg = colors.materialColorSecondaryContainer
79     }
80 }
81 
cnull82 private fun <T> c(old: T, new: T): T {
83     return if (Flags.bouncerUiRevamp2()) {
84         new
85     } else {
86         old
87     }
88 }
89 
90 object PatternBouncerConstants {
91     object ColorId {
92         @JvmField val dotColor = colors.materialColorOnSurfaceVariant
93         @JvmField val activatedDotColor = colors.materialColorOnPrimary
94         @JvmField val pathColor = colors.materialColorPrimary
95     }
96 }
97 
98 object PinBouncerConstants {
99     @JvmField
100     val pinShapes = c(old = R.array.bouncer_pin_shapes, new = R.array.updated_bouncer_pin_shapes)
101     @JvmField
102     val pinDotAvd = c(old = R.drawable.pin_dot_avd, new = R.drawable.bouncer_shape_outline)
103     @JvmField
104     val pinDeleteAvd = c(old = R.drawable.pin_dot_delete_avd, new = R.drawable.bouncer_shape_delete)
105 
106     object Color {
107         @JvmField val hintDot = colors.materialColorOnSurfaceVariant
108         @JvmField val shape = colors.materialColorPrimary
109         @JvmField val digit = c(old = NUM_PAD_KEY, new = colors.materialColorOnSurface)
110         @JvmField
111         val digitPressed = c(old = NUM_PAD_PRESSED, new = colors.materialColorOnPrimaryContainer)
112         @JvmField
113         val digitBg = c(old = NUM_PAD_BACKGROUND, colors.materialColorSurfaceContainerHigh)
114         @JvmField
115         val bgPressed = c(old = NUM_PAD_BACKGROUND_PRESSED, colors.materialColorPrimaryContainer)
116         @JvmField
117         val actionWithAutoConfirm = c(old = NUM_PAD_KEY, new = colors.materialColorOnSurface)
118         @JvmField val action = c(old = NUM_PAD_BUTTON, new = colors.materialColorOnSecondary)
119         @JvmField
120         val actionBg = c(old = colors.materialColorSecondaryFixedDim, colors.materialColorSecondary)
121     }
122 
123     object Animation {
124         @JvmField val expansionDuration = c(old = 100, new = 33)
125         @JvmField val expansionColorDuration = c(old = 50, new = expansionDuration)
126         @JvmField
127         val expansionInterpolator = c(old = Interpolators.LINEAR, new = Interpolators.LINEAR)!!
128 
129         @JvmField val contractionDuration = c(old = 417, new = 300)
130         @JvmField val contractionStartDelay = c(old = 33, new = 0)
131         @JvmField
132         val contractionRadiusInterpolator =
133             c(old = Interpolators.FAST_OUT_SLOW_IN, new = Interpolators.STANDARD)!!
134         @JvmField
135         val contractionColorInterpolator =
136             c(old = Interpolators.LINEAR, new = Interpolators.STANDARD)!!
137 
138         const val pressedTextScaleX = 1.35f
139         const val normalTextScaleX = 1.0f
140     }
141 }
142