Skip to content

Commit d121cff

Browse files
authored
deps: flowExt and ViewBindingDelegate (#155)
* deps: flowExt and ViewBindingDelegate * com.github.hoc081098:ViewBindingDelegate:1.4.0
1 parent e74f9f0 commit d121cff

File tree

6 files changed

+64
-9
lines changed

6 files changed

+64
-9
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,11 @@ dependencies {
6767
implementation(deps.coroutines.android)
6868
implementation(deps.koin.android)
6969
implementation(deps.androidx.material)
70+
implementation(deps.androidx.startup)
7071

7172
debugImplementation(deps.squareup.leakCanary)
7273
implementation(deps.timber)
74+
implementation(deps.viewBindingDelegate)
7375

7476
testImplementation(deps.test.junit)
7577
androidTestImplementation(deps.test.androidx.junit)

app/src/main/AndroidManifest.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.hoc.flowmvi">
45

56
<uses-permission android:name="android.permission.INTERNET" />
@@ -13,6 +14,20 @@
1314
android:supportsRtl="true"
1415
android:theme="@style/AppTheme">
1516

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+
1631
</application>
1732

1833
</manifest>

app/src/main/java/com/hoc/flowmvi/App.kt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import org.koin.android.ext.koin.androidContext
1515
import org.koin.android.ext.koin.androidLogger
1616
import org.koin.core.context.startKoin
1717
import org.koin.core.logger.Level
18-
import timber.log.Timber
1918

2019
@FlowPreview
2120
@ExperimentalCoroutinesApi
@@ -42,12 +41,6 @@ class App : Application() {
4241

4342
DynamicColors.applyToActivitiesIfAvailable(this)
4443

45-
if (BuildConfig.DEBUG) {
46-
Timber.plant(Timber.DebugTree())
47-
} else {
48-
// TODO(Timber): plant release tree
49-
}
50-
5144
startKoin {
5245
androidContext(this@App)
5346

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
}

buildSrc/src/main/kotlin/deps.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ object deps {
3333
const val recyclerView = "androidx.recyclerview:recyclerview:1.2.1"
3434
const val swipeRefreshLayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
3535
const val material = "com.google.android.material:material:1.6.1"
36+
const val startup = "androidx.startup:startup-runtime:1.1.1"
3637
}
3738

3839
object lifecycle {
@@ -69,8 +70,8 @@ object deps {
6970
}
7071

7172
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"
7475
const val timber = "com.jakewharton.timber:timber:5.0.1"
7576

7677
object arrow {

0 commit comments

Comments
 (0)