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 3
3
# 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 )
4
4
The 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.
5
5
6
+ ## Project Status
7
+
8
+ - ** Last Update 2024.08**
9
+ - Migrated to Kotlin 2.0.
10
+ - Migrated to Jetpack Compose.
11
+ - Bug Fixes.
12
+
6
13
## Blog post with implementation details explanation:
7
14
[ Architecting Android… Reloaded] ( https://fernandocejas.com/2018/05/07/architecting-android-reloaded/ )
8
15
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ dependencies {
75
75
// implementation(libs.kotlin.compose.compiler.plugin)
76
76
77
77
// Application dependencies
78
- implementation(libs.kotlin.stdlib.jdk8 )
78
+ implementation(libs.kotlin.stdlib)
79
79
implementation(libs.kotlinx.coroutines.core)
80
80
implementation(libs.kotlinx.coroutines.android)
81
81
implementation(libs.koin.android)
Original file line number Diff line number Diff line change @@ -34,31 +34,13 @@ class MoviesActivity : AppCompatActivity() {
34
34
setContentView(R .layout.test_layout)
35
35
}
36
36
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 () {
45
38
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
- }
62
39
}
63
40
}
64
41
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"
4
4
minSdk = " 30"
5
5
targetSdk = " 34"
6
6
# kotlin ---------
7
- kotlin = " 2.0.0 "
7
+ kotlin = " 2.0.10 "
8
8
kotlinCoroutines = " 1.7.3"
9
9
# android --------
10
10
ksp = " 2.0.0-1.0.21"
@@ -40,7 +40,7 @@ androidGradlePlugin = "8.5.1"
40
40
41
41
[libraries ]
42
42
# 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" }
44
44
kotlin-compose-compiler-plugin-embeddable = { module = " org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable" , version.ref = " kotlin" }
45
45
kotlin-compose-compiler-plugin = { module = " org.jetbrains.kotlin:kotlin-compose-compiler-plugin" , version.ref = " kotlin" }
46
46
kotlinx-coroutines-core = { module = " org.jetbrains.kotlinx:kotlinx-coroutines-core" , version.ref = " kotlinCoroutines" }
You can’t perform that action at this time.
0 commit comments