mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
CheckmarkDialog: Format date using current locale
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.isoron.platform.time
|
||||
|
||||
import java.text.DateFormat
|
||||
import java.util.Calendar.DAY_OF_MONTH
|
||||
import java.util.Calendar.DAY_OF_WEEK
|
||||
import java.util.Calendar.HOUR_OF_DAY
|
||||
@@ -66,4 +67,10 @@ class JavaLocalDateFormatter(private val locale: Locale) : LocalDateFormatter {
|
||||
val cal = date.toGregorianCalendar()
|
||||
return cal.getDisplayName(DAY_OF_WEEK, SHORT, locale)
|
||||
}
|
||||
|
||||
fun longFormat(date: LocalDate): String {
|
||||
val df = DateFormat.getDateInstance(DateFormat.LONG, locale)
|
||||
df.timeZone = TimeZone.getTimeZone("UTC")
|
||||
return df.format(date.toGregorianCalendar().time)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.isoron.uhabits.core.ui.screens.habits.list
|
||||
|
||||
import org.isoron.platform.time.LocalDate
|
||||
import org.isoron.uhabits.core.commands.CommandRunner
|
||||
import org.isoron.uhabits.core.commands.CreateRepetitionCommand
|
||||
import org.isoron.uhabits.core.models.Habit
|
||||
@@ -65,6 +66,7 @@ open class ListHabitsBehavior @Inject constructor(
|
||||
screen.showCheckmarkDialog(
|
||||
entry.value,
|
||||
entry.notes,
|
||||
timestamp.toLocalDate(),
|
||||
timestamp.toDialogDateString(),
|
||||
habit.color,
|
||||
) { newValue, newNotes ->
|
||||
@@ -168,8 +170,9 @@ open class ListHabitsBehavior @Inject constructor(
|
||||
callback: NumberPickerCallback
|
||||
)
|
||||
fun showCheckmarkDialog(
|
||||
value: Int,
|
||||
selectedValue: Int,
|
||||
notes: String,
|
||||
date: LocalDate,
|
||||
dateString: String,
|
||||
color: PaletteColor,
|
||||
callback: CheckMarkDialogCallback
|
||||
|
||||
@@ -93,7 +93,7 @@ class HistoryCardPresenter(
|
||||
screen.showCheckmarkDialog(
|
||||
entry.value,
|
||||
entry.notes,
|
||||
timestamp.toDialogDateString(),
|
||||
timestamp.toLocalDate(),
|
||||
preferences,
|
||||
habit.color,
|
||||
) { newValue, newNotes ->
|
||||
@@ -206,9 +206,9 @@ class HistoryCardPresenter(
|
||||
callback: ListHabitsBehavior.NumberPickerCallback,
|
||||
)
|
||||
fun showCheckmarkDialog(
|
||||
value: Int,
|
||||
selectedValue: Int,
|
||||
notes: String,
|
||||
dateString: String,
|
||||
date: LocalDate,
|
||||
preferences: Preferences,
|
||||
color: PaletteColor,
|
||||
callback: ListHabitsBehavior.CheckMarkDialogCallback,
|
||||
|
||||
Reference in New Issue
Block a user