Pebble: push current weather to TimeStylePebble again when watchface gets started
This commit is contained in:
parent
4e543d4b34
commit
984e639e97
|
@ -45,7 +45,7 @@ public class WeatherNotificationReceiver extends BroadcastReceiver {
|
||||||
weatherSpec.tomorrowConditionCode = weather.forecastConditionCode;
|
weatherSpec.tomorrowConditionCode = weather.forecastConditionCode;
|
||||||
weatherSpec.tomorrowMaxTemp = weather.forecastHighTemp;
|
weatherSpec.tomorrowMaxTemp = weather.forecastHighTemp;
|
||||||
weatherSpec.tomorrowMinTemp = weather.forecastLowTemp;
|
weatherSpec.tomorrowMinTemp = weather.forecastLowTemp;
|
||||||
|
Weather.getInstance().setWeatherSpec(weatherSpec);
|
||||||
GBApplication.deviceService().onSendWeather(weatherSpec);
|
GBApplication.deviceService().onSendWeather(weatherSpec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,8 +4,23 @@ import ru.gelin.android.weather.notification.ParcelableWeather2;
|
||||||
|
|
||||||
public class Weather {
|
public class Weather {
|
||||||
private ParcelableWeather2 weather2 = null;
|
private ParcelableWeather2 weather2 = null;
|
||||||
public ParcelableWeather2 getWeather2() {return weather2;}
|
private WeatherSpec weatherSpec = null;
|
||||||
public void setWeather2(ParcelableWeather2 weather2) {this.weather2 = weather2;}
|
|
||||||
|
public ParcelableWeather2 getWeather2() {
|
||||||
|
return weather2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeather2(ParcelableWeather2 weather2) {
|
||||||
|
this.weather2 = weather2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WeatherSpec getWeatherSpec() {
|
||||||
|
return weatherSpec;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWeatherSpec(WeatherSpec weatherSpec) {
|
||||||
|
this.weatherSpec = weatherSpec;
|
||||||
|
}
|
||||||
|
|
||||||
private static final Weather weather = new Weather();
|
private static final Weather weather = new Weather();
|
||||||
public static Weather getInstance() {return weather;}
|
public static Weather getInstance() {return weather;}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||||
|
|
||||||
public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||||
|
@ -115,10 +116,18 @@ public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GBDeviceEvent[] handleMessage(ArrayList<Pair<Integer, Object>> pairs) {
|
public GBDeviceEvent[] handleMessage(ArrayList<Pair<Integer, Object>> pairs) {
|
||||||
|
// Just ACK
|
||||||
GBDeviceEventSendBytes sendBytesAck = new GBDeviceEventSendBytes();
|
GBDeviceEventSendBytes sendBytesAck = new GBDeviceEventSendBytes();
|
||||||
sendBytesAck.encodedBytes = mPebbleProtocol.encodeApplicationMessageAck(mUUID, mPebbleProtocol.last_id);
|
sendBytesAck.encodedBytes = mPebbleProtocol.encodeApplicationMessageAck(mUUID, mPebbleProtocol.last_id);
|
||||||
return new GBDeviceEvent[]{sendBytesAck};
|
return new GBDeviceEvent[]{sendBytesAck};
|
||||||
// TODO: trigger update of weather?
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GBDeviceEvent[] onAppStart() {
|
||||||
|
WeatherSpec weatherSpec = Weather.getInstance().getWeatherSpec();
|
||||||
|
GBDeviceEventSendBytes sendBytes = new GBDeviceEventSendBytes();
|
||||||
|
sendBytes.encodedBytes = encodeTimeStylePebbleWeather(weatherSpec);
|
||||||
|
return new GBDeviceEvent[]{sendBytes};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue