Skip to content

Commit 76355e1

Browse files
committed
Preview更新
1 parent 22ca5d8 commit 76355e1

1 file changed

Lines changed: 74 additions & 5 deletions

File tree

  • AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license

AndroidApp/ui/src/main/kotlin/me/nya_n/notificationnotifier/ui/screen/license/LicenseScreen.kt

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ import androidx.compose.ui.graphics.Color
1616
import androidx.compose.ui.tooling.preview.Preview
1717
import androidx.compose.ui.unit.dp
1818
import androidx.navigation.NavController
19-
import androidx.navigation.compose.rememberNavController
19+
import com.mikepenz.aboutlibraries.Libs
20+
import com.mikepenz.aboutlibraries.entity.Developer
21+
import com.mikepenz.aboutlibraries.entity.Library
22+
import com.mikepenz.aboutlibraries.entity.License
23+
import com.mikepenz.aboutlibraries.entity.Scm
2024
import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
2125
import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries
2226
import com.mikepenz.aboutlibraries.ui.compose.m3.LibrariesContainer
@@ -28,11 +32,24 @@ import me.nya_n.notificationnotifier.ui.theme.AppTheme
2832
fun LicenseScreen(navController: NavController) {
2933
val snackbarHostState = remember { SnackbarHostState() }
3034
val libraries by produceLibraries()
31-
AppScaffold(
35+
LicenseContent(
3236
snackbarHostState = snackbarHostState,
37+
libraries = libraries,
3338
onBack = {
3439
navController.popBackStack()
3540
}
41+
)
42+
}
43+
44+
@Composable
45+
fun LicenseContent(
46+
snackbarHostState: SnackbarHostState,
47+
libraries: Libs?,
48+
onBack: () -> Unit
49+
) {
50+
AppScaffold(
51+
snackbarHostState = snackbarHostState,
52+
onBack = onBack
3653
) {
3754
LibrariesContainer(
3855
libraries,
@@ -58,10 +75,62 @@ fun LicenseScreen(navController: NavController) {
5875
@Preview
5976
@Composable
6077
private fun LicensePreview() {
61-
val navController = rememberNavController()
78+
val snackbarHostState = remember { SnackbarHostState() }
79+
val libs = Libs(
80+
libraries = listOf(
81+
Library(
82+
uniqueId = "sample1",
83+
artifactVersion = "1.2.3",
84+
name = "sample1",
85+
description = "test description",
86+
website = "https://nya-n.me",
87+
developers = listOf(Developer("kani", null)),
88+
organization = null,
89+
scm = Scm(null, null, null),
90+
licenses = setOf(
91+
License(
92+
name = "Apache-2.0",
93+
url = "https://www.apache.org/licenses/LICENSE-2.0",
94+
hash = "abc123hash"
95+
)
96+
)
97+
),
98+
Library(
99+
uniqueId = "sample2",
100+
artifactVersion = null,
101+
name = "sample2",
102+
description = null,
103+
website = null,
104+
developers = listOf(),
105+
organization = null,
106+
scm = Scm(null, null, null),
107+
licenses = setOf(
108+
License(
109+
name = "MIT",
110+
url = "https://opensource.org/licenses/MIT",
111+
hash = "def456hash"
112+
)
113+
),
114+
),
115+
Library(
116+
uniqueId = "sample3",
117+
artifactVersion = null,
118+
name = "sample3",
119+
description = null,
120+
website = null,
121+
developers = listOf(),
122+
organization = null,
123+
scm = null,
124+
licenses = setOf()
125+
)
126+
),
127+
licenses = setOf(),
128+
)
62129
AppTheme {
63-
LicenseScreen(
64-
navController = navController
130+
LicenseContent(
131+
snackbarHostState = snackbarHostState,
132+
libraries = libs,
133+
onBack = { }
65134
)
66135
}
67136
}

0 commit comments

Comments
 (0)