mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Add JvmStatic annotations to static kotlin methods of weather classes
This commit is contained in:
committed by
José Rebelo
parent
9aaa582331
commit
9111676bb2
@@ -311,7 +311,7 @@ public class GBApplication extends Application {
|
||||
|
||||
setupExceptionHandler(prefs.getBoolean("crash_notification", isDebug()));
|
||||
|
||||
Weather.INSTANCE.initializeCache(new WeatherCacheManager(getCacheDir(), prefs.getBoolean("cache_weather", true)));
|
||||
Weather.initializeCache(new WeatherCacheManager(getCacheDir(), prefs.getBoolean("cache_weather", true)));
|
||||
|
||||
deviceManager = new DeviceManager(this);
|
||||
String language = prefs.getString("language", "default");
|
||||
|
||||
+5
-5
@@ -363,13 +363,13 @@ public class DebugActivity extends AbstractGBActivity {
|
||||
setWeatherButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (Weather.INSTANCE.getWeatherSpec() == null) {
|
||||
if (Weather.getWeatherSpec() == null) {
|
||||
final WeatherSpec weatherSpec = new WeatherSpec();
|
||||
weatherSpec.setForecasts(new ArrayList<>());
|
||||
|
||||
weatherSpec.setLocation("Green Hill");
|
||||
weatherSpec.setCurrentConditionCode(601); // snow
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.INSTANCE.getConditionString(DebugActivity.this, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.getConditionString(DebugActivity.this, weatherSpec.getCurrentConditionCode()));
|
||||
|
||||
weatherSpec.setCurrentTemp(15 + 273);
|
||||
weatherSpec.setCurrentHumidity(30);
|
||||
@@ -389,10 +389,10 @@ public class DebugActivity extends AbstractGBActivity {
|
||||
weatherSpec.getForecasts().add(gbForecast);
|
||||
}
|
||||
|
||||
Weather.INSTANCE.setWeatherSpec(new ArrayList<>(Collections.singletonList(weatherSpec)));
|
||||
Weather.setWeatherSpec(new ArrayList<>(Collections.singletonList(weatherSpec)));
|
||||
}
|
||||
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(Weather.INSTANCE.getWeatherSpecs());
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(Weather.getWeatherSpecs());
|
||||
GBApplication.deviceService().onSendWeather(specs);
|
||||
}
|
||||
});
|
||||
@@ -401,7 +401,7 @@ public class DebugActivity extends AbstractGBActivity {
|
||||
showCachedWeatherButton.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final List<WeatherSpec> weatherSpecs = Weather.INSTANCE.getWeatherSpecs();
|
||||
final List<WeatherSpec> weatherSpecs = Weather.getWeatherSpecs();
|
||||
|
||||
if (weatherSpecs == null || weatherSpecs.isEmpty()) {
|
||||
displayWeatherInfo(null);
|
||||
|
||||
+1
-1
@@ -169,7 +169,7 @@ public class SettingsActivity extends AbstractSettingsActivityV2 {
|
||||
pref.setOnPreferenceChangeListener((preference, newVal) -> {
|
||||
boolean doEnable = Boolean.TRUE.equals(newVal);
|
||||
|
||||
Weather.INSTANCE.initializeCache(new WeatherCacheManager(requireContext().getCacheDir(), doEnable));
|
||||
Weather.initializeCache(new WeatherCacheManager(requireContext().getCacheDir(), doEnable));
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
+4
-4
@@ -159,8 +159,8 @@ public class CMWeatherReceiver extends BroadcastReceiver implements CMWeatherMan
|
||||
}
|
||||
weatherSpec.setWindDirection((int) weatherInfo.getWindDirection());
|
||||
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(CMtoYahooCondintion(weatherInfo.getConditionCode())));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.INSTANCE.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(CMtoYahooCondintion(weatherInfo.getConditionCode())));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentHumidity((int) weatherInfo.getHumidity());
|
||||
|
||||
weatherSpec.setForecasts(new ArrayList<>());
|
||||
@@ -175,11 +175,11 @@ public class CMWeatherReceiver extends BroadcastReceiver implements CMWeatherMan
|
||||
gbForecast.setMaxTemp((int) cmForecast.getHigh() + 273);
|
||||
gbForecast.setMinTemp((int) cmForecast.getLow() + 273);
|
||||
}
|
||||
gbForecast.setConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(CMtoYahooCondintion(cmForecast.getConditionCode())));
|
||||
gbForecast.setConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(CMtoYahooCondintion(cmForecast.getConditionCode())));
|
||||
weatherSpec.getForecasts().add(gbForecast);
|
||||
}
|
||||
ArrayList<WeatherSpec> weatherSpecs = new ArrayList<>(Collections.singletonList(weatherSpec));
|
||||
Weather.INSTANCE.setWeatherSpec(weatherSpecs);
|
||||
Weather.setWeatherSpec(weatherSpecs);
|
||||
GBApplication.deviceService().onSendWeather(weatherSpecs);
|
||||
} else {
|
||||
LOG.info("request has returned null for WeatherInfo");
|
||||
|
||||
+1
-1
@@ -84,7 +84,7 @@ public class GenericWeatherReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
LOG.info("Got generic weather for {} locations", weathers.size());
|
||||
Weather.INSTANCE.setWeatherSpec(weathers);
|
||||
Weather.setWeatherSpec(weathers);
|
||||
GBApplication.deviceService().onSendWeather(weathers);
|
||||
} catch (final Exception e) {
|
||||
GB.toast("Gadgetbridge received broken or incompatible weather data", Toast.LENGTH_SHORT, GB.ERROR, e);
|
||||
|
||||
+4
-4
@@ -184,8 +184,8 @@ public class LineageOsWeatherReceiver extends BroadcastReceiver implements Linea
|
||||
}
|
||||
weatherSpec.setWindDirection((int) weatherInfo.getWindDirection());
|
||||
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(LineageOSToYahooCondition(weatherInfo.getConditionCode())));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.INSTANCE.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(LineageOSToYahooCondition(weatherInfo.getConditionCode())));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentHumidity((int) weatherInfo.getHumidity());
|
||||
|
||||
weatherSpec.setForecasts(new ArrayList<>());
|
||||
@@ -200,11 +200,11 @@ public class LineageOsWeatherReceiver extends BroadcastReceiver implements Linea
|
||||
gbForecast.setMaxTemp((int) cmForecast.getHigh() + 273);
|
||||
gbForecast.setMinTemp((int) cmForecast.getLow() + 273);
|
||||
}
|
||||
gbForecast.setConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(LineageOSToYahooCondition(cmForecast.getConditionCode())));
|
||||
gbForecast.setConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(LineageOSToYahooCondition(cmForecast.getConditionCode())));
|
||||
weatherSpec.getForecasts().add(gbForecast);
|
||||
}
|
||||
ArrayList<WeatherSpec> weatherSpecs = new ArrayList<>(Collections.singletonList(weatherSpec));
|
||||
Weather.INSTANCE.setWeatherSpec(weatherSpecs);
|
||||
Weather.setWeatherSpec(weatherSpecs);
|
||||
GBApplication.deviceService().onSendWeather(weatherSpecs);
|
||||
} else {
|
||||
LOG.info("request has returned null for WeatherInfo");
|
||||
|
||||
+4
-4
@@ -113,8 +113,8 @@ public class OmniJawsObserver extends ContentObserver {
|
||||
if (i == 0) {
|
||||
|
||||
weatherSpec.setLocation(c.getString(0));
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(c.getInt(2)));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.INSTANCE.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
weatherSpec.setCurrentConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(c.getInt(2)));
|
||||
weatherSpec.setCurrentCondition(WeatherMapper.getConditionString(mContext, weatherSpec.getCurrentConditionCode()));
|
||||
//alternatively the following would also be possible
|
||||
//weatherSpec.currentCondition = c.getString(1);
|
||||
|
||||
@@ -132,14 +132,14 @@ public class OmniJawsObserver extends ContentObserver {
|
||||
WeatherSpec.Daily gbForecast = new WeatherSpec.Daily();
|
||||
gbForecast.setMinTemp(toKelvin(c.getFloat(5)));
|
||||
gbForecast.setMaxTemp(toKelvin(c.getFloat(6)));
|
||||
gbForecast.setConditionCode(WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(c.getInt(8)));
|
||||
gbForecast.setConditionCode(WeatherMapper.mapToOpenWeatherMapCondition(c.getInt(8)));
|
||||
weatherSpec.getForecasts().add(gbForecast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayList<WeatherSpec> weatherSpecs = new ArrayList<>(Collections.singletonList(weatherSpec));
|
||||
Weather.INSTANCE.setWeatherSpec(weatherSpecs);
|
||||
Weather.setWeatherSpec(weatherSpecs);
|
||||
GBApplication.deviceService().onSendWeather(weatherSpecs);
|
||||
|
||||
} finally {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class TinyWeatherForecastGermanyReceiver extends BroadcastReceiver {
|
||||
if (weatherSpec != null) {
|
||||
ArrayList<WeatherSpec> weatherSpecs = new ArrayList<>(Collections.singletonList(weatherSpec));
|
||||
weatherSpec.setTimestamp((int) (System.currentTimeMillis() / 1000));
|
||||
Weather.INSTANCE.setWeatherSpec(weatherSpecs);
|
||||
Weather.setWeatherSpec(weatherSpecs);
|
||||
GBApplication.deviceService().onSendWeather(weatherSpecs);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -13,6 +13,7 @@ object Weather {
|
||||
|
||||
private var cacheManager: WeatherCacheManager? = null
|
||||
|
||||
@JvmStatic
|
||||
fun setWeatherSpec(newSpecs: Collection<WeatherSpec>) {
|
||||
weatherSpecs.apply {
|
||||
clear()
|
||||
@@ -21,10 +22,13 @@ object Weather {
|
||||
cacheManager?.save(weatherSpecs)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getWeatherSpec(): WeatherSpec? = weatherSpecs.firstOrNull()
|
||||
|
||||
@JvmStatic
|
||||
fun getWeatherSpecs(): List<WeatherSpec> = weatherSpecs
|
||||
|
||||
@JvmStatic
|
||||
fun createReconstructedOWMWeatherReply(): JSONObject? {
|
||||
val spec = getWeatherSpec() ?: return null
|
||||
|
||||
@@ -63,6 +67,7 @@ object Weather {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun initializeCache(cacheManager: WeatherCacheManager) {
|
||||
Weather.cacheManager = cacheManager
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class WeatherCacheManager(
|
||||
cacheDir: File,
|
||||
private val useCache: Boolean
|
||||
) {
|
||||
private val LOG = LoggerFactory.getLogger("nodomain.freeyourgadget.gadgetbridge.model.weather.WeatherCacheManager")
|
||||
private val LOG = LoggerFactory.getLogger(WeatherCacheManager::class.java)
|
||||
private val cacheFile = File(cacheDir, "weatherCache.bin")
|
||||
private val listType = object : TypeToken<List<WeatherSpec>>() {}.type
|
||||
private val gson: Gson = Gson()
|
||||
|
||||
+10
-1
@@ -5,6 +5,7 @@ import nodomain.freeyourgadget.gadgetbridge.R
|
||||
|
||||
object WeatherMapper {
|
||||
|
||||
@JvmStatic
|
||||
fun mapToOpenWeatherMapIcon(code: Int): String = when {
|
||||
//see https://openweathermap.org/weather-conditions
|
||||
code in 200..299 -> "11d"
|
||||
@@ -20,6 +21,7 @@ object WeatherMapper {
|
||||
else -> "02d" // fallback
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToOpenWeatherMapCondition(yahooCondition: Int): Int {
|
||||
//yahoo weather conditions:
|
||||
//https://developer.yahoo.com/weather/documentation.html
|
||||
@@ -59,6 +61,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getConditionString(context: Context, code: Int): String = when (code) {
|
||||
200 -> context.getString(R.string.weather_condition_thunderstorm_with_light_rain)
|
||||
201 -> context.getString(R.string.weather_condition_thunderstorm_with_rain)
|
||||
@@ -142,6 +145,7 @@ object WeatherMapper {
|
||||
else -> ""
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getAqiLevelString(context: Context, aqi: Int): String = when {
|
||||
// Uses the [2023 Plume index](https://plumelabs.files.wordpress.com/2023/06/plume_aqi_2023.pdf) as a reference
|
||||
aqi < 0 -> context.getString(R.string.aqi_level_unknown)
|
||||
@@ -153,6 +157,7 @@ object WeatherMapper {
|
||||
else -> context.getString(R.string.aqi_level_dangerous)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToPebbleCondition(openWeatherMapCondition: Int): Byte {
|
||||
/* deducted values:
|
||||
0 = sun + cloud
|
||||
@@ -184,6 +189,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToYahooCondition(openWeatherMapCondition: Int): Int {
|
||||
// openweathermap.org conditions:
|
||||
// http://openweathermap.org/weather-conditions
|
||||
@@ -226,7 +232,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun mapToZeTimeConditionOld(openWeatherMapCondition: Int): Byte {
|
||||
/* deducted values:
|
||||
0 = partly cloudy
|
||||
@@ -251,6 +257,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToZeTimeCondition(openWeatherMapCondition: Int): Byte {
|
||||
/* deducted values:
|
||||
0 = tornado
|
||||
@@ -324,6 +331,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToCmfCondition(openWeatherMapCondition: Int): Byte {
|
||||
/* deducted values:
|
||||
1 = sunny
|
||||
@@ -377,6 +385,7 @@ object WeatherMapper {
|
||||
}
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun mapToFitProCondition(openWeatherMapCondition: Int): Byte {
|
||||
return when (openWeatherMapCondition) {
|
||||
100 -> 1
|
||||
|
||||
+3
-3
@@ -1985,7 +1985,7 @@ public class BangleJSDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
private void handleWeather(JSONObject json)
|
||||
{
|
||||
if (!json.has("v")) {
|
||||
handleWeatherV1(Weather.INSTANCE.getWeatherSpecs());
|
||||
handleWeatherV1(Weather.getWeatherSpecs());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -1995,9 +1995,9 @@ public class BangleJSDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
forecast = json.getBoolean("f");
|
||||
}
|
||||
if (version == 1) {
|
||||
handleWeatherV1(Weather.INSTANCE.getWeatherSpecs());
|
||||
handleWeatherV1(Weather.getWeatherSpecs());
|
||||
} else if (version == 2) {
|
||||
handleWeatherV2(Weather.INSTANCE.getWeatherSpecs(), forecast);
|
||||
handleWeatherV2(Weather.getWeatherSpecs(), forecast);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
LOG.info("JSONException: " + e.getLocalizedMessage());
|
||||
|
||||
+3
-3
@@ -813,7 +813,7 @@ public class CmfWatchProSupport extends AbstractBTLESingleDeviceSupport implemen
|
||||
final int payloadLength = (7 * 9) + (24 * 2) + (supportsSunriseSunset ? 32 : 30) + (supportsSunriseSunset ? 7 * 8 : 0);
|
||||
final ByteBuffer buf = ByteBuffer.allocate(payloadLength).order(ByteOrder.BIG_ENDIAN);
|
||||
// start with the current day's weather
|
||||
buf.put(WeatherMapper.INSTANCE.mapToCmfCondition(weatherSpec.getCurrentConditionCode()));
|
||||
buf.put(WeatherMapper.mapToCmfCondition(weatherSpec.getCurrentConditionCode()));
|
||||
buf.put((byte) (weatherSpec.getCurrentTemp() - 273 + 100)); // convert Kelvin to C, add 100
|
||||
buf.put((byte) (weatherSpec.getTodayMaxTemp() - 273 + 100)); // convert Kelvin to C, add 100
|
||||
buf.put((byte) (weatherSpec.getTodayMinTemp() - 273 + 100)); // convert Kelvin to C, add 100
|
||||
@@ -828,7 +828,7 @@ public class CmfWatchProSupport extends AbstractBTLESingleDeviceSupport implemen
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (i < maxForecastsAvailable) {
|
||||
WeatherSpec.Daily forecastDay = weatherSpec.getForecasts().get(i);
|
||||
buf.put((byte) (WeatherMapper.INSTANCE.mapToCmfCondition(forecastDay.getConditionCode()))); // weather condition flag
|
||||
buf.put(WeatherMapper.mapToCmfCondition(forecastDay.getConditionCode())); // weather condition flag
|
||||
buf.put((byte) (forecastDay.getMaxTemp() - 273 + 100)); // temp in C (not shown in future days' forecasts)
|
||||
buf.put((byte) (forecastDay.getMaxTemp() - 273 + 100)); // max temp in C, + 100
|
||||
buf.put((byte) (forecastDay.getMinTemp() - 273 + 100)); // min temp in C, + 100
|
||||
@@ -858,7 +858,7 @@ public class CmfWatchProSupport extends AbstractBTLESingleDeviceSupport implemen
|
||||
buf.put((byte) forecastHr.getConditionCode()); // condition
|
||||
} else {
|
||||
buf.put((byte) (weatherSpec.getCurrentTemp() - 273 + 100)); // assume current temp
|
||||
buf.put((byte) (WeatherMapper.INSTANCE.mapToCmfCondition(weatherSpec.getCurrentConditionCode()))); // current condition
|
||||
buf.put(WeatherMapper.mapToCmfCondition(weatherSpec.getCurrentConditionCode())); // current condition
|
||||
}
|
||||
}
|
||||
// place name - watch scrolls after ~10 chars. Pad up to 32 bytes.
|
||||
|
||||
+1
-1
@@ -356,7 +356,7 @@ public class G1DeviceSupport extends AbstractBTLEMultiDeviceSupport {
|
||||
|
||||
// Pull the weather into a local variable so that if it changes between the two lenses being
|
||||
// updated, we won't end up with a skewed value.
|
||||
@Nullable WeatherSpec weather = Weather.INSTANCE.getWeatherSpec();
|
||||
@Nullable WeatherSpec weather = Weather.getWeatherSpec();
|
||||
|
||||
// Run in the background in case the command hangs and this was run from the UI thread.
|
||||
backgroundTasksHandler.post(() -> {
|
||||
|
||||
+1
-1
@@ -556,7 +556,7 @@ public class FitProDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
weatherUnit = 1;
|
||||
}
|
||||
|
||||
byte currentConditionCode = WeatherMapper.INSTANCE.mapToFitProCondition(weatherSpec.getCurrentConditionCode());
|
||||
byte currentConditionCode = WeatherMapper.mapToFitProCondition(weatherSpec.getCurrentConditionCode());
|
||||
TransactionBuilder builder = createTransactionBuilder("weather");
|
||||
writeChunkedData(builder, craftData(CMD_GROUP_GENERAL, CMD_WEATHER, new byte[]{(byte) todayMin, (byte) todayMax, (byte) currentConditionCode, (byte) weatherUnit}));
|
||||
builder.queue();
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ public class GarminSupport extends AbstractBTLESingleDeviceSupport implements IC
|
||||
@Override
|
||||
public void evaluateGBDeviceEvent(GBDeviceEvent deviceEvent) {
|
||||
if (deviceEvent instanceof WeatherRequestDeviceEvent) {
|
||||
WeatherSpec weather = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weather = Weather.getWeatherSpec();
|
||||
if (weather != null) {
|
||||
sendWeatherConditions(weather);
|
||||
}
|
||||
|
||||
+4
-4
@@ -40,7 +40,7 @@ public class WeatherHandler {
|
||||
final String path = request.getPath();
|
||||
final Map<String, String> query = request.getQuery();
|
||||
|
||||
final WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
final WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
|
||||
if (weatherSpec == null) {
|
||||
LOG.warn("No weather in weather instance");
|
||||
@@ -161,8 +161,8 @@ public class WeatherHandler {
|
||||
|
||||
public WeatherForecastDay(final GregorianCalendar date, final WeatherSpec.Daily dailyForecast, final String tempUnit, final String speedUnit) {
|
||||
dayOfWeek = BLETypeConversions.dayOfWeekToRawBytes(date);
|
||||
description = WeatherMapper.INSTANCE.getConditionString(GBApplication.getContext(), dailyForecast.getConditionCode());
|
||||
summary = WeatherMapper.INSTANCE.getConditionString(GBApplication.getContext(), dailyForecast.getConditionCode());
|
||||
description = WeatherMapper.getConditionString(GBApplication.getContext(), dailyForecast.getConditionCode());
|
||||
summary = WeatherMapper.getConditionString(GBApplication.getContext(), dailyForecast.getConditionCode());
|
||||
high = getTemperature(dailyForecast.getMaxTemp(), tempUnit);
|
||||
low = getTemperature(dailyForecast.getMinTemp(), tempUnit);
|
||||
precipProb = dailyForecast.getPrecipProbability();
|
||||
@@ -213,7 +213,7 @@ public class WeatherHandler {
|
||||
|
||||
public WeatherForecastHour(final WeatherSpec.Hourly hourlyForecast, final String tempUnit, final String speedUnit) {
|
||||
epochSeconds = hourlyForecast.getTimestamp();
|
||||
description = WeatherMapper.INSTANCE.getConditionString(GBApplication.getContext(), hourlyForecast.getConditionCode());
|
||||
description = WeatherMapper.getConditionString(GBApplication.getContext(), hourlyForecast.getConditionCode());
|
||||
temp = getTemperature(hourlyForecast.getTemp(), tempUnit);
|
||||
precipProb = hourlyForecast.getPrecipProbability();
|
||||
wind = new Wind(getSpeed(hourlyForecast.getWindSpeed(), speedUnit), hourlyForecast.getWindDirection());
|
||||
|
||||
+3
-3
@@ -2877,7 +2877,7 @@ public abstract class HuamiSupport extends AbstractBTLESingleDeviceSupport
|
||||
builder = performInitialized("Sending air quality index");
|
||||
int length = 8;
|
||||
int aqi = weatherSpec.getAirQuality() != null ? weatherSpec.getAirQuality().getAqi() : -1;
|
||||
String aqiString = WeatherMapper.INSTANCE.getAqiLevelString(getContext(), aqi);
|
||||
String aqiString = WeatherMapper.getAqiLevelString(getContext(), aqi);
|
||||
if (supportsConditionString) {
|
||||
length += aqiString.getBytes().length + 1;
|
||||
}
|
||||
@@ -2916,7 +2916,7 @@ public abstract class HuamiSupport extends AbstractBTLESingleDeviceSupport
|
||||
bytesPerDay = 5;
|
||||
conditionsLength = weatherSpec.getCurrentCondition().getBytes().length;
|
||||
for (WeatherSpec.Daily forecast : weatherSpec.getForecasts()) {
|
||||
conditionsLength += WeatherMapper.INSTANCE.getConditionString(getContext(), forecast.getConditionCode()).getBytes().length;
|
||||
conditionsLength += WeatherMapper.getConditionString(getContext(), forecast.getConditionCode()).getBytes().length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2963,7 +2963,7 @@ public abstract class HuamiSupport extends AbstractBTLESingleDeviceSupport
|
||||
buf.put((byte) forecastMinTemp);
|
||||
|
||||
if (supportsConditionString) {
|
||||
buf.put(WeatherMapper.INSTANCE.getConditionString(getContext(), forecast.getConditionCode()).getBytes());
|
||||
buf.put(WeatherMapper.getConditionString(getContext(), forecast.getConditionCode()).getBytes());
|
||||
buf.put((byte) 0);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class ZeppOsWeatherHandler {
|
||||
}
|
||||
|
||||
public Response handleHttpRequest(final String path, final Map<String, String> query) {
|
||||
final WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
final WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
|
||||
if (weatherSpec == null) {
|
||||
LOG.error("No weather in weather instance");
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ public class HuaweiWeatherManager {
|
||||
public void handleAsyncMessage(HuaweiPacket response) {
|
||||
if (response.getTlv().getInteger(0x7f, -1) == 0x000186AA) {
|
||||
// Send weather
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(nodomain.freeyourgadget.gadgetbridge.model.weather.Weather.INSTANCE.getWeatherSpecs());
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(nodomain.freeyourgadget.gadgetbridge.model.weather.Weather.getWeatherSpecs());
|
||||
if (specs.isEmpty()) {
|
||||
LOG.debug("Weather specs empty, returning that weather is disabled.");
|
||||
try {
|
||||
|
||||
+2
-2
@@ -446,8 +446,8 @@ public class MoyoungDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
|
||||
if (packetType == MoyoungConstants.CMD_NOTIFY_WEATHER_CHANGE) {
|
||||
LOG.info("Will transmit cached weather (if any) since the watch asks for it");
|
||||
if (Weather.INSTANCE.getWeatherSpec() != null) {
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(Weather.INSTANCE.getWeatherSpecs());
|
||||
if (Weather.getWeatherSpec() != null) {
|
||||
final ArrayList<WeatherSpec> specs = new ArrayList<>(Weather.getWeatherSpecs());
|
||||
GBApplication.deviceService().onSendWeather(specs);
|
||||
}
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ class AppMessageHandlerHealthify extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ class AppMessageHandlerM7S extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ class AppMessageHandlerMarioTime extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -160,7 +160,7 @@ class AppMessageHandlerObsidian extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+2
-2
@@ -93,11 +93,11 @@ class AppMessageHandlerPebStyle extends AppMessageHandler {
|
||||
|
||||
|
||||
//WEATHER
|
||||
WeatherSpec weather = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weather = Weather.getWeatherSpec();
|
||||
if (weather != null) {
|
||||
//comment the same key in the general section above!
|
||||
pairs.add(new Pair<>(KEY_LOCATION_SERVICE, (Object) 0)); //0 auto, 1 manual
|
||||
pairs.add(new Pair<>(KEY_WEATHER_CODE, (Object) WeatherMapper.INSTANCE.mapToYahooCondition(weather.getCurrentConditionCode())));
|
||||
pairs.add(new Pair<>(KEY_WEATHER_CODE, (Object) WeatherMapper.mapToYahooCondition(weather.getCurrentConditionCode())));
|
||||
pairs.add(new Pair<>(KEY_WEATHER_TEMP, (Object) (weather.getCurrentTemp() - 273)));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ class AppMessageHandlerRealWeather extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -123,7 +123,7 @@ private int getConditionForConditionCode(int conditionCode) {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ class AppMessageHandlerSquare extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -155,7 +155,7 @@ class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ class AppMessageHandlerTrekVolle extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ class AppMessageHandlerYWeather extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ class AppMessageHandlerZalewszczak extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] onAppStart() {
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec == null) {
|
||||
return new GBDeviceEvent[]{null};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1183,10 +1183,10 @@ public class PebbleProtocol extends GBDeviceProtocol {
|
||||
buf.order(ByteOrder.LITTLE_ENDIAN);
|
||||
buf.put((byte) 3); // unknown, always 3?
|
||||
buf.putShort(currentTemp);
|
||||
buf.put(WeatherMapper.INSTANCE.mapToPebbleCondition(weatherSpec.getCurrentConditionCode()));
|
||||
buf.put(WeatherMapper.mapToPebbleCondition(weatherSpec.getCurrentConditionCode()));
|
||||
buf.putShort(todayMax);
|
||||
buf.putShort(todayMin);
|
||||
buf.put(WeatherMapper.INSTANCE.mapToPebbleCondition(tomorrowConditionCode));
|
||||
buf.put(WeatherMapper.mapToPebbleCondition(tomorrowConditionCode));
|
||||
buf.putShort(tomorrowMax);
|
||||
buf.putShort(tomorrowMin);
|
||||
buf.putInt(weatherSpec.getTimestamp());
|
||||
|
||||
+6
-5
@@ -45,6 +45,7 @@ import java.util.Map;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.weather.Weather;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.weather.WeatherSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.WebViewSingleton;
|
||||
|
||||
public class GBWebClient extends WebViewClient {
|
||||
@@ -143,15 +144,15 @@ public class GBWebClient extends WebViewClient {
|
||||
|
||||
private WebResourceResponse mimicOpenWeatherMapResponse(String type, String units) {
|
||||
|
||||
if (Weather.INSTANCE == null) {
|
||||
LOG.warn("WEBVIEW - Weather instance is null, cannot update weather");
|
||||
if (Weather.getWeatherSpecs().isEmpty()) {
|
||||
LOG.warn("WEBVIEW - WeatherSpecs is empty, cannot update weather");
|
||||
return null;
|
||||
}
|
||||
|
||||
CurrentPosition currentPosition = new CurrentPosition();
|
||||
|
||||
try {
|
||||
JSONObject resp = Weather.INSTANCE.createReconstructedOWMWeatherReply();
|
||||
JSONObject resp = Weather.createReconstructedOWMWeatherReply();
|
||||
if ("/data/2.5/weather".equals(type) && resp != null) {
|
||||
JSONObject main = resp.getJSONObject("main");
|
||||
|
||||
@@ -162,8 +163,8 @@ public class GBWebClient extends WebViewClient {
|
||||
resp.put("cod", 200);
|
||||
resp.put("coord", coordObject(currentPosition));
|
||||
resp.put("sys", sysObject(currentPosition));
|
||||
// } else if ("/data/2.5/forecast".equals(type) && Weather.INSTANCE.getWeather2().reconstructedOWMForecast != null) { //this is wrong, as we only have daily data. Unfortunately it looks like daily forecasts cannot be reconstructed
|
||||
// resp = new JSONObject(Weather.INSTANCE.getWeather2().reconstructedOWMForecast.toString());
|
||||
// } else if ("/data/2.5/forecast".equals(type) && Weather.getWeather2().reconstructedOWMForecast != null) { //this is wrong, as we only have daily data. Unfortunately it looks like daily forecasts cannot be reconstructed
|
||||
// resp = new JSONObject(Weather.getWeather2().reconstructedOWMForecast.toString());
|
||||
//
|
||||
// JSONObject city = resp.getJSONObject("city");
|
||||
// city.put("coord", coordObject(currentPosition));
|
||||
|
||||
+3
-3
@@ -2003,7 +2003,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
}
|
||||
} else if (request.has("weatherInfo") || request.has("weatherApp._.config.locations")) {
|
||||
LOG.info("Got weatherInfo request");
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec != null) {
|
||||
onSendWeather(weatherSpec);
|
||||
} else {
|
||||
@@ -2011,7 +2011,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
}
|
||||
} else if (request.has("widgetChanceOfRain._.config.info")) {
|
||||
LOG.info("Got widgetChanceOfRain request");
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec != null) {
|
||||
onSendChanceOfRain(weatherSpec);
|
||||
} else {
|
||||
@@ -2019,7 +2019,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
}
|
||||
} else if (request.has("widgetUV._.config.info")) {
|
||||
LOG.info("Got widgetUV request");
|
||||
WeatherSpec weatherSpec = Weather.INSTANCE.getWeatherSpec();
|
||||
WeatherSpec weatherSpec = Weather.getWeatherSpec();
|
||||
if (weatherSpec != null) {
|
||||
onSendUVIndex(weatherSpec);
|
||||
} else {
|
||||
|
||||
+5
-5
@@ -517,7 +517,7 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
if (!TextUtils.isEmpty(locationKey) && !TextUtils.isEmpty(locationName)) {
|
||||
LOG.debug("Received request for conditions (location key = {}, name = {})", locationKey, locationName);
|
||||
|
||||
final List<WeatherSpec> knownWeathers = Weather.INSTANCE.getWeatherSpecs();
|
||||
final List<WeatherSpec> knownWeathers = Weather.getWeatherSpecs();
|
||||
for (WeatherSpec spec : knownWeathers) {
|
||||
if (TextUtils.equals(spec.getLocation(), locationName)) {
|
||||
sendWeatherSpec(spec);
|
||||
@@ -529,14 +529,14 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
}
|
||||
}
|
||||
|
||||
final WeatherSpec spec = Weather.INSTANCE.getWeatherSpec();
|
||||
final WeatherSpec spec = Weather.getWeatherSpec();
|
||||
|
||||
if (spec == null) {
|
||||
LOG.warn("Not sending weather conditions: active weather spec is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
sendWeatherSpec(Weather.INSTANCE.getWeatherSpec());
|
||||
sendWeatherSpec(Weather.getWeatherSpec());
|
||||
}
|
||||
|
||||
private static String[] weatherLocationsToStringArray(final Collection<XiaomiProto.WeatherLocation> locations) {
|
||||
@@ -567,7 +567,7 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
locationsInitialized = true;
|
||||
|
||||
// now that the feature flag has been updated, send cached weather
|
||||
onSendWeather(Weather.INSTANCE.getWeatherSpecs());
|
||||
onSendWeather(Weather.getWeatherSpecs());
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -614,7 +614,7 @@ public class XiaomiWeatherService extends AbstractXiaomiService {
|
||||
|
||||
final Set<XiaomiProto.WeatherLocation> specLocations = new HashSet<>();
|
||||
|
||||
for (final WeatherSpec s : Weather.INSTANCE.getWeatherSpecs()) {
|
||||
for (final WeatherSpec s : Weather.getWeatherSpecs()) {
|
||||
specLocations.add(getWeatherLocationFromSpec(s));
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -617,9 +617,9 @@ public class ZeTimeDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
LOG.warn("We do not have a sane fw version string available, firmware too old/new?");
|
||||
}
|
||||
if (newWeather) {
|
||||
weather[9] = WeatherMapper.INSTANCE.mapToZeTimeCondition(weatherSpec.getCurrentConditionCode());
|
||||
weather[9] = WeatherMapper.mapToZeTimeCondition(weatherSpec.getCurrentConditionCode());
|
||||
} else {
|
||||
weather[9] = WeatherMapper.INSTANCE.mapToZeTimeConditionOld(weatherSpec.getCurrentConditionCode());
|
||||
weather[9] = WeatherMapper.mapToZeTimeConditionOld(weatherSpec.getCurrentConditionCode());
|
||||
}
|
||||
for (int forecast = 0; forecast < 3; forecast++) {
|
||||
weather[10 + (forecast * 5)] = 0; // celsius
|
||||
@@ -627,9 +627,9 @@ public class ZeTimeDeviceSupport extends AbstractBTLESingleDeviceSupport {
|
||||
weather[12 + (forecast * 5)] = (byte) (weatherSpec.getForecasts().get(forecast).getMinTemp() - 273);
|
||||
weather[13 + (forecast * 5)] = (byte) (weatherSpec.getForecasts().get(forecast).getMaxTemp() - 273);
|
||||
if (newWeather) {
|
||||
weather[14 + (forecast * 5)] = WeatherMapper.INSTANCE.mapToZeTimeCondition(weatherSpec.getForecasts().get(forecast).getConditionCode());
|
||||
weather[14 + (forecast * 5)] = WeatherMapper.mapToZeTimeCondition(weatherSpec.getForecasts().get(forecast).getConditionCode());
|
||||
} else {
|
||||
weather[14 + (forecast * 5)] = WeatherMapper.INSTANCE.mapToZeTimeConditionOld(weatherSpec.getForecasts().get(forecast).getConditionCode());
|
||||
weather[14 + (forecast * 5)] = WeatherMapper.mapToZeTimeConditionOld(weatherSpec.getForecasts().get(forecast).getConditionCode());
|
||||
}
|
||||
}
|
||||
System.arraycopy(weatherSpec.getLocation().getBytes(StandardCharsets.UTF_8), 0, weather, 25, weatherSpec.getLocation().getBytes(StandardCharsets.UTF_8).length);
|
||||
|
||||
+10
-10
@@ -49,16 +49,16 @@ public class WeatherMapperTest extends TestBase {
|
||||
public void ensureConversionToKotlin() {
|
||||
|
||||
for (int i = 0; i <= 3200; i++) {
|
||||
Assert.assertEquals(Weather.mapToPebbleCondition(i), WeatherMapper.INSTANCE.mapToPebbleCondition(i));
|
||||
Assert.assertEquals(Weather.mapToYahooCondition(i), WeatherMapper.INSTANCE.mapToYahooCondition(i));
|
||||
Assert.assertEquals(Weather.mapToOpenWeatherMapIcon(i), WeatherMapper.INSTANCE.mapToOpenWeatherMapIcon(i));
|
||||
Assert.assertEquals(Weather.mapToOpenWeatherMapCondition(i), WeatherMapper.INSTANCE.mapToOpenWeatherMapCondition(i));
|
||||
Assert.assertEquals(Weather.getConditionString(getContext(), i), WeatherMapper.INSTANCE.getConditionString(getContext(), i));
|
||||
Assert.assertEquals(Weather.getAqiLevelString(getContext(), i), WeatherMapper.INSTANCE.getAqiLevelString(getContext(), i));
|
||||
Assert.assertEquals(Weather.mapToZeTimeConditionOld(i), WeatherMapper.INSTANCE.mapToZeTimeConditionOld(i));
|
||||
Assert.assertEquals(Weather.mapToZeTimeCondition(i), WeatherMapper.INSTANCE.mapToZeTimeCondition(i));
|
||||
Assert.assertEquals(Weather.mapToCmfCondition(i), WeatherMapper.INSTANCE.mapToCmfCondition(i));
|
||||
Assert.assertEquals(Weather.mapToFitProCondition(i), WeatherMapper.INSTANCE.mapToFitProCondition(i));
|
||||
Assert.assertEquals(Weather.mapToPebbleCondition(i), WeatherMapper.mapToPebbleCondition(i));
|
||||
Assert.assertEquals(Weather.mapToYahooCondition(i), WeatherMapper.mapToYahooCondition(i));
|
||||
Assert.assertEquals(Weather.mapToOpenWeatherMapIcon(i), WeatherMapper.mapToOpenWeatherMapIcon(i));
|
||||
Assert.assertEquals(Weather.mapToOpenWeatherMapCondition(i), WeatherMapper.mapToOpenWeatherMapCondition(i));
|
||||
Assert.assertEquals(Weather.getConditionString(getContext(), i), WeatherMapper.getConditionString(getContext(), i));
|
||||
Assert.assertEquals(Weather.getAqiLevelString(getContext(), i), WeatherMapper.getAqiLevelString(getContext(), i));
|
||||
Assert.assertEquals(Weather.mapToZeTimeConditionOld(i), WeatherMapper.mapToZeTimeConditionOld(i));
|
||||
Assert.assertEquals(Weather.mapToZeTimeCondition(i), WeatherMapper.mapToZeTimeCondition(i));
|
||||
Assert.assertEquals(Weather.mapToCmfCondition(i), WeatherMapper.mapToCmfCondition(i));
|
||||
Assert.assertEquals(Weather.mapToFitProCondition(i), WeatherMapper.mapToFitProCondition(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user