Pebble: get min/max temperature also for the forecast

here
Daniele Gobbetti 2016-12-30 19:58:56 +01:00
parent 240c81ecb4
commit 0e9ce5d186
2 changed files with 11 additions and 6 deletions

View File

@ -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_WeatherCondition, (Object) (getIconForConditionCode(weather.currentConditionCode, 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_WeatherForecastLowTemp, (Object) (weather.lowTemp - 273)));
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastHighTemp, (Object) (weather.todayHighTemp - 273)));
pairs.add(new Pair<>(MESSAGE_KEY_WeatherForecastLowTemp, (Object) (weather.todayLowTemp - 273)));
}
return mPebbleProtocol.encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, mUUID, pairs);

View File

@ -23,8 +23,10 @@ public class ParcelableWeather2 implements Parcelable {
public int currentConditionCode = 3200;
String[] forecastConditionType = null;
public int forecastConditionCode = 3200;
public int lowTemp = 0;
public int highTemp = 0;
public int todayLowTemp = 0;
public int todayHighTemp = 0;
public int forecastLowTemp = 0;
public int forecastHighTemp = 0;
private ParcelableWeather2(Parcel in) {
@ -33,6 +35,7 @@ public class ParcelableWeather2 implements Parcelable {
return;
}
Bundle bundle = in.readBundle();
location = bundle.getString("weather_location");
time = bundle.getLong("weather_time");
queryTime = bundle.getLong("weather_query_time");
@ -46,13 +49,15 @@ public class ParcelableWeather2 implements Parcelable {
currentConditionType = conditionBundle.getStringArray("weather_condition_types");
currentConditionCode = weatherConditionTypesToOpenWeatherMapIds(currentConditionType[0]);
lowTemp = conditionBundle.getInt("weather_low_temp");
highTemp = conditionBundle.getInt("weather_high_temp");
todayLowTemp = conditionBundle.getInt("weather_low_temp");
todayHighTemp = conditionBundle.getInt("weather_high_temp");
//fetch immediate next forecast
if (--conditions > 0) {
Bundle forecastBundle = in.readBundle();
forecastConditionType = forecastBundle.getStringArray("weather_condition_types");
forecastConditionCode = weatherConditionTypesToOpenWeatherMapIds(forecastConditionType[0]);
forecastLowTemp = forecastBundle.getInt("weather_low_temp");
forecastHighTemp = forecastBundle.getInt("weather_high_temp");
}
}
// get the rest