pref: 优化时间显示
This commit is contained in:
parent
5e478aaba9
commit
3bbc9f79c8
|
|
@ -25,8 +25,10 @@ object DateTimeUtils {
|
||||||
}
|
}
|
||||||
val currentCalendar = Calendar.getInstance()
|
val currentCalendar = Calendar.getInstance()
|
||||||
return if (currentCalendar.after(calendar)) {
|
return if (currentCalendar.after(calendar)) {
|
||||||
if (calendar.get(Calendar.YEAR) == currentCalendar.get(Calendar.YEAR)) {
|
if (calendar.get(Calendar.YEAR) == currentCalendar.get(Calendar.YEAR) && calendar.get(
|
||||||
if (calendar.get(Calendar.MONTH) == currentCalendar.get(Calendar.MONTH)) {
|
Calendar.MONTH
|
||||||
|
) == currentCalendar.get(Calendar.MONTH)
|
||||||
|
) {
|
||||||
if (calendar.get(Calendar.DAY_OF_MONTH) == currentCalendar.get(Calendar.DAY_OF_MONTH)) {
|
if (calendar.get(Calendar.DAY_OF_MONTH) == currentCalendar.get(Calendar.DAY_OF_MONTH)) {
|
||||||
if (calendar.get(Calendar.HOUR_OF_DAY) == currentCalendar.get(Calendar.HOUR_OF_DAY)) {
|
if (calendar.get(Calendar.HOUR_OF_DAY) == currentCalendar.get(Calendar.HOUR_OF_DAY)) {
|
||||||
if (calendar.get(Calendar.MINUTE) == currentCalendar.get(Calendar.MINUTE)) {
|
if (calendar.get(Calendar.MINUTE) == currentCalendar.get(Calendar.MINUTE)) {
|
||||||
|
|
@ -42,21 +44,15 @@ object DateTimeUtils {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getString(
|
context.getString(
|
||||||
R.string.relative_date_hour,
|
R.string.relative_date_today,
|
||||||
currentCalendar.get(Calendar.HOUR_OF_DAY) - calendar.get(Calendar.HOUR_OF_DAY)
|
calendar.format("HH:mm")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
context.getString(
|
calendar.format("MM-dd HH:mm")
|
||||||
R.string.relative_date_month,
|
|
||||||
currentCalendar.get(Calendar.DAY_OF_MONTH) - calendar.get(Calendar.DAY_OF_MONTH)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
calendar.format(context.getString(R.string.pattern_date_short))
|
calendar.format("yyyy-MM-dd HH:mm")
|
||||||
}
|
|
||||||
} else {
|
|
||||||
calendar.format(context.getString(R.string.pattern_date_long))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
calendar.format(context.getString(R.string.relative_date_after))
|
calendar.format(context.getString(R.string.relative_date_after))
|
||||||
|
|
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
<string name="text_badge_history_forum">贴吧</string>
|
<string name="text_badge_history_forum">贴吧</string>
|
||||||
<string name="title_history_thread">贴子记录</string>
|
<string name="title_history_thread">贴子记录</string>
|
||||||
<string name="title_history_forum">经过贴吧</string>
|
<string name="title_history_forum">经过贴吧</string>
|
||||||
<string name="tip_thread_item_thread">发布于 %1$s</string>
|
<string name="tip_thread_item_thread">%1$s 来自 %2$s</string>
|
||||||
<string name="title_all_reply">全部</string>
|
<string name="title_all_reply">全部</string>
|
||||||
<string name="title_thread_header">回复 %1$s</string>
|
<string name="title_thread_header">回复 %1$s</string>
|
||||||
<string name="btn_agree_post">%1$s 赞</string>
|
<string name="btn_agree_post">%1$s 赞</string>
|
||||||
|
|
@ -521,4 +521,5 @@
|
||||||
<string name="usage_webview_location_permission">用于向当前访问的网页提供你的位置信息,以便该网页向你提供相关服务。</string>
|
<string name="usage_webview_location_permission">用于向当前访问的网页提供你的位置信息,以便该网页向你提供相关服务。</string>
|
||||||
<string name="title_hide_forum_intro_and_stat">精简吧页面</string>
|
<string name="title_hide_forum_intro_and_stat">精简吧页面</string>
|
||||||
<string name="summary_hide_forum_intro_and_stat">开启后将隐藏吧页面的吧简介和数据(仍然可以通过“关于本吧”查看这些内容)</string>
|
<string name="summary_hide_forum_intro_and_stat">开启后将隐藏吧页面的吧简介和数据(仍然可以通过“关于本吧”查看这些内容)</string>
|
||||||
|
<string name="relative_date_today">今天 %1$s</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue