mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-28 12:07:35 +01:00
ActivityStackGraph now only displays Month Day without clock.
This commit is contained in:
parent
4d92e67caa
commit
673e0a2790
@ -47,6 +47,16 @@ public class FormatUtils {
|
||||
return formatMilliseconds(Math.abs(after - before));
|
||||
}
|
||||
|
||||
public static String formatTimeStampDay(long epochMs) {
|
||||
String format = "MMMMM d";
|
||||
|
||||
if (Settings.FORMAT_DATE_RECENT_DAYS.isTrue()) {
|
||||
format = replaceRecentDays(epochMs, format, "MMMMM");
|
||||
}
|
||||
|
||||
return format(epochMs, format);
|
||||
}
|
||||
|
||||
public static String formatTimeStampClock(long epochMs) {
|
||||
String format = Settings.FORMAT_DATE_CLOCK.toString();
|
||||
|
||||
@ -71,9 +81,12 @@ public class FormatUtils {
|
||||
}
|
||||
|
||||
private static String replaceRecentDays(long epochMs, String format) {
|
||||
return replaceRecentDays(epochMs, format, Settings.FORMAT_DATE_RECENT_DAYS_PATTERN.toString());
|
||||
}
|
||||
|
||||
private static String replaceRecentDays(long epochMs, String format, String pattern) {
|
||||
long now = MiscUtils.getTime();
|
||||
|
||||
String pattern = Settings.FORMAT_DATE_RECENT_DAYS_PATTERN.toString();
|
||||
long fromStartOfDay = now % TimeAmount.DAY.ms();
|
||||
if (epochMs > now - fromStartOfDay) {
|
||||
format = format.replace(pattern, "'Today'");
|
||||
|
@ -28,7 +28,7 @@ public class ActivityStackGraph extends AbstractStackGraph {
|
||||
|
||||
private static String[] getLabels(NavigableSet<Long> dates) {
|
||||
return dates.stream()
|
||||
.map(FormatUtils::formatTimeStampYear)
|
||||
.map(FormatUtils::formatTimeStampDay)
|
||||
.toArray(String[]::new);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user