Added text fields to change colours for text and background, but background logic for that is not yet implemented. BUG: settings don't react as they should. Clicking on "serif," for example, doesn't actually select and store serif. What is going on?

This commit is contained in:
denizk0461
2023-05-08 13:15:09 +02:00
parent d51cef64bb
commit 252c69a3ef
12 changed files with 149 additions and 35 deletions
@@ -17,6 +17,7 @@ import com.google.android.material.transition.MaterialSharedAxis
import java.lang.reflect.Field
import kotlin.math.abs
class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
private lateinit var storage: QuoteStorage
@@ -44,6 +45,8 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
// binding.animationLl.animateLayoutChanges(true)
// TODO a lot of the buttons don't at all do what they're supposed to do!
storage = QuoteStorage(context)
gravityButtons = arrayOf(
@@ -124,6 +127,8 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
}
}
////////////////////////////////////////////
binding.switchInvert.apply {
isChecked = storage.isInvertedEnabled()
@@ -260,16 +265,16 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
private fun save() {
storage.saveSettings(
binding.textSizePicker.value,
binding.switchInvert.isChecked,
binding.textTransparencyPicker.value,
binding.bgTransparencyPicker.value,
binding.switchRandom.isChecked,
widgetGravity,
backgroundIndex,
typefaceIndex,
typefaceStyleIndex,
binding.outlinePicker.value.toFloat()
textSize = binding.textSizePicker.value,
inverted = binding.switchInvert.isChecked,
textTransparency = binding.textTransparencyPicker.value,
bgTransparency = binding.bgTransparencyPicker.value,
random = binding.switchRandom.isChecked,
widgetPosition = widgetGravity,
backgroundType = backgroundIndex,
typefaceIndex = typefaceIndex,
typefaceStyleIndex = typefaceStyleIndex,
outlineSize = binding.outlinePicker.value.toFloat()
)
}