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 classWeatherWarnings.getWarningsForLocationRunnablestatic classWeatherWarnings.NotificationListDbHelperstatic classWeatherWarnings.WarningNotificationstatic classWeatherWarnings.WarningStringType
-
Field Summary
Fields Modifier and Type Field Description static intCOMMUNEUNION_DWD_DIFFstatic intCOMMUNEUNION_DWD_STATstatic java.text.SimpleDateFormatsimpleDateFormatstatic java.text.SimpleDateFormatsimpleDateFormat2
-
Constructor Summary
Constructors Constructor Description WeatherWarnings()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longaddToNotified(Context context, WeatherWarning warning, int id)static longaddToNotified(Context context, WeatherWarnings.WarningNotification warningNotification)static booleanalreadyNotified(Context context, WeatherWarning weatherWarning)static voidcleanWeatherWarningsDatabase(Context context)static intclearAllNotified(Context context)static intclearNotified(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.StringgetExpiresMiniString(Context context, WeatherWarning weatherWarning)static longgetFirstNotificationCancelTimeInMillis(Context context)static intgetFirstWarningPosition(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 SpannableStringBuildergetMiniWarningsString(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.IntegergetNotificationIdFromWeatherWarning(java.util.ArrayList<WeatherWarnings.WarningNotification> warningNotifications, WeatherWarning weatherWarning)static java.lang.StringgetOnsetMiniString(Context context, WeatherWarning weatherWarning)static java.lang.StringgetTimeMiniString(long time)static java.util.ArrayList<WeatherWarning>getWarningsForLocation(Context context, java.util.ArrayList<WeatherWarning> warnings, Weather.WeatherLocation location)static booleanisMoreThan24hAway(long start)static voidwriteWarningsToDatabase(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:
-
-