Add "Default" button to the color picker (#242)

This commit is contained in:
BlackyHawky 2023-10-23 12:15:26 +02:00 committed by GitHub
parent a55cd619dc
commit b797ebd064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,6 +128,16 @@ open class ColorsSettingsFragment : Fragment(R.layout.color_settings) {
}
reloadKeyboard(hidden)
}
// The Default button appears only when a color has already been defined
if (csb.colorSwitch.isChecked) {
// Reset the color and the color picker to their initial state
builder.setNeutralButton(R.string.button_default) { _, _ ->
csb.colorSwitch.isChecked = false
val resetColor = Settings.readUserColor(prefs, requireContext(), colorPrefs[index], isNight)
picker.color = resetColor
csb.colorSwitch.toggle()
}
}
val dialog = builder.create()
dialog.show()
// Reduce the size of the dialog in portrait mode