mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 01:09:47 +01:00
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.tomorrowMaxTemp = weather.forecastHighTemp;
|
||||
weatherSpec.tomorrowMinTemp = weather.forecastLowTemp;
|
||||
|
||||
Weather.getInstance().setWeatherSpec(weatherSpec);
|
||||
GBApplication.deviceService().onSendWeather(weatherSpec);
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,23 @@ import ru.gelin.android.weather.notification.ParcelableWeather2;
|
||||
|
||||
public class Weather {
|
||||
private ParcelableWeather2 weather2 = null;
|
||||
public ParcelableWeather2 getWeather2() {return weather2;}
|
||||
public void setWeather2(ParcelableWeather2 weather2) {this.weather2 = weather2;}
|
||||
private WeatherSpec weatherSpec = null;
|
||||
|
||||
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();
|
||||
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.GBDeviceEventSendBytes;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Weather;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
|
||||
|
||||
public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||
@ -115,10 +116,18 @@ public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||
|
||||
@Override
|
||||
public GBDeviceEvent[] handleMessage(ArrayList<Pair<Integer, Object>> pairs) {
|
||||
// Just ACK
|
||||
GBDeviceEventSendBytes sendBytesAck = new GBDeviceEventSendBytes();
|
||||
sendBytesAck.encodedBytes = mPebbleProtocol.encodeApplicationMessageAck(mUUID, mPebbleProtocol.last_id);
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user