| author | Da Risk <da_risk@geekorum.com> |
| Thu, 01 May 2025 20:41:08 -0400 | |
| changeset 68 | f6133d9381b2 |
| parent 47 | 246422783c0c |
| child 89 | 0cc872a9edbf |
| 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 |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
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
|
38 |
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
|
39 |
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
|
40 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
41 |
@Composable |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
42 |
fun SampleApp( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
43 |
onMaterial2Click: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
44 |
onMaterial3Click: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
45 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
46 |
Surface( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
47 |
modifier = Modifier.fillMaxSize(), |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
48 |
color = MaterialTheme.colorScheme.background |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
49 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
50 |
Column(Modifier.fillMaxSize()) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
51 |
LaunchActivitySection(onMaterial2Click, onMaterial3Click) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
52 |
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
|
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 |
} |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
56 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
57 |
@Composable |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
58 |
private fun LaunchActivitySection( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
59 |
onMaterial2Click: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
60 |
onMaterial3Click: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
61 |
modifier: Modifier = Modifier |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
62 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
63 |
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
|
64 |
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
|
65 |
Row( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
66 |
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
|
67 |
.fillMaxWidth() |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
68 |
.padding(32.dp) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
69 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
70 |
Material2Card(onClick = onMaterial2Click) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
71 |
Material3Card(onClick = onMaterial3Click) |
|
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 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
76 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
77 |
@Composable |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
78 |
@OptIn(ExperimentalMaterial3Api::class) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
79 |
private fun Material2Card( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
80 |
onClick: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
81 |
modifier: Modifier = Modifier |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
82 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
83 |
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
|
84 |
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
|
85 |
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
|
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 |
} |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
89 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
90 |
@Composable |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
91 |
@OptIn(ExperimentalMaterial3Api::class) |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
92 |
private fun Material3Card( |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
93 |
onClick: () -> Unit, |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
94 |
modifier: Modifier = Modifier |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
95 |
) {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
96 |
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
|
97 |
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
|
98 |
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
|
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 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
103 |
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
104 |
@Preview |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
105 |
@Composable |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
106 |
fun LauncherActivitySectionPreview() {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
107 |
AboutOssTheme {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
108 |
Surface {
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
109 |
LaunchActivitySection(onMaterial2Click = {}, onMaterial3Click = {})
|
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
110 |
} |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
111 |
} |
|
246422783c0c
sample: extract base of sample to common. start implementing desktop
Da Risk <da_risk@geekorum.com>
parents:
diff
changeset
|
112 |
} |