Compose,Kotlin,Gradle and Deps Update and Deprecated Code Migration

This commit is contained in:
Shabinder 2022-01-27 02:05:25 +05:30
parent 2198613506
commit 9299fc0c55
8 changed files with 31 additions and 31 deletions

View File

@ -82,15 +82,6 @@ android {
packagingOptions { packagingOptions {
exclude("META-INF/*") exclude("META-INF/*")
} }
configurations {
"implementation" {
exclude(group = "androidx.compose.animation")
exclude(group = "androidx.compose.foundation")
exclude(group = "androidx.compose.material")
exclude(group = "androidx.compose.runtime")
exclude(group = "androidx.compose.ui")
}
}
} }
dependencies { dependencies {
implementation(compose.material) implementation(compose.material)

View File

@ -250,7 +250,7 @@ class MainActivity : ComponentActivity() {
if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT if (long) android.widget.Toast.LENGTH_LONG else android.widget.Toast.LENGTH_SHORT
).show() ).show()
} }
Log.i("Toasting",string) Log.i("Toasting", string)
} }
@Suppress("DEPRECATION") @Suppress("DEPRECATION")
@ -267,7 +267,7 @@ class MainActivity : ComponentActivity() {
SpotiFlyerRoot( SpotiFlyerRoot(
componentContext, componentContext,
dependencies = object : SpotiFlyerRoot.Dependencies { dependencies = object : SpotiFlyerRoot.Dependencies {
override val storeFactory = LoggingStoreFactory(DefaultStoreFactory) override val storeFactory = LoggingStoreFactory(DefaultStoreFactory())
override val database = this@MainActivity.fileManager.db override val database = this@MainActivity.fileManager.db
override val fetchQuery = this@MainActivity.fetcher override val fetchQuery = this@MainActivity.fetcher
override val fileManager: FileManager = this@MainActivity.fileManager override val fileManager: FileManager = this@MainActivity.fileManager

View File

@ -1,24 +1,24 @@
[versions] [versions]
kotlin = "1.5.31" kotlin = "1.6.10"
androidCoroutines = "1.5.1" androidCoroutines = "1.5.1"
ktLint = "10.1.0" ktLint = "10.1.0"
mosaic = "0.1.0" mosaic = "0.1.0"
koin = "3.1.2" koin = "3.1.2"
kermit = "0.1.9" kermit = "0.1.9"
mokoParcelize = "0.7.1" mokoParcelize = "0.7.1"
ktor = "1.6.3" ktor = "1.6.7"
kotlinxSerialization = "1.3.0" kotlinxSerialization = "1.3.1"
sqlDelight = "1.5.1" sqlDelight = "1.5.3"
sqliteJdbcDriver = "3.34.0" sqliteJdbcDriver = "3.34.0"
slf4j = "1.7.31" slf4j = "1.7.31"
i18n4k = "0.1.3" i18n4k = "0.1.3"
essenty = "0.1.3" essenty = "0.2.2"
multiplatformSettings = "0.7.7" multiplatformSettings = "0.7.7"
decompose = "0.3.1" decompose = "0.5.0"
mviKotlin = "2.0.4" mviKotlin = "3.0.0-alpha03"
accompanist = "0.18.0" accompanist = "0.22.0-rc"
statelyVersion = "1.1.10" statelyVersion = "1.2.1"
statelyIsoVersion = "1.2.0-nmm" statelyIsoVersion = "1.2.1"
androidxLifecycle = "2.4.0-alpha03" androidxLifecycle = "2.4.0-alpha03"
@ -29,12 +29,12 @@ kotlin-kotlinTestCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test-
kotlin-kotlinTestJs = { group = "org.jetbrains.kotlin", name = "kotlin-test-js", version.ref = "kotlin" } kotlin-kotlinTestJs = { group = "org.jetbrains.kotlin", name = "kotlin-test-js", version.ref = "kotlin" }
kotlin-kotlinTestJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } kotlin-kotlinTestJunit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" }
kotlin-kotlinTestAnnotationsCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test-annotations-common", version.ref = "kotlin" } kotlin-kotlinTestAnnotationsCommon = { group = "org.jetbrains.kotlin", name = "kotlin-test-annotations-common", version.ref = "kotlin" }
kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.5.2-native-mt" } kotlin-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = "1.6.0" }
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" } kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerialization" }
kotlinx-atomicfu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version = "0.16.3" } kotlinx-atomicfu = { group = "org.jetbrains.kotlinx", name = "atomicfu", version = "0.17.0" }
kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.2.1" } kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version = "0.3.2" }
kotlin-compose-gradle = { group = "org.jetbrains.compose", name = "compose-gradle-plugin", version = "1.0.0-alpha4-build366" } kotlin-compose-gradle = { group = "org.jetbrains.compose", name = "compose-gradle-plugin", version = "1.0.1" }
mosaic-gradle = { group = "com.jakewharton.mosaic", name = "mosaic-gradle-plugin", version.ref = "mosaic" } mosaic-gradle = { group = "com.jakewharton.mosaic", name = "mosaic-gradle-plugin", version.ref = "mosaic" }
essenty-lifecycle = { group = "com.arkivanov.essenty", name = "lifecycle", version.ref = "essenty" } essenty-lifecycle = { group = "com.arkivanov.essenty", name = "lifecycle", version.ref = "essenty" }

View File

@ -6,6 +6,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.painter.BitmapPainter import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.res.loadImageBitmap import androidx.compose.ui.res.loadImageBitmap
import androidx.compose.ui.res.useResource import androidx.compose.ui.res.useResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogState
@OptIn(ExperimentalAnimationApi::class) @OptIn(ExperimentalAnimationApi::class)
@Composable @Composable
@ -17,6 +19,7 @@ actual fun Dialog(
AnimatedVisibility(isVisible) { AnimatedVisibility(isVisible) {
androidx.compose.ui.window.Dialog( androidx.compose.ui.window.Dialog(
onDismiss, onDismiss,
state = DialogState(width = 350.dp, height = 340.dp),
title = "SpotiFlyer", title = "SpotiFlyer",
icon = BitmapPainter(useResource("drawable/spotiflyer.png", ::loadImageBitmap)) icon = BitmapPainter(useResource("drawable/spotiflyer.png", ::loadImageBitmap))
) { ) {

View File

@ -17,7 +17,7 @@
package com.shabinder.common.root package com.shabinder.common.root
import com.arkivanov.decompose.ComponentContext import com.arkivanov.decompose.ComponentContext
import com.arkivanov.decompose.RouterState import com.arkivanov.decompose.router.RouterState
import com.arkivanov.decompose.value.Value import com.arkivanov.decompose.value.Value
import com.arkivanov.mvikotlin.core.store.StoreFactory import com.arkivanov.mvikotlin.core.store.StoreFactory
import com.shabinder.common.core_components.analytics.AnalyticsManager import com.shabinder.common.core_components.analytics.AnalyticsManager

View File

@ -19,6 +19,11 @@ package com.shabinder.common.root.integration
import co.touchlab.stately.ensureNeverFrozen import co.touchlab.stately.ensureNeverFrozen
import co.touchlab.stately.freeze import co.touchlab.stately.freeze
import com.arkivanov.decompose.* import com.arkivanov.decompose.*
import com.arkivanov.decompose.router.RouterState
import com.arkivanov.decompose.router.pop
import com.arkivanov.decompose.router.popWhile
import com.arkivanov.decompose.router.push
import com.arkivanov.decompose.router.router
import com.arkivanov.decompose.value.Value import com.arkivanov.decompose.value.Value
import com.arkivanov.essenty.parcelable.Parcelable import com.arkivanov.essenty.parcelable.Parcelable
import com.arkivanov.essenty.parcelable.Parcelize import com.arkivanov.essenty.parcelable.Parcelize
@ -26,8 +31,8 @@ import com.shabinder.common.core_components.analytics.AnalyticsEvent
import com.shabinder.common.core_components.analytics.AnalyticsView import com.shabinder.common.core_components.analytics.AnalyticsView
import com.shabinder.common.list.SpotiFlyerList import com.shabinder.common.list.SpotiFlyerList
import com.shabinder.common.main.SpotiFlyerMain import com.shabinder.common.main.SpotiFlyerMain
import com.shabinder.common.models.Consumer
import com.shabinder.common.models.Actions import com.shabinder.common.models.Actions
import com.shabinder.common.models.Consumer
import com.shabinder.common.preference.SpotiFlyerPreference import com.shabinder.common.preference.SpotiFlyerPreference
import com.shabinder.common.root.SpotiFlyerRoot import com.shabinder.common.root.SpotiFlyerRoot
import com.shabinder.common.root.SpotiFlyerRoot.Child import com.shabinder.common.root.SpotiFlyerRoot.Child

View File

@ -16,6 +16,7 @@
import androidx.compose.desktop.DesktopMaterialTheme import androidx.compose.desktop.DesktopMaterialTheme
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Surface import androidx.compose.material.Surface
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.awt.ComposeWindow import androidx.compose.ui.awt.ComposeWindow
@ -69,7 +70,7 @@ private lateinit var appWindow: ComposeWindow
fun main() { fun main() {
val lifecycle = LifecycleRegistry() val lifecycle = LifecycleRegistry()
val rootComponent = spotiFlyerRoot(DefaultComponentContext(lifecycle)) val rootComponent = spotiFlyerRoot(DefaultComponentContext(lifecycle))
val windowState = WindowState(size = WindowSize(450.dp, 800.dp)) val windowState = WindowState(width = 450.dp, height = 800.dp)
singleWindowApplication( singleWindowApplication(
title = "SpotiFlyer", title = "SpotiFlyer",
state = windowState, state = windowState,
@ -82,7 +83,7 @@ fun main() {
color = Color.Black, color = Color.Black,
contentColor = colorOffWhite contentColor = colorOffWhite
) { ) {
DesktopMaterialTheme( MaterialTheme(
colors = SpotiFlyerColors, colors = SpotiFlyerColors,
typography = SpotiFlyerTypography, typography = SpotiFlyerTypography,
shapes = SpotiFlyerShapes shapes = SpotiFlyerShapes
@ -110,7 +111,7 @@ private fun spotiFlyerRoot(componentContext: ComponentContext): SpotiFlyerRoot =
componentContext = componentContext, componentContext = componentContext,
dependencies = object : SpotiFlyerRoot.Dependencies { dependencies = object : SpotiFlyerRoot.Dependencies {
override val appInit: ApplicationInit = koin.get() override val appInit: ApplicationInit = koin.get()
override val storeFactory = DefaultStoreFactory override val storeFactory = DefaultStoreFactory()
override val fetchQuery: FetchPlatformQueryResult = koin.get() override val fetchQuery: FetchPlatformQueryResult = koin.get()
override val fileManager: FileManager = koin.get() override val fileManager: FileManager = koin.get()
override val database: Database? = fileManager.db override val database: Database? = fileManager.db

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
#distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205 #distributionSha256Sum=7faa7198769f872826c8ef4f1450f839ec27f0b4d5d1e51bade63667cbccd205
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists