diff options
author | Allan Wang <me@allanwang.ca> | 2020-01-19 22:11:34 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-19 22:11:34 -0800 |
commit | 1d3a93c545edad134079efd7b737e231eeeb30c3 (patch) | |
tree | 3ef5d1475fc1f1ea22cf0a1130c55085c221ab3c /app/src/main/kotlin/com/pitchedapps | |
parent | a2c491f446add0191ab8f9a93dece8b37c9be984 (diff) | |
parent | dfa215e7ed32766e24ada5c3a2eebe2c4ffefeb2 (diff) | |
download | frost-1d3a93c545edad134079efd7b737e231eeeb30c3.tar.gz frost-1d3a93c545edad134079efd7b737e231eeeb30c3.tar.bz2 frost-1d3a93c545edad134079efd7b737e231eeeb30c3.zip |
Merge pull request #1622 from AllanWang/remove-synthetics
Remove synthetics
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/intro/IntroFragmentTheme.kt | 33 | ||||
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt | 23 |
2 files changed, 38 insertions, 18 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 -> 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 5ae29809..c86e560c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/intro/IntroMainFragments.kt @@ -35,9 +35,9 @@ import ca.allanwang.kau.utils.setOnSingleTapListener import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.R import com.pitchedapps.frost.activities.IntroActivity +import com.pitchedapps.frost.databinding.IntroAnalyticsBinding import com.pitchedapps.frost.utils.Prefs import kotlin.math.abs -import kotlinx.android.synthetic.main.intro_analytics.* /** * Created by Allan Wang on 2017-07-28. @@ -142,10 +142,14 @@ class IntroFragmentAnalytics : BaseIntroFragment(R.layout.intro_analytics) { val container: ConstraintLayout by bindViewResettable(R.id.intro_analytics_container) - override fun viewArray(): Array<Array<out View>> = arrayOf( - arrayOf(title), arrayOf(image), - arrayOf(intro_switch), arrayOf(desc) - ) + private lateinit var binding: IntroAnalyticsBinding + + override fun viewArray(): Array<Array<out View>> = with(binding) { + arrayOf( + arrayOf(title), arrayOf(image), + arrayOf(introSwitch), arrayOf(desc) + ) + } override fun themeFragmentImpl() { super.themeFragmentImpl() @@ -155,9 +159,14 @@ class IntroFragmentAnalytics : BaseIntroFragment(R.layout.intro_analytics) { @SuppressLint("ClickableViewAccessibility") override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + binding = IntroAnalyticsBinding.bind(view) + binding.init() + } + + private fun IntroAnalyticsBinding.init() { image.setIcon(GoogleMaterial.Icon.gmd_bug_report, 120) - intro_switch.isSelected = Prefs.analytics - intro_switch.setOnCheckedChangeListener { _, isChecked -> + introSwitch.isSelected = Prefs.analytics + introSwitch.setOnCheckedChangeListener { _, isChecked -> Prefs.analytics = isChecked } } |