android: Add dependencies and new application class for dagger / hilt support
Dagger and hilt give us dependency injection which makes it easier to split up parts of the app. This lets us easily split out things like logging and paves the way to migrate off preferences to DataStore This also remove the process name on the service to pull eveything into one process so we don't have to do IPC to pass logs around. This lets us use the same instances of injected classes between the UI and the service side.
This commit is contained in:
parent
d0a4270449
commit
5d122c3bc8
|
@ -1,6 +1,8 @@
|
|||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("com.google.devtools.ksp")
|
||||
id("com.google.dagger.hilt.android")
|
||||
}
|
||||
|
||||
android {
|
||||
|
@ -24,7 +26,7 @@ android {
|
|||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.4"
|
||||
kotlinCompilerExtensionVersion = "1.5.7"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
@ -64,6 +66,10 @@ dependencies {
|
|||
implementation("com.github.alorma:compose-settings-storage-preferences:1.0.3")
|
||||
implementation("com.google.accompanist:accompanist-permissions:0.33.2-alpha")
|
||||
|
||||
implementation("com.google.dagger:hilt-android:2.49")
|
||||
ksp("com.google.dagger:dagger-compiler:2.49")
|
||||
ksp("com.google.dagger:hilt-compiler:2.49")
|
||||
|
||||
// Android Studio Preview support
|
||||
implementation("androidx.compose.ui:ui-tooling-preview")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling")
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
android:label="@string/app_name"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:theme="@style/Theme.MPD">
|
||||
android:theme="@style/Theme.MPD"
|
||||
android:name=".MPDApplication">
|
||||
<activity
|
||||
android:name=".ui.SettingsActivity"
|
||||
android:exported="true">
|
||||
|
@ -53,8 +54,7 @@
|
|||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".Main"
|
||||
android:process=":main" />
|
||||
android:name=".Main" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package org.musicpd
|
||||
|
||||
import android.app.Application
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
@HiltAndroidApp
|
||||
class MPDApplication : Application() {
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id("com.android.application") version "8.1.2" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.20" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.9.21" apply false
|
||||
id("com.google.devtools.ksp") version "1.9.22-1.0.16" apply false
|
||||
id("com.google.dagger.hilt.android") version "2.49" apply false
|
||||
}
|
Loading…
Reference in New Issue