public final class SharedPreferencesStore extends java.lang.Object implements NotificationStore
NotificationStore
which utilizes Androids Shared Preferences.Constructor and Description |
---|
SharedPreferencesStore(android.content.SharedPreferences sharedPreferences)
Constructs a new
SharedPreferencesStore and initializes it with the underlying SharedPreferences
object. |
Modifier and Type | Method and Description |
---|---|
void |
clearPersistentNotifications()
Removes all notifications from the store.
|
java.util.Date |
getLastServerUpdate()
Loads the date when the notifications was updated from the server the last time.
|
java.util.Set<PersistentNotification> |
getPersistentNotifications()
Loads all saved
PersistentNotification s. |
void |
replacePersistentNotifications(java.util.Set<PersistentNotification> persistentNotifications)
Replaces the currently stored
PersistentNotification s by the passed ones. |
void |
saveLastServerUpdate(java.util.Date date)
Saves the date when the notifications was updated from the server the last time.
|
void |
updatePersistentNotification(java.util.Set<PersistentNotification> updatePersistentNotifications)
Updates the
PersistentNotification in the NotificationStore with the given
updatePersistentNotifications . |
public SharedPreferencesStore(android.content.SharedPreferences sharedPreferences)
SharedPreferencesStore
and initializes it with the underlying SharedPreferences
object.sharedPreferences
- The SharedPreferences
instance which is used to store AlertDialogNotification
s.public java.util.Date getLastServerUpdate()
NotificationStore
getLastServerUpdate
in interface NotificationStore
public void saveLastServerUpdate(java.util.Date date)
NotificationStore
saveLastServerUpdate
in interface NotificationStore
date
- The last update date.public java.util.Set<PersistentNotification> getPersistentNotifications()
NotificationStore
PersistentNotification
s.getPersistentNotifications
in interface NotificationStore
PersistentNotification
spublic void updatePersistentNotification(java.util.Set<PersistentNotification> updatePersistentNotifications)
NotificationStore
PersistentNotification
in the NotificationStore
with the given
updatePersistentNotifications
. The notifications to update are identified by their hashCode/equals
methods.updatePersistentNotification
in interface NotificationStore
updatePersistentNotifications
- The PersistentNotification
to update.public void replacePersistentNotifications(java.util.Set<PersistentNotification> persistentNotifications)
NotificationStore
PersistentNotification
s by the passed ones.replacePersistentNotifications
in interface NotificationStore
persistentNotifications
- The PersistentNotification
s to store.public void clearPersistentNotifications()
NotificationStore
clearPersistentNotifications
in interface NotificationStore