[andorid] Fix deprecated Parcel.readParcelable()

Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
Roman Tsisyk 2023-11-25 16:47:33 +02:00
parent bbb6fe929c
commit a48c5919a8
3 changed files with 10 additions and 8 deletions

View file

@ -4,6 +4,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.Nullable;
import androidx.core.os.ParcelCompat;
import app.organicmaps.bookmarks.data.Error;
import app.organicmaps.bookmarks.data.Result;
@ -23,8 +24,8 @@ public class OperationStatus implements Parcelable
private OperationStatus(Parcel in)
{
mResult = in.readParcelable(Result.class.getClassLoader());
mError = in.readParcelable(Error.class.getClassLoader());
mResult = ParcelCompat.readParcelable(in, Result.class.getClassLoader(), Result.class);
mError = ParcelCompat.readParcelable(in, Error.class.getClassLoader(), Error.class);
}
public static final Creator<OperationStatus> CREATOR = new Creator<OperationStatus>()

View file

@ -7,6 +7,7 @@ import androidx.annotation.IntRange;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.os.ParcelCompat;
import app.organicmaps.Framework;
import app.organicmaps.routing.RoutePointInfo;
@ -71,7 +72,7 @@ public class Bookmark extends MapObject
super(type, source);
mCategoryId = source.readLong();
mBookmarkId = source.readLong();
mIcon = source.readParcelable(Icon.class.getClassLoader());
mIcon = ParcelCompat.readParcelable(source, Icon.class.getClassLoader(), Icon.class);
mMerX = source.readDouble();
mMerY = source.readDouble();
initXY();

View file

@ -7,6 +7,7 @@ import androidx.annotation.IntDef;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.os.ParcelCompat;
import app.organicmaps.routing.RoutePointInfo;
import app.organicmaps.search.Popularity;
@ -110,8 +111,7 @@ public class MapObject implements PlacePageData
protected MapObject(@MapObjectType int type, Parcel source)
{
//noinspection ResourceType
this(source.readParcelable(FeatureId.class.getClassLoader()), // FeatureId
this(ParcelCompat.readParcelable(source, FeatureId.class.getClassLoader(), FeatureId.class), // FeatureId
type, // MapObjectType
source.readString(), // Title
source.readString(), // SecondaryTitle
@ -119,11 +119,11 @@ public class MapObject implements PlacePageData
source.readString(), // Address
source.readDouble(), // Lat
source.readDouble(), // Lon
source.readParcelable(Metadata.class.getClassLoader()),
ParcelCompat.readParcelable(source, Metadata.class.getClassLoader(), Metadata.class),
source.readString(), // ApiId;
source.readParcelable(RoutePointInfo.class.getClassLoader()), // RoutePointInfo
ParcelCompat.readParcelable(source, RoutePointInfo.class.getClassLoader(), RoutePointInfo.class), // RoutePointInfo
source.readInt(), // mOpeningMode
source.readParcelable(Popularity.class.getClassLoader()),
ParcelCompat.readParcelable(source, Popularity.class.getClassLoader(), Popularity.class),
source.readString(),
source.readInt(),
null // mRawTypes