aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-01-19 21:21:29 -0800
committerAllan Wang <me@allanwang.ca>2020-01-19 21:21:29 -0800
commita4177af60ad70af5f3883ef31b26c6c31bcaa866 (patch)
tree65b6cc709990f49739efc818bc90e3c381902ece /app/src/main/kotlin/com/pitchedapps
parent172f8209a1e448f1e6cfc304dbb7dfef573da736 (diff)
downloadfrost-a4177af60ad70af5f3883ef31b26c6c31bcaa866.tar.gz
frost-a4177af60ad70af5f3883ef31b26c6c31bcaa866.tar.bz2
frost-a4177af60ad70af5f3883ef31b26c6c31bcaa866.zip
Remove synthetics for intro fragment theme
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt33
1 files changed, 22 insertions, 11 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt
index 64d675e1..4561fa6e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt
@@ -21,30 +21,41 @@ import android.view.View
import ca.allanwang.kau.utils.scaleXY
import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.IntroActivity
+import com.pitchedapps.frost.databinding.IntroThemeBinding
import com.pitchedapps.frost.enums.Theme
import com.pitchedapps.frost.utils.Prefs
-import kotlinx.android.synthetic.main.intro_theme.*
/**
* Created by Allan Wang on 2017-07-28.
*/
class IntroFragmentTheme : BaseIntroFragment(R.layout.intro_theme) {
+ private lateinit var binding: IntroThemeBinding
+
val themeList
- get() = listOf(intro_theme_light, intro_theme_dark, intro_theme_amoled, intro_theme_glass)
+ get() = with(binding) {
+ listOf(introThemeLight, introThemeDark, introThemeAmoled, introThemeGlass)
+ }
- override fun viewArray(): Array<Array<out View>> = arrayOf(
- arrayOf(title),
- arrayOf(intro_theme_light, intro_theme_dark),
- arrayOf(intro_theme_amoled, intro_theme_glass)
- )
+ override fun viewArray(): Array<Array<out View>> = with(binding) {
+ arrayOf(
+ arrayOf(title),
+ arrayOf(introThemeLight, introThemeDark),
+ arrayOf(introThemeAmoled, introThemeGlass)
+ )
+ }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
- intro_theme_light.setThemeClick(Theme.LIGHT)
- intro_theme_dark.setThemeClick(Theme.DARK)
- intro_theme_amoled.setThemeClick(Theme.AMOLED)
- intro_theme_glass.setThemeClick(Theme.GLASS)
+ binding = IntroThemeBinding.bind(view)
+ binding.init()
+ }
+
+ private fun IntroThemeBinding.init() {
+ introThemeLight.setThemeClick(Theme.LIGHT)
+ introThemeDark.setThemeClick(Theme.DARK)
+ introThemeAmoled.setThemeClick(Theme.AMOLED)
+ introThemeGlass.setThemeClick(Theme.GLASS)
val currentTheme = Prefs.theme - 1
if (currentTheme in 0..3)
themeList.forEachIndexed { index, v ->