Skip to content

Commit ce864ff

Browse files
authored
Add preliminary support for Compose (#161)
* Add preliminary support for Compose * Updated ktlint, fixed formatting problems
1 parent cb903ee commit ce864ff

256 files changed

Lines changed: 3062 additions & 3606 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ max_line_length=off
77
ktlint_standard_property-naming=disabled
88
ktlint_standard_filename=disabled
99
ktlint_standard_package-name=disabled
10-
ktlint_code_style=android_studio
10+
ktlint_code_style=android_studio
11+
ktlint_function_naming_ignore_when_annotated_with = Composable

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

android/app/build.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id("dagger.hilt.android.plugin")
88
id("com.google.firebase.crashlytics")
99
id("com.google.devtools.ksp")
10+
alias(libs.plugins.compose.compiler)
1011
}
1112

1213
android {
@@ -83,11 +84,37 @@ android {
8384
abortOnError = false
8485
checkReleaseBuilds = false
8586
}
87+
88+
buildFeatures {
89+
compose = true
90+
}
91+
8692
namespace = "com.simplecityapps.shuttle"
8793

8894
dependencies {
8995
implementation(fileTree("dir" to "libs", "include" to listOf("*.jar")))
9096

97+
val composeBom = platform(libs.androidx.compose.bom)
98+
implementation(composeBom)
99+
androidTestImplementation(composeBom)
100+
101+
// Choose one of the following:
102+
// Material Design 3
103+
implementation(libs.androidx.material3)
104+
// or Material Design 2
105+
implementation(libs.androidx.material)
106+
// or skip Material Design and build directly on top of foundational components
107+
implementation(libs.androidx.foundation)
108+
// or only import the main APIs for the underlying toolkit systems,
109+
// such as input and measurement/layout
110+
implementation(libs.androidx.ui)
111+
112+
// Android Studio Preview support
113+
implementation(libs.androidx.ui.tooling.preview)
114+
debugImplementation(libs.androidx.ui.tooling)
115+
116+
implementation(libs.androidx.lifecycle.viewmodel.compose)
117+
91118
// Shuttle Core
92119
implementation(project(":android:core"))
93120

android/app/src/androidTest/java/com/simplecityapps/shuttle/CustomTestRunner.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,5 @@ class CustomTestRunner : AndroidJUnitRunner() {
1010
cl: ClassLoader?,
1111
name: String?,
1212
context: Context?
13-
): Application {
14-
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
15-
}
13+
): Application = super.newApplication(cl, HiltTestApplication::class.java.name, context)
1614
}

android/app/src/main/java/com/simplecityapps/shuttle/ShuttleApplication.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ import kotlinx.coroutines.DEBUG_PROPERTY_VALUE_ON
1818
import timber.log.Timber
1919

2020
@HiltAndroidApp
21-
class ShuttleApplication : Application(), ActivityIntentProvider, Configuration.Provider {
21+
class ShuttleApplication :
22+
Application(),
23+
ActivityIntentProvider,
24+
Configuration.Provider {
2225
@Inject
2326
lateinit var workerFactory: HiltWorkerFactory
2427

@@ -62,9 +65,7 @@ class ShuttleApplication : Application(), ActivityIntentProvider, Configuration.
6265

6366
// ActivityIntentProvider Implementation
6467

65-
override fun provideMainActivityIntent(): Intent {
66-
return Intent(this, MainActivity::class.java)
67-
}
68+
override fun provideMainActivityIntent(): Intent = Intent(this, MainActivity::class.java)
6869

6970
// WorkManager
7071

android/app/src/main/java/com/simplecityapps/shuttle/appinitializers/AppInitializer.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ interface AppInitializer {
88
/**
99
* Optional priority. Higher priority intiializers will be initialized earlier
1010
*/
11-
fun priority(): Int {
12-
return -1
13-
}
11+
fun priority(): Int = -1
1412
}

android/app/src/main/java/com/simplecityapps/shuttle/appinitializers/CrashReportingInitializer.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ constructor(
6363
}
6464
}
6565

66-
override fun priority(): Int {
67-
return 1
68-
}
66+
override fun priority(): Int = 1
6967
}
7068

7169
class CrashReportingTree : Timber.Tree() {

android/app/src/main/java/com/simplecityapps/shuttle/appinitializers/MediaStoreContentObserverInitializer.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class MediaStoreContentObserverInitializer
1919
constructor(
2020
@AppCoroutineScope private val appCoroutineScope: CoroutineScope,
2121
private val mediaImporter: MediaImporter
22-
) : ContentObserver(null), AppInitializer {
22+
) : ContentObserver(null),
23+
AppInitializer {
2324
override fun init(application: Application) {
2425
application.contentResolver.registerContentObserver(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, true, this)
2526
}

android/app/src/main/java/com/simplecityapps/shuttle/appinitializers/RemoteConfigInitializer.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,5 @@ constructor(
2424
}
2525
}
2626

27-
override fun priority(): Int {
28-
return 1
29-
}
27+
override fun priority(): Int = 1
3028
}

android/app/src/main/java/com/simplecityapps/shuttle/appinitializers/TimberInitializer.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,5 @@ constructor(
1414
Timber.plant(debugLoggingTree)
1515
}
1616

17-
override fun priority(): Int {
18-
return 2
19-
}
17+
override fun priority(): Int = 2
2018
}

0 commit comments

Comments
 (0)