mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-15 03:40:31 +02:00
Fix wind speed and direction not being paceled
This also introduces a version to check befor unpaceling.
This commit is contained in:
parent
ef7c00a7df
commit
e57025cd82
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
package nodomain.freeyourgadget.gadgetbridge.model;
|
package nodomain.freeyourgadget.gadgetbridge.model;
|
||||||
|
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
@ -35,6 +36,7 @@ public class WeatherSpec implements Parcelable {
|
|||||||
return new WeatherSpec[size];
|
return new WeatherSpec[size];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
public static final int VERSION = 2;
|
||||||
public int timestamp;
|
public int timestamp;
|
||||||
public String location;
|
public String location;
|
||||||
public int currentTemp;
|
public int currentTemp;
|
||||||
@ -53,15 +55,20 @@ public class WeatherSpec implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected WeatherSpec(Parcel in) {
|
protected WeatherSpec(Parcel in) {
|
||||||
timestamp = in.readInt();
|
int version = in.readInt();
|
||||||
location = in.readString();
|
if (version == VERSION) {
|
||||||
currentTemp = in.readInt();
|
timestamp = in.readInt();
|
||||||
currentConditionCode = in.readInt();
|
location = in.readString();
|
||||||
currentCondition = in.readString();
|
currentTemp = in.readInt();
|
||||||
currentHumidity = in.readInt();
|
currentConditionCode = in.readInt();
|
||||||
todayMaxTemp = in.readInt();
|
currentCondition = in.readString();
|
||||||
todayMinTemp = in.readInt();
|
currentHumidity = in.readInt();
|
||||||
in.readList(forecasts, Forecast.class.getClassLoader());
|
todayMaxTemp = in.readInt();
|
||||||
|
todayMinTemp = in.readInt();
|
||||||
|
windSpeed = in.readFloat();
|
||||||
|
windDirection = in.readInt();
|
||||||
|
in.readList(forecasts, Forecast.class.getClassLoader());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -71,6 +78,7 @@ public class WeatherSpec implements Parcelable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToParcel(Parcel dest, int flags) {
|
public void writeToParcel(Parcel dest, int flags) {
|
||||||
|
dest.writeInt(VERSION);
|
||||||
dest.writeInt(timestamp);
|
dest.writeInt(timestamp);
|
||||||
dest.writeString(location);
|
dest.writeString(location);
|
||||||
dest.writeInt(currentTemp);
|
dest.writeInt(currentTemp);
|
||||||
@ -79,6 +87,8 @@ public class WeatherSpec implements Parcelable {
|
|||||||
dest.writeInt(currentHumidity);
|
dest.writeInt(currentHumidity);
|
||||||
dest.writeInt(todayMaxTemp);
|
dest.writeInt(todayMaxTemp);
|
||||||
dest.writeInt(todayMinTemp);
|
dest.writeInt(todayMinTemp);
|
||||||
|
dest.writeFloat(windSpeed);
|
||||||
|
dest.writeInt(windDirection);
|
||||||
dest.writeList(forecasts);
|
dest.writeList(forecasts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user