java.lang.Object
de.kaffeemitkoffein.tinyweatherforecastgermany.Weather

public final class Weather extends Object
  • Field Details

  • Constructor Details

    • Weather

      public Weather()
  • Method Details

    • hasCurrentWeatherInfo

      public static boolean hasCurrentWeatherInfo(Context context)
    • getCurrentWeatherInfo

      public static CurrentWeatherInfo getCurrentWeatherInfo(Context context)
    • hasUVHIData

      public static boolean hasUVHIData(Context context)
    • getPollingTime

      public static long getPollingTime(Context context)
    • sanitizeDatabase

      public static void sanitizeDatabase(Context context)
    • getRiseset

      public static Astronomy.Riseset getRiseset(Weather.WeatherLocation weatherLocation, long time)
    • getMoonRiseset

      public static Astronomy.Riseset getMoonRiseset(Weather.WeatherLocation weatherLocation, long time)
    • isMoonTime

      public static boolean isMoonTime(Weather.WeatherLocation weatherLocation, long time)
    • getMidnightTime

      public static long getMidnightTime(long time)
    • getNextMidnightTime

      public static long getNextMidnightTime(long time)
    • getApproxMoonPositionOnSky

      public static float getApproxMoonPositionOnSky(Weather.WeatherLocation weatherLocation, long time)
      Determines the approximate position of the moon on the sky based on rise and set times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.
      Parameters:
      weatherLocation - the location to calculate the value for
      time - the time in UTC (milliseconds)
      Returns:
      the approximate position, where 0 is rise and 1 is set. Returns -1 if the moon is not visible at the time.
    • getApproxSunPositionOnSky

      public static float getApproxSunPositionOnSky(Weather.WeatherLocation weatherLocation, long time)
      Determines the approximate position of the sun on the sky based on sunrise and sunset times. Note: to eliminate possible time shifts between rise sets of different days, in most cases this calculation is averaged over three hours.
      Parameters:
      weatherLocation - the location to calculate the value for
      time - the time in UTC (milliseconds)
      Returns:
      the approximate position, where 0 is sunrise, 0.5 is midday and 1 is sunset. Returns -1 if the sun is not visible at the time.
    • isDaytime

      public static boolean isDaytime(Weather.WeatherLocation weatherLocation, long time)
    • usePreciseIsDaytime

      public static boolean usePreciseIsDaytime(Weather.WeatherLocation weatherLocation)
      Returns if a precise calculation of day/night time with the Astronomy class makes sense. It makes sense between a latutide of -65° to +65°, but not further south or north.
      Parameters:
      weatherLocation -
      Returns:
    • getSunsetInUTC

      public static long getSunsetInUTC(Astronomy.Riseset riseset, long time)
    • getSunsetInUTC

      public static long getSunsetInUTC(Weather.WeatherLocation weatherLocation, long time)
    • getSunsetInUTC

      public static long getSunsetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getSunriseInUTC

      public static long getSunriseInUTC(Astronomy.Riseset riseset, long time)
    • getSunriseInUTC

      public static long getSunriseInUTC(Weather.WeatherLocation weatherLocation, long time)
    • getSunriseInUTC

      public static long getSunriseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getCivilTwilightMorning

      public static long getCivilTwilightMorning(Astronomy.Riseset riseset, long time)
    • getCivilTwilightMorning

      public static long getCivilTwilightMorning(Weather.WeatherLocation weatherLocation, long time)
    • getCivilTwilightMorning

      public static long getCivilTwilightMorning(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getCivilTwilightEvening

      public static long getCivilTwilightEvening(Astronomy.Riseset riseset, long time)
    • getCivilTwilightEvening

      public static long getCivilTwilightEvening(Weather.WeatherLocation weatherLocation, long time)
    • getCivilTwilightEvening

      public static long getCivilTwilightEvening(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getMoonRiseInUTC

      public static long getMoonRiseInUTC(Astronomy.Riseset riseset, long time)
    • getMoonRiseInUTC

      public static long getMoonRiseInUTC(Weather.WeatherLocation weatherLocation, long time)
    • getMoonRiseInUTC

      public static long getMoonRiseInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getMoonSetInUTC

      public static long getMoonSetInUTC(Astronomy.Riseset riseset, long time)
    • getMoonSetInUTC

      public static long getMoonSetInUTC(Weather.WeatherLocation weatherLocation, long time)
    • getMoonSetInUTC

      public static long getMoonSetInUTC(Weather.WeatherLocation weatherLocation, Weather.WeatherInfo weatherInfo)
    • getMoonPhaseDay

      public static double getMoonPhaseDay(long time)
      Calculates the moon day from the current time.
      Parameters:
      time - in milliseconds epoch time
      Returns:
      day of the moon phase; range 0 - 29.53
    • getMoonPhase

      public static double getMoonPhase(long time)
      Calculates the moon phase from the current time.
      Parameters:
      time - in milliseconds epoch time
      Returns:
      the moon phase; range 0 - 1, where 0 is new moon and 0.5 is full moon
    • getMoonPhaseInDegrees

      public static int getMoonPhaseInDegrees(long time)
      Calculates the moon phase from the current time.
      Parameters:
      time - in milliseconds epoch time
      Returns:
      the moon phase in degrees; range 0 - 360, where 0 is new moon and 180 is full moon
    • isSunriseInIntervalUTC

      public static boolean isSunriseInIntervalUTC(Astronomy.Riseset riseset, long start, long stop)
    • isSunsetInIntervalUTC

      public static boolean isSunsetInIntervalUTC(Astronomy.Riseset riseset, long start, long stop)
    • toHourMinuteString

      public static String toHourMinuteString(long time)
    • toFullDateTimeString

      public static String toFullDateTimeString(long time)
    • getWindUnitString

      public static String getWindUnitString(int type)
    • getWindString

      public static String getWindString(Context context, CurrentWeatherInfo weatherCard)
    • removeForecastsFromDatabase

      public static void removeForecastsFromDatabase(Context context)
    • getSimpleDateFormat

      public static SimpleDateFormat getSimpleDateFormat(int format)
    • GetDateString

      public static String GetDateString(SimpleDateFormat simpleDateFormat, long time)
    • suitableNetworkAvailable

      public static boolean suitableNetworkAvailable(Context context)