Archived
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:
Generated
-1
@@ -1,4 +1,3 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="DesignSurface">
|
<component name="DesignSurface">
|
||||||
<option name="filePathToZoomLevelMap">
|
<option name="filePathToZoomLevelMap">
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class QuoteStorage(context: Context) {
|
|||||||
backgroundType: Int,
|
backgroundType: Int,
|
||||||
typefaceIndex: Int,
|
typefaceIndex: Int,
|
||||||
typefaceStyleIndex: Int,
|
typefaceStyleIndex: Int,
|
||||||
outlineSize: Float
|
outlineSize: Float,
|
||||||
) {
|
) {
|
||||||
prefs.edit().apply {
|
prefs.edit().apply {
|
||||||
putInt(KEY_TEXT_SIZE, textSize)
|
putInt(KEY_TEXT_SIZE, textSize)
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.google.android.material.transition.MaterialSharedAxis
|
|||||||
import java.lang.reflect.Field
|
import java.lang.reflect.Field
|
||||||
import kotlin.math.abs
|
import kotlin.math.abs
|
||||||
|
|
||||||
|
|
||||||
class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
|
class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
|
||||||
|
|
||||||
private lateinit var storage: QuoteStorage
|
private lateinit var storage: QuoteStorage
|
||||||
@@ -44,6 +45,8 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
|
|||||||
|
|
||||||
// binding.animationLl.animateLayoutChanges(true)
|
// binding.animationLl.animateLayoutChanges(true)
|
||||||
|
|
||||||
|
// TODO a lot of the buttons don't at all do what they're supposed to do!
|
||||||
|
|
||||||
storage = QuoteStorage(context)
|
storage = QuoteStorage(context)
|
||||||
|
|
||||||
gravityButtons = arrayOf(
|
gravityButtons = arrayOf(
|
||||||
@@ -124,6 +127,8 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////
|
||||||
|
|
||||||
binding.switchInvert.apply {
|
binding.switchInvert.apply {
|
||||||
isChecked = storage.isInvertedEnabled()
|
isChecked = storage.isInvertedEnabled()
|
||||||
|
|
||||||
@@ -260,16 +265,16 @@ class SettingsFragment : BaseFragment(R.layout.fragment_settings) {
|
|||||||
|
|
||||||
private fun save() {
|
private fun save() {
|
||||||
storage.saveSettings(
|
storage.saveSettings(
|
||||||
binding.textSizePicker.value,
|
textSize = binding.textSizePicker.value,
|
||||||
binding.switchInvert.isChecked,
|
inverted = binding.switchInvert.isChecked,
|
||||||
binding.textTransparencyPicker.value,
|
textTransparency = binding.textTransparencyPicker.value,
|
||||||
binding.bgTransparencyPicker.value,
|
bgTransparency = binding.bgTransparencyPicker.value,
|
||||||
binding.switchRandom.isChecked,
|
random = binding.switchRandom.isChecked,
|
||||||
widgetGravity,
|
widgetPosition = widgetGravity,
|
||||||
backgroundIndex,
|
backgroundType = backgroundIndex,
|
||||||
typefaceIndex,
|
typefaceIndex = typefaceIndex,
|
||||||
typefaceStyleIndex,
|
typefaceStyleIndex = typefaceStyleIndex,
|
||||||
binding.outlinePicker.value.toFloat()
|
outlineSize = binding.outlinePicker.value.toFloat()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ class CanvasText {
|
|||||||
val bmp = if (isPreview) {
|
val bmp = if (isPreview) {
|
||||||
Bitmap.createBitmap(1024, 256, Bitmap.Config.ARGB_8888)
|
Bitmap.createBitmap(1024, 256, Bitmap.Config.ARGB_8888)
|
||||||
} else {
|
} else {
|
||||||
// Log.d("ASDFasdf", "${widgetSize.first} + ${widgetSize.second}")
|
|
||||||
Bitmap.createBitmap(widgetSize.first * 3, widgetSize.second * 3, Bitmap.Config.ARGB_8888)
|
Bitmap.createBitmap(widgetSize.first * 3, widgetSize.second * 3, Bitmap.Config.ARGB_8888)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="?attr/colorOnSurfaceVariant" android:state_focused="true"/>
|
||||||
|
<item android:color="?attr/colorOutlineVariant"/>
|
||||||
|
</selector>
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="#FFFFFF"/>
|
||||||
|
<stroke android:width="3dp" android:color="#B1BCBE" />
|
||||||
|
<corners android:radius="10dp"/>
|
||||||
|
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
|
||||||
|
</shape>
|
||||||
@@ -39,18 +39,21 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginHorizontal="4dp"/>
|
android:layout_marginHorizontal="4dp"/>
|
||||||
|
|
||||||
|
<!-- TODO the following 4 elements are hidden but must be removed once their features are implemented custom -->
|
||||||
<com.denizd.textbasic.VerticalTextView
|
<com.denizd.textbasic.VerticalTextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="@string/text_opacity"
|
android:text="@string/text_opacity"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:fontFamily="@font/mono_light"
|
android:fontFamily="@font/mono_light"
|
||||||
|
android:visibility="gone"
|
||||||
android:padding="4dp"/>
|
android:padding="4dp"/>
|
||||||
|
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/text_transparency_picker"
|
android:id="@+id/text_transparency_picker"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginHorizontal="4dp"/>
|
android:layout_marginHorizontal="4dp"/>
|
||||||
|
|
||||||
<com.denizd.textbasic.VerticalTextView
|
<com.denizd.textbasic.VerticalTextView
|
||||||
@@ -59,12 +62,14 @@
|
|||||||
android:text="@string/bg_opacity"
|
android:text="@string/bg_opacity"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:fontFamily="@font/mono_light"
|
android:fontFamily="@font/mono_light"
|
||||||
|
android:visibility="gone"
|
||||||
android:padding="4dp"/>
|
android:padding="4dp"/>
|
||||||
|
|
||||||
<NumberPicker
|
<NumberPicker
|
||||||
android:id="@+id/bg_transparency_picker"
|
android:id="@+id/bg_transparency_picker"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone"
|
||||||
android:layout_marginHorizontal="4dp"/>
|
android:layout_marginHorizontal="4dp"/>
|
||||||
|
|
||||||
<com.denizd.textbasic.VerticalTextView
|
<com.denizd.textbasic.VerticalTextView
|
||||||
@@ -84,6 +89,7 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- TODO this must be replaced with a custom solution later -->
|
||||||
<com.google.android.material.button.MaterialButtonToggleGroup
|
<com.google.android.material.button.MaterialButtonToggleGroup
|
||||||
android:id="@+id/typeface_toggle_button"
|
android:id="@+id/typeface_toggle_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -122,21 +128,6 @@
|
|||||||
|
|
||||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||||
|
|
||||||
<!-- <com.google.android.material.textfield.TextInputLayout-->
|
|
||||||
<!-- style="@style/Widget.Material3.TextInputLayout.OutlinedBox.Dense.ExposedDropdownMenu"-->
|
|
||||||
<!-- android:id="@+id/typeface_menu"-->
|
|
||||||
<!-- android:layout_width="match_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:layout_marginBottom="16dp">-->
|
|
||||||
|
|
||||||
<!-- <AutoCompleteTextView-->
|
|
||||||
<!-- android:id="@+id/typeface_menu_textview"-->
|
|
||||||
<!-- android:layout_width="match_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:inputType="none"/>-->
|
|
||||||
|
|
||||||
<!-- </com.google.android.material.textfield.TextInputLayout>-->
|
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButtonToggleGroup
|
<com.google.android.material.button.MaterialButtonToggleGroup
|
||||||
android:id="@+id/typeface_style_toggle_button"
|
android:id="@+id/typeface_style_toggle_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -222,9 +213,102 @@
|
|||||||
|
|
||||||
</com.google.android.material.button.MaterialButtonToggleGroup>
|
</com.google.android.material.button.MaterialButtonToggleGroup>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:id="@+id/text_layout_text_colour"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:hint="@string/text_colour_input_hint"
|
||||||
|
app:boxStrokeColor="@color/selector_text_input"
|
||||||
|
app:hintTextColor="@color/selector_text_input">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox"
|
||||||
|
android:textColor="?attr/colorOnSurfaceVariant"
|
||||||
|
android:maxLength="8"
|
||||||
|
android:digits="abcdefABCDEF1234567890"
|
||||||
|
android:id="@+id/edit_text_text_colour"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/preview_text_colour"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginHorizontal="8dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:background="@drawable/rounded_shape"
|
||||||
|
android:backgroundTint="@color/design_default_color_primary"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||||
|
android:id="@+id/text_layout_bg_colour"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="3"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:scrollHorizontally="true"
|
||||||
|
android:hint="@string/bg_colour_input_hint"
|
||||||
|
app:boxStrokeColor="@color/selector_text_input"
|
||||||
|
app:hintTextColor="@color/selector_text_input">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
style="@style/ThemeOverlay.Material3.TextInputEditText.OutlinedBox"
|
||||||
|
android:textColor="?attr/colorOnSurfaceVariant"
|
||||||
|
android:maxLength="8"
|
||||||
|
android:digits="abcdefABCDEF1234567890"
|
||||||
|
android:id="@+id/edit_text_bg_colour"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text"/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.LinearLayoutCompat
|
||||||
|
android:id="@+id/preview_bg_colour"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:layout_marginHorizontal="8dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:background="@drawable/rounded_shape"
|
||||||
|
android:backgroundTint="@color/design_default_color_primary"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||||
|
|
||||||
|
<!-- TODO this view is hidden but must be removed later -->
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
@@ -242,7 +326,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
<!-- android:textColor="?attr/colorOnPrimary"-->
|
<!-- android:textColor="?attr/colorOnPrimary"-->
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/switch_invert"
|
android:id="@+id/switch_invert"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -273,7 +357,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"/>
|
app:layout_constraintEnd_toEndOf="parent"/>
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.materialswitch.MaterialSwitch
|
||||||
android:id="@+id/switch_random"
|
android:id="@+id/switch_random"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -336,7 +420,6 @@
|
|||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="12dp">
|
android:layout_marginBottom="12dp">
|
||||||
<!-- android:backgroundTint="?attr/colorSecondary"-->
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
|||||||
@@ -32,6 +32,9 @@
|
|||||||
<string name="position_button_content_desc_bc">Positioniere Widget unten zentriert</string>
|
<string name="position_button_content_desc_bc">Positioniere Widget unten zentriert</string>
|
||||||
<string name="position_button_content_desc_br">Positioniere Widget unten rechts</string>
|
<string name="position_button_content_desc_br">Positioniere Widget unten rechts</string>
|
||||||
|
|
||||||
|
<string name="text_colour_input_hint">Textfarbe (hex, ohne #)</string>
|
||||||
|
<string name="bg_colour_input_hint">Hintergrundfarbe (hex, ohne #)</string>
|
||||||
|
|
||||||
<string name="sansserif">Sans-Serif</string>
|
<string name="sansserif">Sans-Serif</string>
|
||||||
<string name="serif">Serif</string>
|
<string name="serif">Serif</string>
|
||||||
<string name="monospace">Monospace</string>
|
<string name="monospace">Monospace</string>
|
||||||
|
|||||||
@@ -34,5 +34,11 @@
|
|||||||
|
|
||||||
<item name="android:statusBarColor">@color/md_theme_dark_background</item>
|
<item name="android:statusBarColor">@color/md_theme_dark_background</item>
|
||||||
<item name="android:navigationBarColor">@color/color_tint_background_dark</item>
|
<item name="android:navigationBarColor">@color/color_tint_background_dark</item>
|
||||||
|
|
||||||
|
<item name="android:textColor">@color/md_theme_dark_onSurfaceVariant</item>
|
||||||
|
<item name="android:textColorHighlight">@color/md_theme_dark_primaryContainer</item>
|
||||||
|
<item name="colorText">@color/md_theme_dark_onSurfaceVariant</item>
|
||||||
|
<item name="android:scrollbarThumbVertical">@color/md_theme_dark_primary</item>
|
||||||
|
<item name="colorOutlineVariant">@color/md_theme_dark_outlineVariant</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<!-- <attr name="colorOnPrimarySoftest" format="color"/>-->
|
|
||||||
<!-- <attr name="colorOnSecondarySoft" format="color"/>-->
|
|
||||||
<!-- <attr name="colorTertiary" format="color"/>-->
|
|
||||||
<attr name="colorTintBackground" format="color"/>
|
<attr name="colorTintBackground" format="color"/>
|
||||||
<attr name="colorSecContainer" format="color"/>
|
<attr name="colorSecContainer" format="color"/>
|
||||||
|
<attr name="colorText" format="color"/>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -31,6 +31,9 @@
|
|||||||
<string name="position_button_content_desc_bc">Position widget at bottom center</string>
|
<string name="position_button_content_desc_bc">Position widget at bottom center</string>
|
||||||
<string name="position_button_content_desc_br">Position widget at bottom right</string>
|
<string name="position_button_content_desc_br">Position widget at bottom right</string>
|
||||||
|
|
||||||
|
<string name="text_colour_input_hint">Text colour (hex, no #)</string>
|
||||||
|
<string name="bg_colour_input_hint">Background colour (hex, no #)</string>
|
||||||
|
|
||||||
<string name="sansserif">Sans-Serif</string>
|
<string name="sansserif">Sans-Serif</string>
|
||||||
<string name="serif">Serif</string>
|
<string name="serif">Serif</string>
|
||||||
<string name="monospace">Monospace</string>
|
<string name="monospace">Monospace</string>
|
||||||
|
|||||||
@@ -36,5 +36,11 @@
|
|||||||
<item name="android:navigationBarColor">@color/color_tint_background_light</item>
|
<item name="android:navigationBarColor">@color/color_tint_background_light</item>
|
||||||
<item name="android:windowLightStatusBar">true</item>
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
<item name="android:windowLightNavigationBar" tools:targetApi="p">true</item>
|
<item name="android:windowLightNavigationBar" tools:targetApi="p">true</item>
|
||||||
|
|
||||||
|
<item name="android:textColor">@color/md_theme_light_onSurfaceVariant</item>
|
||||||
|
<item name="android:textColorHighlight">@color/md_theme_light_primaryContainer</item>
|
||||||
|
<item name="colorText">@color/md_theme_light_onSurfaceVariant</item>
|
||||||
|
<item name="android:scrollbarThumbVertical">@color/md_theme_light_primary</item>
|
||||||
|
<item name="colorOutlineVariant">@color/md_theme_light_outlineVariant</item>
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user