fix: 开放源代码页面使用的 API 过旧
This commit is contained in:
parent
9b245d2d56
commit
be42a5a551
2 changed files with 4 additions and 20 deletions
|
|
@ -7,17 +7,12 @@ import androidx.compose.foundation.lazy.rememberLazyListState
|
|||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.produceState
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import cn.super12138.todo.R
|
||||
import cn.super12138.todo.ui.components.LargeTopAppBarScaffold
|
||||
import cn.super12138.todo.ui.pages.settings.components.licence.LicenceList
|
||||
import com.mikepenz.aboutlibraries.Libs
|
||||
import com.mikepenz.aboutlibraries.util.withContext
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import com.mikepenz.aboutlibraries.ui.compose.android.produceLibraries
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
|
|
@ -32,13 +27,7 @@ fun SettingsAboutLicence(
|
|||
onBack = onNavigateUp,
|
||||
modifier = modifier
|
||||
) { innerPadding ->
|
||||
val context = LocalContext.current
|
||||
|
||||
val libraries = produceState<Libs?>(null) {
|
||||
value = withContext(Dispatchers.IO) {
|
||||
Libs.Builder().withContext(context).build()
|
||||
}
|
||||
}
|
||||
val libraries by produceLibraries(R.raw.aboutlibraries)
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
|
@ -47,7 +36,7 @@ fun SettingsAboutLicence(
|
|||
) {
|
||||
val listState = rememberLazyListState()
|
||||
LicenceList(
|
||||
libraries = libraries.value,
|
||||
libraries = libraries,
|
||||
state = listState
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package cn.super12138.todo.ui.pages.settings.components.licence
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
|
|
@ -45,7 +44,6 @@ fun LicenceItem(
|
|||
Column(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.background(colors.backgroundColor)
|
||||
.clip(shape)
|
||||
.clickable { onClick.invoke() }
|
||||
.padding(libraryPadding.contentPadding)
|
||||
|
|
@ -60,7 +58,6 @@ fun LicenceItem(
|
|||
.padding(padding.namePadding)
|
||||
.weight(1f),
|
||||
style = typography.titleLarge,
|
||||
color = colors.contentColor,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
|
|
@ -70,7 +67,6 @@ fun LicenceItem(
|
|||
version,
|
||||
modifier = Modifier.padding(padding.versionPadding.contentPadding),
|
||||
style = typography.bodyMedium,
|
||||
color = colors.contentColor,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
|
|
@ -79,8 +75,7 @@ fun LicenceItem(
|
|||
if (showAuthor && author.isNotBlank()) {
|
||||
Text(
|
||||
text = author,
|
||||
style = typography.bodyMedium,
|
||||
color = colors.contentColor
|
||||
style = typography.bodyMedium
|
||||
)
|
||||
}
|
||||
if (showLicenseBadges && library.licenses.isNotEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue