diff options
author | Stefan Niedermann <info@niedermann.it> | 2020-10-29 11:57:42 +0300 |
---|---|---|
committer | Stefan Niedermann <info@niedermann.it> | 2020-10-29 11:57:42 +0300 |
commit | 11f07f5b7e5ac4088cf98c866ebaf3806d5bccbc (patch) | |
tree | 37904d3037c083d6bbc35841019bbf0ef22a22cd /app/src/main/java/it/niedermann/nextcloud/deck/api | |
parent | 5efa3495cfb59c2637da6d47bf1f754d71f80482 (diff) |
#715 Use java.time.*
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/api')
-rw-r--r-- | app/src/main/java/it/niedermann/nextcloud/deck/api/LastSyncUtil.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/api/LastSyncUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/api/LastSyncUtil.java index 1d44bfe13..33159633f 100644 --- a/app/src/main/java/it/niedermann/nextcloud/deck/api/LastSyncUtil.java +++ b/app/src/main/java/it/niedermann/nextcloud/deck/api/LastSyncUtil.java @@ -3,6 +3,7 @@ package it.niedermann.nextcloud.deck.api; import android.content.Context; import android.content.SharedPreferences; +import java.time.Instant; import java.util.Date; import it.niedermann.nextcloud.deck.R; @@ -22,19 +23,19 @@ public class LastSyncUtil { } - public static long getLastSync(long accountId){ + public static long getLastSync(long accountId) { return INSTANCE.lastSyncPref.getLong(getSyncKeyForAccount(accountId), 0L); } - public static Date getLastSyncDate(long accountId){ - return new Date(getLastSync(accountId)); + public static Instant getLastSyncDate(long accountId) { + return Instant.ofEpochMilli(getLastSync(accountId)); } - public static void setLastSyncDate(long accountId, Date value){ + public static void setLastSyncDate(long accountId, Date value) { INSTANCE.lastSyncPref.edit().putLong(getSyncKeyForAccount(accountId), value.getTime()).apply(); } - public static void resetLastSyncDate(long accountId){ + public static void resetLastSyncDate(long accountId) { INSTANCE.lastSyncPref.edit().remove(getSyncKeyForAccount(accountId)).apply(); } |