mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Allow user to disable confetti animation
This commit is contained in:
@@ -224,6 +224,7 @@ class ListHabitsScreen
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun showConfetti(color: PaletteColor, x: Float, y: Float) {
|
override fun showConfetti(color: PaletteColor, x: Float, y: Float) {
|
||||||
|
if (preferences.isConfettiAnimationDisabled) return
|
||||||
val baseColor = themeSwitcher.currentTheme!!.color(color).toInt()
|
val baseColor = themeSwitcher.currentTheme!!.color(color).toInt()
|
||||||
rootView.get().konfettiView.start(
|
rootView.get().konfettiView.start(
|
||||||
Party(
|
Party(
|
||||||
|
|||||||
@@ -233,4 +233,6 @@
|
|||||||
<string name="activity_not_found">No app was found to support this action</string>
|
<string name="activity_not_found">No app was found to support this action</string>
|
||||||
<string name="pref_midnight_delay_title">Extend day a few hours past midnight</string>
|
<string name="pref_midnight_delay_title">Extend day a few hours past midnight</string>
|
||||||
<string name="pref_midnight_delay_description">Wait until 3:00 AM to show a new day. Useful if you typically go to sleep after midnight. Requires app restart.</string>
|
<string name="pref_midnight_delay_description">Wait until 3:00 AM to show a new day. Useful if you typically go to sleep after midnight. Requires app restart.</string>
|
||||||
|
<string name="pref_animations_title">Disable animations</string>
|
||||||
|
<string name="pref_animations_description">Disable confetti animation after adding a checkmark.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -67,6 +67,13 @@
|
|||||||
android:title="@string/use_pure_black"
|
android:title="@string/use_pure_black"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
|
<SwitchPreferenceCompat
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="pref_disable_animation"
|
||||||
|
android:summary="@string/pref_animations_description"
|
||||||
|
android:title="@string/pref_animations_title"
|
||||||
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:defaultValue="255"
|
android:defaultValue="255"
|
||||||
android:entries="@array/widget_opacity_entries"
|
android:entries="@array/widget_opacity_entries"
|
||||||
|
|||||||
@@ -135,6 +135,12 @@ open class Preferences(private val storage: Storage) {
|
|||||||
storage.putBoolean("pref_short_toggle", enabled)
|
storage.putBoolean("pref_short_toggle", enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isConfettiAnimationDisabled: Boolean
|
||||||
|
get() = storage.getBoolean("pref_disable_animation", false)
|
||||||
|
set(enabled) {
|
||||||
|
storage.putBoolean("pref_disable_animation", enabled)
|
||||||
|
}
|
||||||
|
|
||||||
fun removeListener(listener: Listener) {
|
fun removeListener(listener: Listener) {
|
||||||
listeners.remove(listener)
|
listeners.remove(listener)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user