39 lines
1.6 KiB
Java
39 lines
1.6 KiB
Java
package com.google.android.gms.maps.model;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import com.google.android.gms.common.internal.Preconditions;
|
|
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
|
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
|
|
import com.google.android.gms.common.util.IOUtils;
|
|
import java.io.IOException;
|
|
|
|
/* JADX INFO: compiled from: com.google.android.gms:play-services-maps@@19.0.0 */
|
|
/* JADX INFO: loaded from: classes2.dex */
|
|
public final class MapStyleOptions extends AbstractSafeParcelable {
|
|
public static final Parcelable.Creator<MapStyleOptions> CREATOR = new zzo();
|
|
private final String zza;
|
|
|
|
public MapStyleOptions(String str) {
|
|
Preconditions.checkNotNull(str, "json must not be null");
|
|
this.zza = str;
|
|
}
|
|
|
|
public static MapStyleOptions loadRawResourceStyle(Context context, int i) throws Resources.NotFoundException {
|
|
try {
|
|
return new MapStyleOptions(new String(IOUtils.readInputStreamFully(context.getResources().openRawResource(i)), "UTF-8"));
|
|
} catch (IOException e) {
|
|
throw new Resources.NotFoundException("Failed to read resource " + i + ": " + e.toString());
|
|
}
|
|
}
|
|
|
|
@Override // android.os.Parcelable
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
String str = this.zza;
|
|
int iBeginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
|
SafeParcelWriter.writeString(parcel, 2, str, false);
|
|
SafeParcelWriter.finishObjectHeader(parcel, iBeginObjectHeader);
|
|
}
|
|
} |