diff --git a/.editorconfig b/.editorconfig index f01f364..a81f2b3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,9 +1,23 @@ [*.{kt,kts}] -max_line_length=130 +max_line_length = 140 indent_style = space -indent_size=4 -continuation_indent_size=4 -ktlint_standard_import-ordering=disabled -ij_kotlin_allow_trailing_comma=true +indent_size = 4 + +insert_final_newline = true +trim_trailing_whitespace = true + +ij_kotlin_allow_trailing_comma = true ij_kotlin_allow_trailing_comma_on_call_site = true + +continuation_indent_size = 4 +ktlint_standard_import-ordering = disabled +ktlint_standard_function-signature = disabled +ktlint_standard_context-receiver-wrapping = disabled +ktlint_standard_multiline-expression-wrapping = disabled +ktlint_standard_no-empty-first-line-in-class-body = disabled +ktlint_standard_no-blank-line-in-list = disabled +ktlint_standard_blank-line-before-declaration = disabled +ktlint_standard_annotation = disabled + + diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 791aad7..10601ba 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -46,12 +46,12 @@ android.apply { compileOptions { isCoreLibraryDesugaringEnabled = true - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions.apply { - jvmTarget = JavaVersion.VERSION_11.toString() + jvmTarget = JavaVersion.VERSION_17.toString() } composeOptions { @@ -137,7 +137,7 @@ android.apply { } kotlin { - jvmToolchain(11) + jvmToolchain(JavaVersion.VERSION_17.majorVersion.toInt()) } dependencies { diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/injection/modules/ApplicationModule.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/injection/modules/ApplicationModule.kt index 2c4dfbb..7cb13e7 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/injection/modules/ApplicationModule.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/injection/modules/ApplicationModule.kt @@ -18,7 +18,9 @@ import kotlinx.serialization.modules.SerializersModule class ApplicationModule { @Provides - fun resources(@ApplicationContext context: Context): Resources = context.resources + fun resources( + @ApplicationContext context: Context, + ): Resources = context.resources @Provides fun json(): Json = Json(from = Json.Default) { @@ -31,6 +33,8 @@ class ApplicationModule { } @Provides - fun sharedPrefs(@ApplicationContext context: Context) = + fun sharedPrefs( + @ApplicationContext context: Context, + ) = PreferenceManager.getDefaultSharedPreferences(context) } diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/navigation/Destinations.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/navigation/Destinations.kt index 1ee95fa..4bd04bf 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/navigation/Destinations.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/navigation/Destinations.kt @@ -1,7 +1,6 @@ package app.futured.androidprojecttemplate.navigation import androidx.compose.animation.AnimatedContentScope -import androidx.compose.animation.AnimatedVisibilityScope import androidx.compose.runtime.Composable import androidx.compose.ui.window.DialogProperties import androidx.navigation.NamedNavArgument @@ -40,19 +39,19 @@ sealed class Destination( route = "detail/{title}?subtitle={subtitle}?value={value}", destinationScreen = { DetailScreen(navigation = it) }, arguments = - listOf( - navArgument("title") { - type = NavType.StringType - }, - navArgument("subtitle") { - type = NavType.StringType - defaultValue = "Default subtitle" - }, - navArgument("value") { - type = NavType.StringType - nullable = true - }, - ), + listOf( + navArgument("title") { + type = NavType.StringType + }, + navArgument("subtitle") { + type = NavType.StringType + defaultValue = "Default subtitle" + }, + navArgument("value") { + type = NavType.StringType + nullable = true + }, + ), ) { fun buildRoute(title: String, subtitle: String?, value: String?): String = route .withArgument("title", title) diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/tools/compose/Previews.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/tools/compose/Previews.kt index de58ba2..7f6c68f 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/tools/compose/Previews.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/tools/compose/Previews.kt @@ -1,3 +1,5 @@ +@file:Suppress("TopLevelPropertyNaming") + package app.futured.androidprojecttemplate.tools.compose import android.content.res.Configuration diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/NavGraph.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/NavGraph.kt index 52c9542..51c58dc 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/NavGraph.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/NavGraph.kt @@ -1,6 +1,5 @@ package app.futured.androidprojecttemplate.ui -import androidx.activity.compose.LocalOnBackPressedDispatcherOwner import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.navigation.NavHostController @@ -19,10 +18,6 @@ fun NavGraph( navController: NavHostController = rememberNavController(), navigation: NavRouter = remember { NavRouterImpl(navController) }, ) { - LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher?.let { - navController.navigateUp() - } - NavHost( navController = navController, startDestination = Destination.Home.route, diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/_templateScreen/_TEMPLATEScreen.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/_templateScreen/_TEMPLATEScreen.kt index e3bdd1a..8be03f9 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/_templateScreen/_TEMPLATEScreen.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/_templateScreen/_TEMPLATEScreen.kt @@ -1,4 +1,5 @@ @file:OptIn(ExperimentalMaterial3Api::class) +@file:Suppress("PackageNaming") package app.futured.androidprojecttemplate.ui.screens._templateScreen @@ -99,8 +100,7 @@ object TEMPLATE { @Composable fun TEMPLATEContentPreview() = Showcase { TEMPLATE.Content( - actions = - object : TEMPLATE.Actions { + actions = object : TEMPLATE.Actions { override fun onNavigateBack() = Unit }, ) diff --git a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/home/HomeScreen.kt b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/home/HomeScreen.kt index 134041c..3106b55 100644 --- a/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/home/HomeScreen.kt +++ b/app/src/main/kotlin/app/futured/androidprojecttemplate/ui/screens/home/HomeScreen.kt @@ -93,8 +93,7 @@ object Home { fun HomeContentPreview() { Showcase { Home.Content( - actions = - object : Home.Actions { + actions = object : Home.Actions { override fun onNavigateToDetail() = Unit override fun onIncrementCounter() = Unit }, diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 2bacd6d..0ec9804 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -6,9 +6,9 @@ object Versions { const val androidGradlePlugin = "8.4.0" // plugins - const val detekt = "1.22.0" - const val ktlintGradle = "11.2.0" - const val ktlint = "0.48.2" + const val detekt = "1.23.6" + const val ktlintGradle = "12.1.1" + const val ktlint = "1.2.1" // kotlin const val kotlin = "1.9.23"