Full date updates

* Move preference to 'Date and time' screen
* Show full dates in widget
* Show full dates in deadline control set
pull/1188/head
Alex Baker 5 years ago
parent c369a12f69
commit 930be1f249

@ -50,7 +50,7 @@ class HeaderViewHolder(
context.getString(R.string.sort_created_group, getDateString(group, alwaysDisplayFullDate))
sortMode == SortHelper.SORT_MODIFIED ->
context.getString(R.string.sort_modified_group, getDateString(group, alwaysDisplayFullDate))
else -> getDateString(group, alwaysDisplayFullDate)
else -> getDateString(group, alwaysDisplayFullDate, false)
}
}

@ -75,7 +75,14 @@ class DeadlineControlSet : TaskEditControlFragment() {
dueDate.text = ""
setTextColor(false)
} else {
dueDate.text = DateUtilities.getRelativeDateTime(activity, date, locale.locale, FormatStyle.FULL)
dueDate.text = DateUtilities.getRelativeDateTime(
activity,
date,
locale.locale,
FormatStyle.FULL,
preferences.alwaysDisplayFullDate,
false
)
setTextColor(if (hasDueTime(date)) {
DateTimeUtils.newDateTime(date).isBeforeNow
} else {

@ -73,6 +73,7 @@ internal class ScrollableViewsFactory(
private var tasks = SectionedDataSource(emptyList(), false, 0, collapsed)
private val widgetPreferences = WidgetPreferences(context, preferences, widgetId)
private var isDark = checkIfDark
private var showFullDate = false
private val checkIfDark: Boolean
get() = when (widgetPreferences.themeIndex) {
@ -192,8 +193,8 @@ internal class ScrollableViewsFactory(
}
}
private fun getDateString(value: Long, lowercase: Boolean = true, alwaysDisplayFullDate: Boolean = false) =
DateUtilities.getRelativeDay(context, value, locale.locale, FormatStyle.MEDIUM, alwaysDisplayFullDate, lowercase)
private fun getDateString(value: Long, lowercase: Boolean = true) =
DateUtilities.getRelativeDay(context, value, locale.locale, FormatStyle.MEDIUM, showFullDate, lowercase)
@StringRes
private fun priorityToString(priority: Int) = when (priority) {
@ -334,7 +335,7 @@ internal class ScrollableViewsFactory(
}
} else {
DateUtilities.getRelativeDateTime(
context, task.dueDate, locale.locale, FormatStyle.MEDIUM)
context, task.dueDate, locale.locale, FormatStyle.MEDIUM, showFullDate, false)
}
row.setTextViewText(dueDateRes, text)
row.setTextColor(
@ -381,6 +382,7 @@ internal class ScrollableViewsFactory(
showSubtasks = widgetPreferences.showSubtasks()
showLists = widgetPreferences.showLists()
showTags = widgetPreferences.showTags()
showFullDate = widgetPreferences.alwaysDisplayFullDate
widgetPreferences.sortMode.takeIf { it != sortMode }
?.let {
if (sortMode >= 0) {

@ -267,7 +267,7 @@ public class WidgetPreferences implements QueryPreferences {
}
@Override
public boolean getAlwaysDisplayFullDate() { return getBoolean(R.string.p_always_display_full_date, false); }
public boolean getAlwaysDisplayFullDate() { return preferences.getAlwaysDisplayFullDate(); }
@Override
public boolean usePagedQueries() {
@ -296,6 +296,6 @@ public class WidgetPreferences implements QueryPreferences {
@Override
public void setAlwaysDisplayFullDate(boolean noWeekday) {
setBoolean(R.string.p_always_display_full_date, noWeekday);
preferences.setAlwaysDisplayFullDate(noWeekday);
}
}

@ -8,6 +8,11 @@
android:key="@string/p_start_of_week"
android:title="@string/start_of_week" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_always_display_full_date"
android:title="@string/always_display_full_date" />
<org.tasks.ui.TimePreference
android:defaultValue="@integer/default_morning"
android:key="@string/p_date_shortcut_morning"

@ -78,11 +78,6 @@
android:key="@string/p_show_full_description"
android:title="@string/show_full_description" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_always_display_full_date"
android:title="@string/always_display_full_date" />
<SwitchPreferenceCompat
android:defaultValue="false"
android:key="@string/p_linkify_task_list"

Loading…
Cancel
Save