java.lang.Object
de.kaffeemitkoffein.tinyweatherforecastgermany.DataStorage

public class DataStorage extends Object
  • Field Details

    • DATASTORAGE_STATION

      public static final int DATASTORAGE_STATION
      See Also:
    • DATASTORAGE_TEST

      public static final int DATASTORAGE_TEST
      See Also:
    • DATASTORAGE_POLLENREGION_ID

      public static final int DATASTORAGE_POLLENREGION_ID
      See Also:
    • DATASTORAGE_POLLENPARTREGION_ID

      public static final int DATASTORAGE_POLLENPARTREGION_ID
      See Also:
    • DATASTORAGE_POLLENREGION_DESCRIPTION

      public static final int DATASTORAGE_POLLENREGION_DESCRIPTION
      See Also:
    • DATASTORAGE_LASTGPSFIX

      public static final int DATASTORAGE_LASTGPSFIX
      See Also:
    • DATASTORAGE_NOTIFICATION_IDENTIFIER

      public static final int DATASTORAGE_NOTIFICATION_IDENTIFIER
      See Also:
    • DATASTORAGE_LAST_NOTIFICATIONS_UPDATE_TIME

      public static final int DATASTORAGE_LAST_NOTIFICATIONS_UPDATE_TIME
      See Also:
    • DATASTORAGE_NC_CHANNEL_DETAIL

      public static final int DATASTORAGE_NC_CHANNEL_DETAIL
      See Also:
    • DATASTORAGE_WEATHERUPDATEDFLAG

      public static final int DATASTORAGE_WEATHERUPDATEDFLAG
      See Also:
    • DATASTORAGE_RADAR_LASTDATAPOLL

      public static final int DATASTORAGE_RADAR_LASTDATAPOLL
      See Also:
    • DATASTORAGE_VIEWS_LAST_UPDATE_TIME

      public static final int DATASTORAGE_VIEWS_LAST_UPDATE_TIME
      See Also:
    • DATASTORAGE_GADGETBRIDGE_LASTUPDATE

      public static final int DATASTORAGE_GADGETBRIDGE_LASTUPDATE
      See Also:
    • DATASTORAGE_POLLENREGION_ID_DEFAULT

      public static final int DATASTORAGE_POLLENREGION_ID_DEFAULT
      See Also:
    • DATASTORAGE_POLLENPARTREGION_ID_DEFAULT

      public static final int DATASTORAGE_POLLENPARTREGION_ID_DEFAULT
      See Also:
    • DATASTORAGE_POLLENREGION_DESCRIPTION_DEFAULT

      public static final String DATASTORAGE_POLLENREGION_DESCRIPTION_DEFAULT
      See Also:
    • DATASTORAGE_LASTGPSFIX_DEFAULT

      public static final long DATASTORAGE_LASTGPSFIX_DEFAULT
      See Also:
    • DATASTORAGE_NOTIFICATION_IDENTIFIER_DEFAULT

      public static final int DATASTORAGE_NOTIFICATION_IDENTIFIER_DEFAULT
      See Also:
    • DATASTORAGE_LAST_NOTIFICATIONS_UPDATE_TIME_DEFAULT

      public static final long DATASTORAGE_LAST_NOTIFICATIONS_UPDATE_TIME_DEFAULT
      See Also:
    • DATASTORAGE_NC_CHANNEL_DETAIL_DEFAULT

      public static final long DATASTORAGE_NC_CHANNEL_DETAIL_DEFAULT
      See Also:
    • DATASTORAGE_WEATHERUPDATEDFLAG_DEFAULT

      public static final int DATASTORAGE_WEATHERUPDATEDFLAG_DEFAULT
      See Also:
    • DATASTORAGE_RADAR_LASTDATAPOLL_DEFAULT

      public static final long DATASTORAGE_RADAR_LASTDATAPOLL_DEFAULT
      See Also:
    • DATASTORAGE_VIEWS_LAST_UPDATE_TIME_DEFAULT

      public static final long DATASTORAGE_VIEWS_LAST_UPDATE_TIME_DEFAULT
      See Also:
    • DATASTORAGE_GADGETBRIDGE_LASTUPDATE_DEFAULT

      public static final long DATASTORAGE_GADGETBRIDGE_LASTUPDATE_DEFAULT
      See Also:
  • Constructor Details

    • DataStorage

      public DataStorage()
  • Method Details

    • readAllPackages

      public static ArrayList<DataPackage> readAllPackages(Context context)
    • printPackages

      public static void printPackages(Context context, ArrayList<DataPackage> dataPackages)
    • readDataPackage

      public static DataPackage readDataPackage(Context context, int id)
      Retrieves a single data package from storage by its ID. This is the core read method used by all typed getter methods (getInt, getLong, etc.). The method queries the database using the ContentResolver, retrieves the cursor, and converts the first matching row into a DataPackage object.
      Parameters:
      context - the application context
      id - the storage ID constant identifying which data to retrieve
      Returns:
      the DataPackage containing the stored value, or null if not found
    • clear

      public static void clear(Context context)
    • setBlob

      public static void setBlob(Context context, int id, byte[] value)
    • getBlob

      public static byte[] getBlob(Context context, int id, byte[] defaultValue)
    • setFloat

      public static void setFloat(Context context, int id, float value)
    • getFloat

      public static float getFloat(Context context, int id, float defaultValue)
    • setInt

      public static void setInt(Context context, int id, int value)
    • getInt

      public static int getInt(Context context, int id, int defaultValue)
    • setLong

      public static void setLong(Context context, int id, long value)
    • getLong

      public static long getLong(Context context, int id, long defaultValue)
    • setString

      public static void setString(Context context, int id, String value)
    • getString

      public static String getString(Context context, int id, String defaultValue)
    • setBoolean

      public static void setBoolean(Context context, int id, boolean value)
    • getBoolean

      public static boolean getBoolean(Context context, int id, boolean defaultValue)
      Retrieves a boolean value from storage. Note: Boolean values are stored as long (0 for false, non-zero for true).
      Parameters:
      context - the application context
      id - the storage ID constant
      defaultValue - the default value to return if no data exists
      Returns:
      the stored boolean value, or defaultValue if not found
    • setStation

      public static void setStation(Context context, Weather.WeatherLocation weatherLocation)
      Stores the currently selected weather station location in persistent storage. The location is serialized to a string format before storage.
      Parameters:
      context - the application context
      weatherLocation - the weather station location to store
    • getSetStationLocation

      public static Weather.WeatherLocation getSetStationLocation(Context context)
      Retrieves the currently selected weather station location from storage. If no station has been set, this method initializes storage with the default station and returns that default location. This is a "get-or-set" pattern: it guarantees a valid weather location is always returned by creating and storing a default if none exists.
      Parameters:
      context - the application context
      Returns:
      the stored weather location, or the default location if none was previously set