| author | Da Risk <da_risk@geekorum.com> | 
| Tue, 06 May 2025 12:55:03 -0400 | |
| changeset 89 | 0cc872a9edbf | 
| parent 47 | 246422783c0c | 
| permissions | -rw-r--r-- | 
| 
47
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
1  | 
/*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
2  | 
* AboutOss is an utility library to retrieve and display  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
3  | 
* opensource licenses in Android applications.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
4  | 
*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
5  | 
* Copyright (C) 2023-2025 by Frederic-Charles Barthelery.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
6  | 
*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
7  | 
* This file is part of AboutOss.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
8  | 
*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
9  | 
* AboutOss is free software: you can redistribute it and/or modify  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
10  | 
* it under the terms of the GNU General Public License as published by  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
11  | 
* the Free Software Foundation, either version 3 of the License, or  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
12  | 
* (at your option) any later version.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
13  | 
*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
14  | 
* AboutOss is distributed in the hope that it will be useful,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
15  | 
* but WITHOUT ANY WARRANTY; without even the implied warranty of  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
16  | 
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
17  | 
* GNU General Public License for more details.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
18  | 
*  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
19  | 
* You should have received a copy of the GNU General Public License  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
20  | 
* along with AboutOss. If not, see <http://www.gnu.org/licenses/>.  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
21  | 
*/  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
22  | 
package com.geekorum.aboutoss.sampleapp  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
23  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
24  | 
import androidx.compose.foundation.layout.Arrangement  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
25  | 
import androidx.compose.foundation.layout.Column  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
26  | 
import androidx.compose.foundation.layout.Row  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
27  | 
import androidx.compose.foundation.layout.fillMaxSize  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
28  | 
import androidx.compose.foundation.layout.fillMaxWidth  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
29  | 
import androidx.compose.foundation.layout.padding  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
30  | 
import androidx.compose.material3.Card  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
31  | 
import androidx.compose.material3.ExperimentalMaterial3Api  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
32  | 
import androidx.compose.material3.MaterialTheme  | 
| 
89
 
0cc872a9edbf
sample: make android sample edge to edge and target sdk 35
 
Da Risk <da_risk@geekorum.com> 
parents: 
47 
diff
changeset
 | 
33  | 
import androidx.compose.material3.Scaffold  | 
| 
47
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
34  | 
import androidx.compose.material3.Surface  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
35  | 
import androidx.compose.material3.Text  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
36  | 
import androidx.compose.runtime.Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
37  | 
import androidx.compose.ui.Modifier  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
38  | 
import androidx.compose.ui.unit.dp  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
39  | 
import com.geekorum.aboutoss.sampleapp.ui.theme.AboutOssTheme  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
40  | 
import org.jetbrains.compose.ui.tooling.preview.Preview  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
41  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
42  | 
@Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
43  | 
fun SampleApp(  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
44  | 
onMaterial2Click: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
45  | 
onMaterial3Click: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
46  | 
) {
 | 
| 
89
 
0cc872a9edbf
sample: make android sample edge to edge and target sdk 35
 
Da Risk <da_risk@geekorum.com> 
parents: 
47 
diff
changeset
 | 
47  | 
    Scaffold {
 | 
| 
 
0cc872a9edbf
sample: make android sample edge to edge and target sdk 35
 
Da Risk <da_risk@geekorum.com> 
parents: 
47 
diff
changeset
 | 
48  | 
        Column(Modifier.fillMaxSize().padding(it)) {
 | 
| 
47
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
49  | 
LaunchActivitySection(onMaterial2Click, onMaterial3Click)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
50  | 
CustomViewer(modifier = Modifier.padding(horizontal = 16.dp))  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
51  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
52  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
53  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
54  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
55  | 
@Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
56  | 
private fun LaunchActivitySection(  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
57  | 
onMaterial2Click: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
58  | 
onMaterial3Click: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
59  | 
modifier: Modifier = Modifier  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
60  | 
) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
61  | 
    Column(modifier.padding(16.dp)) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
62  | 
Text(text = "This section launch a new activity to display licences information")  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
63  | 
Row(  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
64  | 
horizontalArrangement = Arrangement.SpaceAround, modifier = Modifier  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
65  | 
.fillMaxWidth()  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
66  | 
.padding(32.dp)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
67  | 
        ) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
68  | 
Material2Card(onClick = onMaterial2Click)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
69  | 
Material3Card(onClick = onMaterial3Click)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
70  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
71  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
72  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
73  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
74  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
75  | 
@Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
76  | 
@OptIn(ExperimentalMaterial3Api::class)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
77  | 
private fun Material2Card(  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
78  | 
onClick: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
79  | 
modifier: Modifier = Modifier  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
80  | 
) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
81  | 
    Card(modifier = modifier, onClick = onClick) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
82  | 
        Column(Modifier.padding(16.dp)) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
83  | 
            Text("Material2 UI", style = MaterialTheme.typography.labelLarge)
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
84  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
85  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
86  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
87  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
88  | 
@Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
89  | 
@OptIn(ExperimentalMaterial3Api::class)  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
90  | 
private fun Material3Card(  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
91  | 
onClick: () -> Unit,  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
92  | 
modifier: Modifier = Modifier  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
93  | 
) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
94  | 
    Card(modifier = modifier, onClick = onClick) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
95  | 
        Column(Modifier.padding(16.dp)) {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
96  | 
            Text("Material3 UI", style = MaterialTheme.typography.labelLarge)
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
97  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
98  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
99  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
100  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
101  | 
|
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
102  | 
@Preview  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
103  | 
@Composable  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
104  | 
fun LauncherActivitySectionPreview() {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
105  | 
    AboutOssTheme {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
106  | 
        Surface {
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
107  | 
            LaunchActivitySection(onMaterial2Click = {}, onMaterial3Click = {})
 | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
108  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
109  | 
}  | 
| 
 
246422783c0c
sample: extract base of sample to common. start implementing desktop
 
Da Risk <da_risk@geekorum.com> 
parents:  
diff
changeset
 | 
110  | 
}  |