mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
@@ -23,6 +23,7 @@ import android.app.Activity
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.provider.Settings
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import dagger.Lazy
|
import dagger.Lazy
|
||||||
import nl.dionsegijn.konfetti.core.Party
|
import nl.dionsegijn.konfetti.core.Party
|
||||||
@@ -226,6 +227,12 @@ class ListHabitsScreen
|
|||||||
override fun showConfetti(color: PaletteColor, x: Float, y: Float) {
|
override fun showConfetti(color: PaletteColor, x: Float, y: Float) {
|
||||||
if (x == 0f && y == 0f) return
|
if (x == 0f && y == 0f) return
|
||||||
if (preferences.isConfettiAnimationDisabled) return
|
if (preferences.isConfettiAnimationDisabled) return
|
||||||
|
if (Settings.Global.getFloat(
|
||||||
|
activity.contentResolver,
|
||||||
|
Settings.Global.ANIMATOR_DURATION_SCALE,
|
||||||
|
1f
|
||||||
|
) == 0f
|
||||||
|
) 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(
|
||||||
@@ -299,30 +306,36 @@ class ListHabitsScreen
|
|||||||
command.selected.size
|
command.selected.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ChangeHabitColorCommand -> {
|
is ChangeHabitColorCommand -> {
|
||||||
return activity.resources.getQuantityString(
|
return activity.resources.getQuantityString(
|
||||||
R.plurals.toast_habits_changed,
|
R.plurals.toast_habits_changed,
|
||||||
command.selected.size
|
command.selected.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is CreateHabitCommand -> {
|
is CreateHabitCommand -> {
|
||||||
return activity.resources.getString(R.string.toast_habit_created)
|
return activity.resources.getString(R.string.toast_habit_created)
|
||||||
}
|
}
|
||||||
|
|
||||||
is DeleteHabitsCommand -> {
|
is DeleteHabitsCommand -> {
|
||||||
return activity.resources.getQuantityString(
|
return activity.resources.getQuantityString(
|
||||||
R.plurals.toast_habits_deleted,
|
R.plurals.toast_habits_deleted,
|
||||||
command.selected.size
|
command.selected.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
is EditHabitCommand -> {
|
is EditHabitCommand -> {
|
||||||
return activity.resources.getQuantityString(R.plurals.toast_habits_changed, 1)
|
return activity.resources.getQuantityString(R.plurals.toast_habits_changed, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
is UnarchiveHabitsCommand -> {
|
is UnarchiveHabitsCommand -> {
|
||||||
return activity.resources.getQuantityString(
|
return activity.resources.getQuantityString(
|
||||||
R.plurals.toast_habits_unarchived,
|
R.plurals.toast_habits_unarchived,
|
||||||
command.selected.size
|
command.selected.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> return null
|
else -> return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -335,9 +348,11 @@ class ListHabitsScreen
|
|||||||
adapter.refresh()
|
adapter.refresh()
|
||||||
activity.showMessage(activity.resources.getString(R.string.habits_imported))
|
activity.showMessage(activity.resources.getString(R.string.habits_imported))
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportDataTask.NOT_RECOGNIZED -> {
|
ImportDataTask.NOT_RECOGNIZED -> {
|
||||||
activity.showMessage(activity.resources.getString(R.string.file_not_recognized))
|
activity.showMessage(activity.resources.getString(R.string.file_not_recognized))
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
activity.showMessage(activity.resources.getString(R.string.could_not_import))
|
activity.showMessage(activity.resources.getString(R.string.could_not_import))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user