aboutsummaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-02-23 16:05:48 -0800
committerAllan Wang <me@allanwang.ca>2020-02-23 16:05:48 -0800
commit1840d89ca5ff4855d43b03a9a1c802f8c1ebd3c7 (patch)
tree152e82315ad331533b4c145a9e6d7c45ec90b5e7 /sample
parent61dddd883908a803e3ee55de537e0a30ee4ef90d (diff)
downloadkau-1840d89ca5ff4855d43b03a9a1c802f8c1ebd3c7.tar.gz
kau-1840d89ca5ff4855d43b03a9a1c802f8c1ebd3c7.tar.bz2
kau-1840d89ca5ff4855d43b03a9a1c802f8c1ebd3c7.zip
Move pref module to pref class
Diffstat (limited to 'sample')
-rw-r--r--sample/src/androidTest/kotlin/ca/allanwang/kau/sample/SampleTestApp.kt7
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt7
-rw-r--r--sample/src/main/kotlin/ca/allanwang/kau/sample/SampleApp.kt13
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())
- }
- }
}
}