aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
index c86e560c..4c01f5e0 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt
@@ -38,6 +38,7 @@ import com.pitchedapps.frost.activities.IntroActivity
import com.pitchedapps.frost.databinding.IntroAnalyticsBinding
import com.pitchedapps.frost.utils.Prefs
import kotlin.math.abs
+import org.koin.android.ext.android.inject
/**
* Created by Allan Wang on 2017-07-28.
@@ -50,6 +51,8 @@ import kotlin.math.abs
*/
abstract class BaseIntroFragment(val layoutRes: Int) : Fragment() {
+ protected val prefs: Prefs by inject()
+
val screenWidth
get() = resources.displayMetrics.widthPixels
@@ -105,7 +108,7 @@ abstract class BaseIntroFragment(val layoutRes: Int) : Fragment() {
}
protected open fun themeFragmentImpl() {
- (view as? ViewGroup)?.children?.forEach { (it as? TextView)?.setTextColor(Prefs.textColor) }
+ (view as? ViewGroup)?.children?.forEach { (it as? TextView)?.setTextColor(prefs.textColor) }
}
protected val viewArray: Array<Array<out View>> by lazyResettableRegistered { viewArray() }
@@ -134,7 +137,7 @@ class IntroFragmentWelcome : BaseIntroFragment(R.layout.intro_welcome) {
override fun themeFragmentImpl() {
super.themeFragmentImpl()
- image.imageTintList = ColorStateList.valueOf(Prefs.textColor)
+ image.imageTintList = ColorStateList.valueOf(prefs.textColor)
}
}
@@ -153,7 +156,7 @@ class IntroFragmentAnalytics : BaseIntroFragment(R.layout.intro_analytics) {
override fun themeFragmentImpl() {
super.themeFragmentImpl()
- image.imageTintList = ColorStateList.valueOf(Prefs.textColor)
+ image.imageTintList = ColorStateList.valueOf(prefs.textColor)
}
@SuppressLint("ClickableViewAccessibility")
@@ -165,9 +168,9 @@ class IntroFragmentAnalytics : BaseIntroFragment(R.layout.intro_analytics) {
private fun IntroAnalyticsBinding.init() {
image.setIcon(GoogleMaterial.Icon.gmd_bug_report, 120)
- introSwitch.isSelected = Prefs.analytics
+ introSwitch.isSelected = prefs.analytics
introSwitch.setOnCheckedChangeListener { _, isChecked ->
- Prefs.analytics = isChecked
+ prefs.analytics = isChecked
}
}
}
@@ -180,7 +183,7 @@ class IntroFragmentEnd : BaseIntroFragment(R.layout.intro_end) {
override fun themeFragmentImpl() {
super.themeFragmentImpl()
- image.imageTintList = ColorStateList.valueOf(Prefs.textColor)
+ image.imageTintList = ColorStateList.valueOf(prefs.textColor)
}
@SuppressLint("ClickableViewAccessibility")