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
@@ -106,7 +106,7 @@ class QuoteStorage(context: Context) {
backgroundType: Int,
typefaceIndex: Int,
typefaceStyleIndex: Int,
outlineSize: Float
outlineSize: Float,
) {
prefs.edit().apply {
putInt(KEY_TEXT_SIZE, textSize)
@@ -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()
)
}
@@ -27,7 +27,6 @@ class CanvasText {
val bmp = if (isPreview) {
Bitmap.createBitmap(1024, 256, Bitmap.Config.ARGB_8888)
} else {
// Log.d("ASDFasdf", "${widgetSize.first} + ${widgetSize.second}")
Bitmap.createBitmap(widgetSize.first * 3, widgetSize.second * 3, Bitmap.Config.ARGB_8888)
}