File tree Expand file tree Collapse file tree 6 files changed +64
-9
lines changed Expand file tree Collapse file tree 6 files changed +64
-9
lines changed Original file line number Diff line number Diff line change @@ -67,9 +67,11 @@ dependencies {
67
67
implementation(deps.coroutines.android)
68
68
implementation(deps.koin.android)
69
69
implementation(deps.androidx.material)
70
+ implementation(deps.androidx.startup)
70
71
71
72
debugImplementation(deps.squareup.leakCanary)
72
73
implementation(deps.timber)
74
+ implementation(deps.viewBindingDelegate)
73
75
74
76
testImplementation(deps.test.junit)
75
77
androidTestImplementation(deps.test.androidx.junit)
Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
2
<manifest xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ xmlns : tools =" http://schemas.android.com/tools"
3
4
package =" com.hoc.flowmvi" >
4
5
5
6
<uses-permission android : name =" android.permission.INTERNET" />
13
14
android : supportsRtl =" true"
14
15
android : theme =" @style/AppTheme" >
15
16
17
+ <provider
18
+ android : name =" androidx.startup.InitializationProvider"
19
+ android : authorities =" ${applicationId}.androidx-startup"
20
+ android : exported =" false"
21
+ tools : node =" merge" >
22
+ <meta-data
23
+ android : name =" com.hoc.flowmvi.initializer.TimberInitializer"
24
+ android : value =" androidx.startup" />
25
+
26
+ <meta-data
27
+ android : name =" com.hoc.flowmvi.initializer.ViewBindingInitializer"
28
+ android : value =" androidx.startup" />
29
+ </provider >
30
+
16
31
</application >
17
32
18
33
</manifest >
Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ import org.koin.android.ext.koin.androidContext
15
15
import org.koin.android.ext.koin.androidLogger
16
16
import org.koin.core.context.startKoin
17
17
import org.koin.core.logger.Level
18
- import timber.log.Timber
19
18
20
19
@FlowPreview
21
20
@ExperimentalCoroutinesApi
@@ -42,12 +41,6 @@ class App : Application() {
42
41
43
42
DynamicColors .applyToActivitiesIfAvailable(this )
44
43
45
- if (BuildConfig .DEBUG ) {
46
- Timber .plant(Timber .DebugTree ())
47
- } else {
48
- // TODO(Timber): plant release tree
49
- }
50
-
51
44
startKoin {
52
45
androidContext(this @App)
53
46
Original file line number Diff line number Diff line change
1
+ @file:Suppress(" unused" )
2
+
3
+ package com.hoc.flowmvi.initializer
4
+
5
+ import android.content.Context
6
+ import androidx.startup.Initializer
7
+ import com.hoc.flowmvi.BuildConfig
8
+ import timber.log.Timber
9
+
10
+ class TimberInitializer : Initializer <Unit > {
11
+ override fun create (context : Context ) {
12
+ if (BuildConfig .DEBUG ) {
13
+ Timber .plant(Timber .DebugTree ())
14
+ } else {
15
+ // TODO(Timber): plant release tree
16
+ }
17
+ Timber .d(" TimberInitializer..." )
18
+ }
19
+
20
+ override fun dependencies (): List <Class <out Initializer <* >>> = emptyList()
21
+ }
Original file line number Diff line number Diff line change
1
+ @file:Suppress(" unused" )
2
+
3
+ package com.hoc.flowmvi.initializer
4
+
5
+ import android.content.Context
6
+ import androidx.startup.Initializer
7
+ import com.hoc.flowmvi.ui.add.databinding.ActivityAddBinding
8
+ import com.hoc.flowmvi.ui.main.databinding.ActivityMainBinding
9
+ import com.hoc081098.viewbindingdelegate.preloadBindMethods
10
+ import timber.log.Timber
11
+
12
+ class ViewBindingInitializer : Initializer <Unit > {
13
+ override fun create (context : Context ) {
14
+ preloadBindMethods(
15
+ ActivityMainBinding ::class ,
16
+ ActivityAddBinding ::class ,
17
+ )
18
+ Timber .d(" ViewBindingInitializer..." )
19
+ }
20
+
21
+ override fun dependencies (): List <Class <out Initializer <* >>> =
22
+ listOf (TimberInitializer ::class .java)
23
+ }
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ object deps {
33
33
const val recyclerView = " androidx.recyclerview:recyclerview:1.2.1"
34
34
const val swipeRefreshLayout = " androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
35
35
const val material = " com.google.android.material:material:1.6.1"
36
+ const val startup = " androidx.startup:startup-runtime:1.1.1"
36
37
}
37
38
38
39
object lifecycle {
@@ -69,8 +70,8 @@ object deps {
69
70
}
70
71
71
72
const val coil = " io.coil-kt:coil:2.1.0"
72
- const val viewBindingDelegate = " com.github.hoc081098:ViewBindingDelegate:1.3.1 "
73
- const val flowExt = " io.github.hoc081098:FlowExt:0.4.0 "
73
+ const val viewBindingDelegate = " com.github.hoc081098:ViewBindingDelegate:1.4.0 "
74
+ const val flowExt = " io.github.hoc081098:FlowExt:0.5.0-SNAPSHOT "
74
75
const val timber = " com.jakewharton.timber:timber:5.0.1"
75
76
76
77
object arrow {
You can’t perform that action at this time.
0 commit comments