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.credentialmanager.common.ui
18 
19 import androidx.compose.foundation.layout.Arrangement
20 import androidx.compose.foundation.layout.Row
21 import androidx.compose.foundation.layout.fillMaxWidth
22 import androidx.compose.foundation.layout.size
23 import androidx.compose.foundation.layout.wrapContentHeight
24 import androidx.compose.material3.Icon
25 import androidx.compose.material3.MaterialTheme
26 import androidx.compose.runtime.Composable
27 import androidx.compose.ui.Modifier
28 import androidx.compose.ui.graphics.Color
29 import androidx.compose.ui.graphics.ImageBitmap
30 import androidx.compose.ui.graphics.painter.Painter
31 import androidx.compose.ui.graphics.vector.ImageVector
32 import androidx.compose.ui.unit.dp
33 
34 /** Tinted primary; centered; 32X32. */
35 @Composable
36 fun HeadlineIcon(bitmap: ImageBitmap, tint: Color? = null) {
37     Row(
38         horizontalArrangement = Arrangement.Center,
39         modifier = Modifier.fillMaxWidth().wrapContentHeight(),
40     ) {
41         Icon(
42             modifier = Modifier.size(32.dp),
43             bitmap = bitmap,
44             tint = tint ?: MaterialTheme.colorScheme.primary,
45             // Decorative purpose only.
46             contentDescription = null,
47         )
48     }
49 }
50 
51 @Composable
52 fun HeadlineIcon(imageVector: ImageVector) {
53     Row(
54         horizontalArrangement = Arrangement.Center,
55         modifier = Modifier.fillMaxWidth().wrapContentHeight(),
56     ) {
57         Icon(
58             modifier = Modifier.size(32.dp),
59             imageVector = imageVector,
60             tint = MaterialTheme.colorScheme.primary,
61             // Decorative purpose only.
62             contentDescription = null,
63         )
64     }
65 }
66 
67 @Composable
68 fun HeadlineIcon(painter: Painter) {
69     Row(
70         horizontalArrangement = Arrangement.Center,
71         modifier = Modifier.fillMaxWidth().wrapContentHeight(),
72     ) {
73         Icon(
74             modifier = Modifier.size(32.dp),
75             painter = painter,
76             tint = MaterialTheme.colorScheme.primary,
77             // Decorative purpose only.
78             contentDescription = null,
79         )
80     }
81 }