diff options
Diffstat (limited to 'sample/src')
3 files changed, 19 insertions, 8 deletions
diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt index ceb551b..2bf5ca3 100644 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt +++ b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt @@ -62,7 +62,12 @@ class SampleTestApp : Application() { androidLogger() } androidContext(this@SampleTestApp) - modules(listOf(prefFactoryModule(), SampleApp.prefModule())) + modules( + listOf( + prefFactoryModule(), + KPrefSample.module() + ) + ) } } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt index 97e8075..4ac9928 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt @@ -18,6 +18,7 @@ package ca.allanwang.kau.sample import android.graphics.Color import ca.allanwang.kau.kpref.KPref import ca.allanwang.kau.kpref.KPrefFactory +import org.koin.dsl.module /** * Created by Allan Wang on 2017-06-07. @@ -34,4 +35,10 @@ class KPrefSample(factory: KPrefFactory) : KPref("pref_sample", factory = factor var seekbar: Int by kpref("seekbar", 20) var time12: Int by kpref("time_12", 315) var time24: Int by kpref("time_24", 2220) + + companion object { + fun module() = module { + single { KPrefSample(get()) } + } + } } diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt index 2537090..597894a 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt @@ -36,7 +36,12 @@ class SampleApp : Application() { androidLogger() } androidContext(this@SampleApp) - modules(listOf(prefFactoryModule(), prefModule())) + modules( + listOf( + prefFactoryModule(), + KPrefSample.module() + ) + ) } } @@ -46,11 +51,5 @@ class SampleApp : Application() { KPrefFactoryAndroid(get()) } } - - fun prefModule(): Module = module { - single { - KPrefSample(get()) - } - } } } |