mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-11 20:49:25 +01:00
Pebble: get min/max temperature also for the forecast
This commit is contained in:
parent
240c81ecb4
commit
0e9ce5d186
@ -105,8 +105,8 @@ public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
|||||||
pairs.add(new Pair<>(MESSAGE_KEY_WeatherTemperature, (Object) (weather.currentTemp - 273)));
|
pairs.add(new Pair<>(MESSAGE_KEY_WeatherTemperature, (Object) (weather.currentTemp - 273)));
|
||||||
pairs.add(new Pair<>(MESSAGE_KEY_WeatherCondition, (Object) (getIconForConditionCode(weather.currentConditionCode, isNight))));
|
pairs.add(new Pair<>(MESSAGE_KEY_WeatherCondition, (Object) (getIconForConditionCode(weather.currentConditionCode, isNight))));
|
||||||
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastCondition, (Object) (getIconForConditionCode(weather.forecastConditionCode, isNight))));
|
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastCondition, (Object) (getIconForConditionCode(weather.forecastConditionCode, isNight))));
|
||||||
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastHighTemp, (Object) (weather.highTemp - 273)));
|
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastHighTemp, (Object) (weather.todayHighTemp - 273)));
|
||||||
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastLowTemp, (Object) (weather.lowTemp - 273)));
|
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastLowTemp, (Object) (weather.todayLowTemp - 273)));
|
||||||
}
|
}
|
||||||
return mPebbleProtocol.encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, mUUID, pairs);
|
return mPebbleProtocol.encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, mUUID, pairs);
|
||||||
|
|
||||||
|
@ -23,8 +23,10 @@ public class ParcelableWeather2 implements Parcelable {
|
|||||||
public int currentConditionCode = 3200;
|
public int currentConditionCode = 3200;
|
||||||
String[] forecastConditionType = null;
|
String[] forecastConditionType = null;
|
||||||
public int forecastConditionCode = 3200;
|
public int forecastConditionCode = 3200;
|
||||||
public int lowTemp = 0;
|
public int todayLowTemp = 0;
|
||||||
public int highTemp = 0;
|
public int todayHighTemp = 0;
|
||||||
|
public int forecastLowTemp = 0;
|
||||||
|
public int forecastHighTemp = 0;
|
||||||
|
|
||||||
|
|
||||||
private ParcelableWeather2(Parcel in) {
|
private ParcelableWeather2(Parcel in) {
|
||||||
@ -33,6 +35,7 @@ public class ParcelableWeather2 implements Parcelable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bundle bundle = in.readBundle();
|
Bundle bundle = in.readBundle();
|
||||||
|
|
||||||
location = bundle.getString("weather_location");
|
location = bundle.getString("weather_location");
|
||||||
time = bundle.getLong("weather_time");
|
time = bundle.getLong("weather_time");
|
||||||
queryTime = bundle.getLong("weather_query_time");
|
queryTime = bundle.getLong("weather_query_time");
|
||||||
@ -46,13 +49,15 @@ public class ParcelableWeather2 implements Parcelable {
|
|||||||
|
|
||||||
currentConditionType = conditionBundle.getStringArray("weather_condition_types");
|
currentConditionType = conditionBundle.getStringArray("weather_condition_types");
|
||||||
currentConditionCode = weatherConditionTypesToOpenWeatherMapIds(currentConditionType[0]);
|
currentConditionCode = weatherConditionTypesToOpenWeatherMapIds(currentConditionType[0]);
|
||||||
lowTemp = conditionBundle.getInt("weather_low_temp");
|
todayLowTemp = conditionBundle.getInt("weather_low_temp");
|
||||||
highTemp = conditionBundle.getInt("weather_high_temp");
|
todayHighTemp = conditionBundle.getInt("weather_high_temp");
|
||||||
//fetch immediate next forecast
|
//fetch immediate next forecast
|
||||||
if (--conditions > 0) {
|
if (--conditions > 0) {
|
||||||
Bundle forecastBundle = in.readBundle();
|
Bundle forecastBundle = in.readBundle();
|
||||||
forecastConditionType = forecastBundle.getStringArray("weather_condition_types");
|
forecastConditionType = forecastBundle.getStringArray("weather_condition_types");
|
||||||
forecastConditionCode = weatherConditionTypesToOpenWeatherMapIds(forecastConditionType[0]);
|
forecastConditionCode = weatherConditionTypesToOpenWeatherMapIds(forecastConditionType[0]);
|
||||||
|
forecastLowTemp = forecastBundle.getInt("weather_low_temp");
|
||||||
|
forecastHighTemp = forecastBundle.getInt("weather_high_temp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// get the rest
|
// get the rest
|
||||||
|
Loading…
Reference in New Issue
Block a user