add color to new habit desc

pull/2195/head
zenador 2 months ago
parent a69d528d54
commit 1be2903f93

@ -53,6 +53,7 @@ class CheckmarkDialog : AppCompatDialogFragment() {
if (description.isNotEmpty()) { if (description.isNotEmpty()) {
view.habitDescription.text = description view.habitDescription.text = description
view.habitDescription.visibility = VISIBLE view.habitDescription.visibility = VISIBLE
view.habitDescription.setTextColor(color)
} else { } else {
view.habitDescription.visibility = GONE view.habitDescription.visibility = GONE
} }

@ -36,6 +36,7 @@ class NumberDialog : AppCompatDialogFragment() {
val appComponent = (requireActivity().application as HabitsApplication).component val appComponent = (requireActivity().application as HabitsApplication).component
val prefs = appComponent.preferences val prefs = appComponent.preferences
view = CheckmarkPopupBinding.inflate(LayoutInflater.from(context)) view = CheckmarkPopupBinding.inflate(LayoutInflater.from(context))
val color = requireArguments().getInt("color")
// Get the habit ID and load description // Get the habit ID and load description
val habitId = requireArguments().getLong("habitId", -1) val habitId = requireArguments().getLong("habitId", -1)
@ -46,6 +47,7 @@ class NumberDialog : AppCompatDialogFragment() {
if (description.isNotEmpty()) { if (description.isNotEmpty()) {
view.habitDescription.text = description view.habitDescription.text = description
view.habitDescription.visibility = View.VISIBLE view.habitDescription.visibility = View.VISIBLE
view.habitDescription.setTextColor(color)
} else { } else {
view.habitDescription.visibility = View.GONE view.habitDescription.visibility = View.GONE
} }
@ -55,7 +57,7 @@ class NumberDialog : AppCompatDialogFragment() {
} }
arrayOf(view.yesBtn).forEach { arrayOf(view.yesBtn).forEach {
it.setTextColor(requireArguments().getInt("color")) it.setTextColor(color)
} }
arrayOf(view.noBtn, view.unknownBtnNumber).forEach { arrayOf(view.noBtn, view.unknownBtnNumber).forEach {
it.setTextColor(view.root.sres.getColor(R.attr.contrast60)) it.setTextColor(view.root.sres.getColor(R.attr.contrast60))

@ -273,9 +273,11 @@ class ListHabitsScreen
callback: ListHabitsBehavior.NumberPickerCallback, callback: ListHabitsBehavior.NumberPickerCallback,
habit: Habit? habit: Habit?
) { ) {
val theme = rootView.get().currentTheme()
val fm = (context as AppCompatActivity).supportFragmentManager val fm = (context as AppCompatActivity).supportFragmentManager
val dialog = NumberDialog() val dialog = NumberDialog()
dialog.arguments = Bundle().apply { dialog.arguments = Bundle().apply {
habit?.color?.let { putInt("color", theme.color(it).toInt()) }
putDouble("value", value) putDouble("value", value)
putString("notes", notes) putString("notes", notes)
habit?.id?.let { putLong("habitId", it) } habit?.id?.let { putLong("habitId", it) }

@ -176,8 +176,10 @@ class ShowHabitActivity : AppCompatActivity(), CommandRunner.Listener {
callback: ListHabitsBehavior.NumberPickerCallback, callback: ListHabitsBehavior.NumberPickerCallback,
habit: Habit? habit: Habit?
) { ) {
val theme = view.currentTheme()
val dialog = NumberDialog() val dialog = NumberDialog()
dialog.arguments = Bundle().apply { dialog.arguments = Bundle().apply {
habit?.color?.let { putInt("color", theme.color(it).toInt()) }
putDouble("value", value) putDouble("value", value)
putString("notes", notes) putString("notes", notes)
putLong("habitId", habit?.id ?: -1) putLong("habitId", habit?.id ?: -1)

Loading…
Cancel
Save