diff --git a/aboutlibraries-compose/src/main/AndroidManifest.xml b/aboutlibraries-compose/src/androidMain/AndroidManifest.xml similarity index 100% rename from aboutlibraries-compose/src/main/AndroidManifest.xml rename to aboutlibraries-compose/src/androidMain/AndroidManifest.xml diff --git a/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt b/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt index 2e00a5fd2..bd03a48b2 100644 --- a/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt +++ b/aboutlibraries-compose/src/commonMain/kotlin/com/mikepenz/aboutlibraries/ui/compose/SharedLibraries.kt @@ -3,15 +3,8 @@ package com.mikepenz.aboutlibraries.ui.compose import androidx.compose.foundation.background import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.* -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.LazyListScope -import androidx.compose.foundation.lazy.LazyListState -import androidx.compose.foundation.lazy.items -import androidx.compose.foundation.lazy.rememberLazyListState -import androidx.compose.material.Badge -import androidx.compose.material.MaterialTheme -import androidx.compose.material.Text -import androidx.compose.material.contentColorFor +import androidx.compose.foundation.lazy.* +import androidx.compose.material.* import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable @@ -143,8 +136,10 @@ internal fun Library( contentColor = colors.badgeContentColor, backgroundColor = colors.badgeBackgroundColor ) { - Text(modifier = Modifier.padding(padding.badgeContentPadding), - text = it.name) + Text( + modifier = Modifier.padding(padding.badgeContentPadding), + text = it.name + ) } } } @@ -202,8 +197,10 @@ object LibraryDefaults { fun libraryPadding( namePadding: PaddingValues = PaddingValues(top = LibraryNamePaddingTop), versionPadding: PaddingValues = PaddingValues(start = LibraryVersionPaddingStart), - badgePadding: PaddingValues = PaddingValues(top = LibraryBadgePaddingTop, - end = LibraryBadgePaddingEnd), + badgePadding: PaddingValues = PaddingValues( + top = LibraryBadgePaddingTop, + end = LibraryBadgePaddingEnd + ), badgeContentPadding: PaddingValues = PaddingValues(0.dp), ): LibraryPadding = DefaultLibraryPadding( namePadding = namePadding, diff --git a/aboutlibraries-core/src/main/AndroidManifest.xml b/aboutlibraries-core/src/androidMain/AndroidManifest.xml similarity index 100% rename from aboutlibraries-core/src/main/AndroidManifest.xml rename to aboutlibraries-core/src/androidMain/AndroidManifest.xml diff --git a/app-desktop/build.gradle.kts b/app-desktop/build.gradle.kts index 056ad16ab..533b77443 100644 --- a/app-desktop/build.gradle.kts +++ b/app-desktop/build.gradle.kts @@ -27,7 +27,7 @@ dependencies { } compose { - kotlinCompilerPlugin.set(libs.versions.composeCompiler.get()) + kotlinCompilerPlugin.set(libs.versions.composeCompilerJb.get()) } tasks.withType { diff --git a/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt b/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt index 74c1d5e3d..0a0c68fa5 100644 --- a/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt +++ b/app/src/main/java/com/mikepenz/aboutlibraries/sample/ComposeActivity.kt @@ -6,10 +6,7 @@ import androidx.activity.compose.setContent import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.background import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Build @@ -22,11 +19,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.core.view.WindowCompat -import com.google.accompanist.insets.LocalWindowInsets -import com.google.accompanist.insets.ProvideWindowInsets -import com.google.accompanist.insets.rememberInsetsPaddingValues -import com.google.accompanist.insets.ui.Scaffold -import com.google.accompanist.insets.ui.TopAppBar import com.google.accompanist.systemuicontroller.rememberSystemUiController import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer @@ -55,69 +47,65 @@ fun MainLayout() { MaterialTheme( colors = if (isSystemInDarkTheme()) darkColors() else lightColors() ) { - ProvideWindowInsets { - var showAuthor by remember { mutableStateOf(true) } - var showVersion by remember { mutableStateOf(true) } - var showLicenseBadges by remember { mutableStateOf(true) } - var showHeader by remember { mutableStateOf(false) } + var showAuthor by remember { mutableStateOf(true) } + var showVersion by remember { mutableStateOf(true) } + var showLicenseBadges by remember { mutableStateOf(true) } + var showHeader by remember { mutableStateOf(false) } - Scaffold( - topBar = { - // We use TopAppBar from accompanist-insets-ui which allows us to provide - // content padding matching the system bars insets. - TopAppBar( - title = { Text("Compose Sample") }, - backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.9f), - contentPadding = rememberInsetsPaddingValues( - LocalWindowInsets.current.statusBars, - applyBottom = false, - ), - modifier = Modifier.fillMaxWidth(), - actions = { - IconButton(onClick = { - showAuthor = !showAuthor - }) { Icon(Icons.Default.Person, "Author") } - IconButton(onClick = { - showVersion = !showVersion - }) { Icon(Icons.Default.Build, "Version") } - IconButton(onClick = { showLicenseBadges = !showLicenseBadges }) { - Icon(Icons.Default.List, - "Licenses") - } - IconButton(onClick = { - showHeader = !showHeader - }) { Icon(Icons.Default.Info, "Header") } - } - ) - }, - ) { contentPadding -> - LibrariesContainer( - Modifier - .fillMaxSize() - .padding(top = contentPadding.calculateTopPadding()), - contentPadding = rememberInsetsPaddingValues( - insets = LocalWindowInsets.current.systemBars, + Scaffold( + topBar = { + // We use TopAppBar from accompanist-insets-ui which allows us to provide + // content padding matching the system bars insets. + TopAppBar( + title = { Text("Compose Sample") }, + backgroundColor = MaterialTheme.colors.surface.copy(alpha = 0.9f), + modifier = Modifier.fillMaxWidth().padding( + WindowInsets.statusBars.asPaddingValues() ), - showAuthor = showAuthor, - showVersion = showVersion, - showLicenseBadges = showLicenseBadges, - header = { - if (showHeader) { - stickyHeader { - Column( - modifier = Modifier - .fillMaxWidth() - .background(MaterialTheme.colors.surface) - .padding(vertical = 25.dp), - horizontalAlignment = Alignment.CenterHorizontally, - ) { - Text("ExampleHeader") - } - } + actions = { + IconButton(onClick = { + showAuthor = !showAuthor + }) { Icon(Icons.Default.Person, "Author") } + IconButton(onClick = { + showVersion = !showVersion + }) { Icon(Icons.Default.Build, "Version") } + IconButton(onClick = { showLicenseBadges = !showLicenseBadges }) { + Icon( + Icons.Default.List, + "Licenses" + ) } + IconButton(onClick = { + showHeader = !showHeader + }) { Icon(Icons.Default.Info, "Header") } } ) - } + }, + ) { contentPadding -> + LibrariesContainer( + Modifier + .fillMaxSize() + .padding(top = contentPadding.calculateTopPadding()), + contentPadding = WindowInsets.navigationBars.asPaddingValues(), + showAuthor = showAuthor, + showVersion = showVersion, + showLicenseBadges = showLicenseBadges, + header = { + if (showHeader) { + stickyHeader { + Column( + modifier = Modifier + .fillMaxWidth() + .background(MaterialTheme.colors.surface) + .padding(vertical = 25.dp), + horizontalAlignment = Alignment.CenterHorizontally, + ) { + Text("ExampleHeader") + } + } + } + } + ) } } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index e7748cc7d..dd8b1f7fe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,10 +19,13 @@ org.gradle.jvmargs=-Xmx1536m android.useAndroidX=true # Compile JS for legacy backend and new IR backend. kotlin.js.compiler=both + kotlin.mpp.stability.nowarn=true +kotlin.mpp.androidSourceSetLayoutVersion=2 + android.enableJetifier=false org.gradle.unsafe.configuration-cache=false android.disableAutomaticComponentCreation=true org.jetbrains.compose.experimental.macos.enabled=true -org.jetbrains.compose.experimental.uikit.enabled=true \ No newline at end of file +org.jetbrains.compose.experimental.uikit.enabled=true diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 36477810a..b2de42cd5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -9,13 +9,15 @@ gradleBuild = "7.3.1" buildTools = "33.0.0" # kotlin dokka = "1.7.20" -kotlinCore = { require = "1.7.20" } +kotlinCore = { require = "1.8.0" } kotlinCoroutines = { require = "1.6.4" } kotlinxSerialization = "1.4.0" # compose -compose = "1.3.1" -composeCompiler = "1.3.2" -composejb = "1.3.0-rc01" +compose = "1.3.3" +composeUi = "1.3.1" # foundation / materila +composeCompiler = "1.4.0" +composejb = "1.3.0-rc05" +composeCompilerJb = "1.4.0-rc02" # androidx activity = "1.6.1" cardview = "1.0.0" @@ -25,7 +27,7 @@ lifecycle = { require = "2.5.1" } navigation = "2.5.2" recyclerView = "1.2.1" # google -material = "1.7.0" +material = "1.8.0" # other accompanist = "0.28.0" fastAdapter = "5.7.0" @@ -51,9 +53,9 @@ compose-androidx-runtime-core = { module = "androidx.compose.runtime:runtime", v compose-androidx-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose" } compose-androidx-ui-core = { module = "androidx.compose.ui:ui", version.ref = "compose" } compose-androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } -compose-androidx-foundation-core = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } -compose-androidx-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "compose" } -compose-androidx-material = { module = "androidx.compose.material:material", version.ref = "compose" } +compose-androidx-foundation-core = { module = "androidx.compose.foundation:foundation", version.ref = "composeUi" } +compose-androidx-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "composeUi" } +compose-androidx-material = { module = "androidx.compose.material:material", version.ref = "composeUi" } compose-jb-plug = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "composejb" } # androidx androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity" } @@ -68,7 +70,6 @@ androidx-recyclerView = { module = "androidx.recyclerview:recyclerview", version # google google-material = { module = "com.google.android.material:material", version.ref = "material" } # other -accompanist-insets-ui = { module = "com.google.accompanist:accompanist-insets-ui", version.ref = "accompanist" } accompanist-systemuicontroller = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" } fastAdapter-core = { module = "com.mikepenz:fastadapter", version.ref = "fastAdapter" } gradleMvnPublish-plug = { module = "com.vanniktech:gradle-maven-publish-plugin", version.ref = "gradleMvnPublish" } @@ -79,6 +80,6 @@ materialDrawer-core = { module = "com.mikepenz:materialdrawer", version.ref = "m okhttp-core = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } [bundles] -accompanist = ["accompanist-insets-ui", "accompanist-systemuicontroller"] +accompanist = ["accompanist-systemuicontroller"] androidx-lifecycle = ["androidx-lifecycle-livedata-ktx", "androidx-lifecycle-viewmodel-ktx"] compose-androidx = ["compose-androidx-runtime-core", "compose-androidx-runtime-livedata", "compose-androidx-ui-core", "compose-androidx-ui-tooling", "compose-androidx-foundation-core", "compose-androidx-foundation-layout", "compose-androidx-material"] \ No newline at end of file