public final class DilbertPreferences
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static org.joda.time.format.DateTimeFormatter |
DATE_FORMATTER |
static org.joda.time.format.DateTimeFormatter |
NICE_DATE_FORMATTER |
static org.joda.time.DateTimeZone |
TIME_ZONE |
Constructor and Description |
---|
DilbertPreferences(android.content.Context context) |
Modifier and Type | Method and Description |
---|---|
boolean |
deleteDateForWidgetId(int widgetId)
Removing widget from launcher will cause deleting it's save date from preferences
|
void |
downloadImageViaManager(android.app.Activity activity,
java.lang.String downloadUrl,
org.joda.time.LocalDate stripDate)
Tries to launch DownloadManager with visible notification to download file from URL to
downloadble path or user selected
|
java.util.List<FavoritedItem> |
getCachedDates()
Gets list of FavoritedItem where it's not really favorites,
but dates for which we already have parsed URL
|
java.lang.String |
getCachedTitle(org.joda.time.LocalDate dateKey)
Returns cached strip title for provided date
|
java.lang.String |
getCachedUrl(org.joda.time.LocalDate dateKey)
Returns cached URL for provided date
|
org.joda.time.LocalDate |
getCurrentDate()
Retrieves last viewed strip date
|
org.joda.time.LocalDate |
getDateForWidgetId(int appWidgetId)
Returns saved date for specific widget id
|
int |
getDefaultZoomLevel() |
java.util.List<FavoritedItem> |
getFavoritedItems()
Retrieves list of favorited items, which is stored in as plain in local preferences
|
static org.joda.time.LocalDate |
getFirstStripDate()
First strip was published on 16.4.1989
|
int |
getLandscapeOrientation() |
static org.joda.time.LocalDate |
getRandomDate()
Generated random date within range of Dilbert existence
|
java.lang.String |
getScheduledTargetPath(java.lang.String downloadDate)
Retrieves requested target path, to which the downloaded file should be moved
|
boolean |
isDarkLayoutEnabled() |
boolean |
isFavorited(org.joda.time.LocalDate currentDay)
Verifies if the date is associated with favorited flag
|
boolean |
isForceLandscape()
Checks, if user preference is to force landscape orientation
|
boolean |
isSharingImage() |
boolean |
isToolbarsHidden() |
boolean |
isWidgetAlwaysShowLatest() |
boolean |
isWidgetShowTitle() |
boolean |
removeCache(org.joda.time.LocalDate currentDate)
Removes cached URL for provided date
|
boolean |
saveCurrentDate(org.joda.time.LocalDate currentDate)
Saves last viewed date in preferences
|
boolean |
saveCurrentTitle(java.lang.String date,
java.lang.String s)
Saves retrieved strip title for date
|
boolean |
saveCurrentUrl(java.lang.String date,
java.lang.String s)
Saves retrieved URL for date
|
boolean |
saveDateForWidgetId(int appWidgetId,
org.joda.time.LocalDate date)
Saves date for widget, after user made change to it
|
boolean |
setIsToolbarsHidden(boolean hidden) |
boolean |
setWidgetShowTitle(boolean showTitle) |
boolean |
toggleIsFavorited(org.joda.time.LocalDate currentDay)
Toggles favorite state for provided date
|
public static final org.joda.time.DateTimeZone TIME_ZONE
public static final org.joda.time.format.DateTimeFormatter DATE_FORMATTER
public static final org.joda.time.format.DateTimeFormatter NICE_DATE_FORMATTER
public static org.joda.time.LocalDate getRandomDate()
public static org.joda.time.LocalDate getFirstStripDate()
public org.joda.time.LocalDate getCurrentDate()
public boolean saveCurrentDate(org.joda.time.LocalDate currentDate)
currentDate
- date of last viewed strippublic boolean saveCurrentUrl(java.lang.String date, java.lang.String s)
date
- string identifier of comics strips
- url of strippublic boolean saveCurrentTitle(java.lang.String date, java.lang.String s)
date
- string identifier of comics strips
- title of strippublic java.lang.String getCachedUrl(org.joda.time.LocalDate dateKey)
dateKey
- LocalDate of itempublic java.lang.String getCachedTitle(org.joda.time.LocalDate dateKey)
dateKey
- LocalDate of itempublic boolean removeCache(org.joda.time.LocalDate currentDate)
currentDate
- date for which the cache should be deletedpublic boolean isFavorited(org.joda.time.LocalDate currentDay)
currentDay
- date of favorited itempublic boolean toggleIsFavorited(org.joda.time.LocalDate currentDay)
currentDay
- date of favorited itempublic java.util.List<FavoritedItem> getCachedDates()
public java.util.List<FavoritedItem> getFavoritedItems()
public void downloadImageViaManager(android.app.Activity activity, java.lang.String downloadUrl, org.joda.time.LocalDate stripDate)
activity
- Activity context to access system services and Toast notificationsdownloadUrl
- url from which the image is downloadedstripDate
- date of strip being downloadedpublic java.lang.String getScheduledTargetPath(java.lang.String downloadDate)
downloadDate
- date in format YYYY-MM-DDUri.toString()
public boolean saveDateForWidgetId(int appWidgetId, org.joda.time.LocalDate date)
appWidgetId
- id of widgetdate
- date which is currently selectedpublic org.joda.time.LocalDate getDateForWidgetId(int appWidgetId)
appWidgetId
- id of widgetpublic boolean deleteDateForWidgetId(int widgetId)
widgetId
- id of widgetpublic boolean isForceLandscape()
public boolean isDarkLayoutEnabled()
public boolean isToolbarsHidden()
public boolean setIsToolbarsHidden(boolean hidden)
public boolean isSharingImage()
public boolean isWidgetAlwaysShowLatest()
public boolean setWidgetShowTitle(boolean showTitle)
public boolean isWidgetShowTitle()
public int getDefaultZoomLevel()
public int getLandscapeOrientation()