public class

WeatherUtils

extends Object
java.lang.Object
   ↳ lineageos.weather.util.WeatherUtils

Class Overview

Helper class to perform operations and formatting of weather data

Summary

Public Constructors
WeatherUtils()
Public Methods
static double celsiusToFahrenheit(double celsius)
Converts a temperature expressed in degrees Celsius to degrees Fahrenheit
static double fahrenheitToCelsius(double fahrenheit)
Converts a temperature expressed in degrees Fahrenheit to degrees Celsius
static String formatTemperature(double temperature, int tempUnit)
Returns a string representation of the temperature and unit supplied.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public WeatherUtils ()

Public Methods

public static double celsiusToFahrenheit (double celsius)

Converts a temperature expressed in degrees Celsius to degrees Fahrenheit

Parameters
celsius double: temperature in Celsius
Returns
double the temperature in degrees Fahrenheit

public static double fahrenheitToCelsius (double fahrenheit)

Converts a temperature expressed in degrees Fahrenheit to degrees Celsius

Parameters
fahrenheit double: temperature in Fahrenheit
Returns
double the temperature in degrees Celsius

public static String formatTemperature (double temperature, int tempUnit)

Returns a string representation of the temperature and unit supplied. The temperature value will be half-even rounded.

Parameters
temperature double: the temperature value
tempUnit int: A valid WeatherContract.WeatherColumns.TempUnit
Returns
String A string with the format XX°F or XX°C (where XX is the temperature) depending on the temperature unit that was provided or null if an invalid unit is supplied