File tree Expand file tree Collapse file tree 4 files changed +16
-27
lines changed
src/main/kotlin/com/fernandocejas/sample/features/movies/ui Expand file tree Collapse file tree 4 files changed +16
-27
lines changed Original file line number Diff line number Diff line change 33# Android - Clean Architecture - Kotlin [ ![ Build Status] ( https://travis-ci.org/android10/Android-CleanArchitecture-Kotlin.svg?branch=main )] ( https://travis-ci.org/android10/Android-CleanArchitecture-Kotlin ) [ ![ codecov] ( https://codecov.io/gh/android10/Android-CleanArchitecture-Kotlin/branch/main/graph/badge.svg?token=x1AtDcNuDv )] ( https://codecov.io/gh/android10/Android-CleanArchitecture-Kotlin )
44The purpose of this repo is to follow up Clean Architecture principles by bringing them to Android. It is worth saying that the idea is to take advantage of the Kotlin Programming Language features plus also pull in lessons learned and ideas from other interesting approaches like Functional Programming.
55
6+ ## Project Status
7+
8+ - ** Last Update 2024.08**
9+ - Migrated to Kotlin 2.0.
10+ - Migrated to Jetpack Compose.
11+ - Bug Fixes.
12+
613## Blog post with implementation details explanation:
714[ Architecting Android… Reloaded] ( https://fernandocejas.com/2018/05/07/architecting-android-reloaded/ )
815
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ dependencies {
7575// implementation(libs.kotlin.compose.compiler.plugin)
7676
7777 // Application dependencies
78- implementation(libs.kotlin.stdlib.jdk8 )
78+ implementation(libs.kotlin.stdlib)
7979 implementation(libs.kotlinx.coroutines.core)
8080 implementation(libs.kotlinx.coroutines.android)
8181 implementation(libs.koin.android)
Original file line number Diff line number Diff line change @@ -34,31 +34,13 @@ class MoviesActivity : AppCompatActivity() {
3434 setContentView(R .layout.test_layout)
3535 }
3636
37- fun testString () {
38- var stringInput: String? = null
39- // stringInput is smart-cast to String type
40- stringInput = " "
41- try {
42- // The compiler knows that stringInput isn't null
43- println (stringInput.length)
44- // 0
37+ private fun testKotlinTwo () {
4538
46- // The compiler rejects previous smart cast information for
47- // stringInput. Now stringInput has the String? type.
48- stringInput = null
49-
50- // Trigger an exception
51- if (2 > 1 ) throw Exception ()
52- stringInput = " "
53- } catch (exception: Exception ) {
54- // In Kotlin 2.0.0, the compiler knows stringInput
55- // can be null, so stringInput stays nullable.
56- println (stringInput?.length)
57- // null
58-
59- // In Kotlin 1.9.20, the compiler says that a safe call isn't
60- // needed, but this is incorrect.
61- }
6239 }
6340}
6441
42+ fun <T > List<T>.secondOrNull (): T ? = if (this .size > 1 ) this [1 ] else null
43+
44+ val numbers = listOf (1 , 2 , 3 )
45+ val secondNumber = numbers.secondOrNull() // Type inferred as Int?
46+
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ compileSdk = "34"
44minSdk = " 30"
55targetSdk = " 34"
66# kotlin ---------
7- kotlin = " 2.0.0 "
7+ kotlin = " 2.0.10 "
88kotlinCoroutines = " 1.7.3"
99# android --------
1010ksp = " 2.0.0-1.0.21"
@@ -40,7 +40,7 @@ androidGradlePlugin = "8.5.1"
4040
4141[libraries ]
4242# kotlin dependencies ---
43- kotlin-stdlib-jdk8 = { module = " org.jetbrains.kotlin:kotlin-stdlib-jdk8 " , version.ref = " kotlin" }
43+ kotlin-stdlib = { module = " org.jetbrains.kotlin:kotlin-stdlib" , version.ref = " kotlin" }
4444kotlin-compose-compiler-plugin-embeddable = { module = " org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable" , version.ref = " kotlin" }
4545kotlin-compose-compiler-plugin = { module = " org.jetbrains.kotlin:kotlin-compose-compiler-plugin" , version.ref = " kotlin" }
4646kotlinx-coroutines-core = { module = " org.jetbrains.kotlinx:kotlinx-coroutines-core" , version.ref = " kotlinCoroutines" }
You can’t perform that action at this time.
0 commit comments