Class WeatherWarnings
- java.lang.Object
-
- de.kaffeemitkoffein.tinyweatherforecastgermany.WeatherWarnings
-
public class WeatherWarnings extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WeatherWarnings.getWarningsForLocationRunnable
static class
WeatherWarnings.NotificationListDbHelper
static class
WeatherWarnings.WarningNotification
static class
WeatherWarnings.WarningStringType
-
Field Summary
Fields Modifier and Type Field Description static int
COMMUNEUNION_DWD_DIFF
static int
COMMUNEUNION_DWD_STAT
static java.text.SimpleDateFormat
simpleDateFormat
static java.text.SimpleDateFormat
simpleDateFormat2
-
Constructor Summary
Constructors Constructor Description WeatherWarnings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
addToNotified(Context context, WeatherWarning warning, int id)
static long
addToNotified(Context context, WeatherWarnings.WarningNotification warningNotification)
static boolean
alreadyNotified(Context context, WeatherWarning weatherWarning)
static void
cleanWeatherWarningsDatabase(Context context)
static int
clearAllNotified(Context context)
static int
clearNotified(Context context)
static java.util.ArrayList<WeatherWarning>
getCurrentWarnings(Context context, boolean initPolygons)
static java.util.ArrayList<java.lang.Integer>
getExpiredWarningIds(Context context)
static java.lang.String
getExpiresMiniString(Context context, WeatherWarning weatherWarning)
static long
getFirstNotificationCancelTimeInMillis(Context context)
static int
getFirstWarningPosition(java.util.ArrayList<WeatherWarning> fullList, java.util.ArrayList<WeatherWarning> applyingList)
Determines first position in fullList that corresponds to the items in applyingList, defined by "identifier".static SpannableStringBuilder
getMiniWarningsString(Context context, java.util.ArrayList<WeatherWarning> applicableWarnings, long itemStartTime, long itemStopTime, boolean multiLine, int textType)
static java.util.ArrayList<WeatherWarnings.WarningNotification>
getNotificationElements(Context context)
static java.lang.Integer
getNotificationIdFromWeatherWarning(java.util.ArrayList<WeatherWarnings.WarningNotification> warningNotifications, WeatherWarning weatherWarning)
static java.lang.String
getOnsetMiniString(Context context, WeatherWarning weatherWarning)
static java.lang.String
getTimeMiniString(long time)
static java.util.ArrayList<WeatherWarning>
getWarningsForLocation(Context context, java.util.ArrayList<WeatherWarning> warnings, Weather.WeatherLocation location)
static boolean
isMoreThan24hAway(long start)
static void
writeWarningsToDatabase(Context context, java.util.ArrayList<WeatherWarning> warnings)
-
-
-
Field Detail
-
COMMUNEUNION_DWD_DIFF
public static final int COMMUNEUNION_DWD_DIFF
- See Also:
- Constant Field Values
-
COMMUNEUNION_DWD_STAT
public static final int COMMUNEUNION_DWD_STAT
- See Also:
- Constant Field Values
-
simpleDateFormat
public static final java.text.SimpleDateFormat simpleDateFormat
-
simpleDateFormat2
public static final java.text.SimpleDateFormat simpleDateFormat2
-
-
Method Detail
-
writeWarningsToDatabase
public static void writeWarningsToDatabase(Context context, java.util.ArrayList<WeatherWarning> warnings)
-
getCurrentWarnings
public static java.util.ArrayList<WeatherWarning> getCurrentWarnings(Context context, boolean initPolygons)
-
cleanWeatherWarningsDatabase
public static void cleanWeatherWarningsDatabase(Context context)
-
getWarningsForLocation
public static java.util.ArrayList<WeatherWarning> getWarningsForLocation(Context context, java.util.ArrayList<WeatherWarning> warnings, Weather.WeatherLocation location)
-
isMoreThan24hAway
public static boolean isMoreThan24hAway(long start)
-
getTimeMiniString
public static java.lang.String getTimeMiniString(long time)
-
getOnsetMiniString
public static java.lang.String getOnsetMiniString(Context context, WeatherWarning weatherWarning)
-
getExpiresMiniString
public static java.lang.String getExpiresMiniString(Context context, WeatherWarning weatherWarning)
-
getMiniWarningsString
public static SpannableStringBuilder getMiniWarningsString(Context context, java.util.ArrayList<WeatherWarning> applicableWarnings, long itemStartTime, long itemStopTime, boolean multiLine, int textType)
-
addToNotified
public static long addToNotified(Context context, WeatherWarnings.WarningNotification warningNotification)
-
addToNotified
public static long addToNotified(Context context, WeatherWarning warning, int id)
-
getNotificationElements
public static java.util.ArrayList<WeatherWarnings.WarningNotification> getNotificationElements(Context context)
-
getNotificationIdFromWeatherWarning
public static java.lang.Integer getNotificationIdFromWeatherWarning(java.util.ArrayList<WeatherWarnings.WarningNotification> warningNotifications, WeatherWarning weatherWarning)
-
getExpiredWarningIds
public static java.util.ArrayList<java.lang.Integer> getExpiredWarningIds(Context context)
-
alreadyNotified
public static boolean alreadyNotified(Context context, WeatherWarning weatherWarning)
-
clearNotified
public static int clearNotified(Context context)
-
clearAllNotified
public static int clearAllNotified(Context context)
-
getFirstNotificationCancelTimeInMillis
public static long getFirstNotificationCancelTimeInMillis(Context context)
-
getFirstWarningPosition
public static int getFirstWarningPosition(java.util.ArrayList<WeatherWarning> fullList, java.util.ArrayList<WeatherWarning> applyingList)
Determines first position in fullList that corresponds to the items in applyingList, defined by "identifier". As both warning lists are sorted by serverity, it also returns the 1st item of the highest severity. If more than one item has the highest severity, simply the first one found is retured. Both lists may not be null! Returns 0 if no warnings are found.- Parameters:
fullList
-applyingList
-- Returns:
-
-