Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update major dependencies | Kotlin | Compose | Material #834

Merged
merged 2 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
}
}
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion app-desktop/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ dependencies {
}

compose {
kotlinCompilerPlugin.set(libs.versions.composeCompiler.get())
kotlinCompilerPlugin.set(libs.versions.composeCompilerJb.get())
}

tasks.withType<KotlinCompile> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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")
}
}
}
}
)
}
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
org.jetbrains.compose.experimental.uikit.enabled=true
21 changes: 11 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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" }
Expand All @@ -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" }
Expand All @@ -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"]