1 /* <lambda>null2 * 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.keyguard.ui.composable.blueprint 18 19 import androidx.compose.ui.layout.HorizontalAlignmentLine 20 import androidx.compose.ui.layout.VerticalAlignmentLine 21 import kotlin.math.max 22 import kotlin.math.min 23 24 /** 25 * Encapsulates all blueprint alignment lines. 26 * 27 * These can be used to communicate alignment lines emitted by elements that the blueprint should 28 * consume and use to know how to constrain and/or place other elements in that blueprint. 29 * 30 * For more information, please see 31 * [the official documentation](https://developer.android.com/jetpack/compose/layouts/alignment-lines). 32 */ 33 object BlueprintAlignmentLines { 34 35 /** 36 * Encapsulates alignment lines produced by the lock icon element. 37 * 38 * Because the lock icon is also the same element as the under-display fingerprint sensor 39 * (UDFPS), blueprints should use its alignment lines to make sure that other elements on screen 40 * do not overlap with the lock icon. 41 */ 42 object LockIcon { 43 44 /** The left edge of the lock icon. */ 45 val Left = 46 VerticalAlignmentLine( 47 merger = { old, new -> 48 // When two left alignment line values are provided, choose the leftmost one: 49 min(old, new) 50 }, 51 ) 52 53 /** The top edge of the lock icon. */ 54 val Top = 55 HorizontalAlignmentLine( 56 merger = { old, new -> 57 // When two top alignment line values are provided, choose the topmost one: 58 min(old, new) 59 }, 60 ) 61 62 /** The right edge of the lock icon. */ 63 val Right = 64 VerticalAlignmentLine( 65 merger = { old, new -> 66 // When two right alignment line values are provided, choose the rightmost one: 67 max(old, new) 68 }, 69 ) 70 71 /** The bottom edge of the lock icon. */ 72 val Bottom = 73 HorizontalAlignmentLine( 74 merger = { old, new -> 75 // When two bottom alignment line values are provided, choose the bottommost 76 // one: 77 max(old, new) 78 }, 79 ) 80 } 81 } 82