From 3d389f31a329db56f124bbe42f09cc4142fdc566 Mon Sep 17 00:00:00 2001 From: danielegobbetti Date: Tue, 5 Jan 2016 16:05:12 +0100 Subject: [PATCH] fix force close when weather hasn't been parsed yet, use the yahoo codes for this watchface, as required --- .../pebble/AppMessageHandlerTimeStylePebble.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerTimeStylePebble.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerTimeStylePebble.java index d0c4d89f..da4fc399 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerTimeStylePebble.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/AppMessageHandlerTimeStylePebble.java @@ -89,15 +89,13 @@ public class AppMessageHandlerTimeStylePebble extends AppMessageHandler { //TODO: use the night icons when night pairs.add(new Pair<>(KEY_USE_NIGHT_ICON, (Object) 0)); pairs.add(new Pair<>(KEY_TEMPERATURE, (Object) (weather.currentTemp - 273))); - pairs.add(new Pair<>(KEY_CONDITION_CODE, (Object) weather.currentConditionCode)); - pairs.add(new Pair<>(KEY_FORECAST_CONDITION, (Object) weather.forecastConditionCode)); + pairs.add(new Pair<>(KEY_CONDITION_CODE, (Object) Weather.mapToYahooCondition(weather.currentConditionCode))); + pairs.add(new Pair<>(KEY_FORECAST_CONDITION, (Object) Weather.mapToYahooCondition(weather.forecastConditionCode))); pairs.add(new Pair<>(KEY_FORECAST_TEMP_HIGH, (Object) (weather.highTemp - 273))); pairs.add(new Pair<>(KEY_FORECAST_TEMP_LOW, (Object) (weather.lowTemp - 273))); - byte[] weatherMessage = mPebbleProtocol.encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, mUUID, pairs); - return weatherMessage; } - - return null; + byte[] weatherMessage = mPebbleProtocol.encodeApplicationMessagePush(PebbleProtocol.ENDPOINT_APPLICATIONMESSAGE, mUUID, pairs); + return weatherMessage; }