blob: 0a643599793e5bd2cfc952e2217439979c904c14 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
package com.mapbox.mapboxsdk.testapp.model.annotations;
import android.graphics.Bitmap;
import android.os.Parcel;
import android.os.Parcelable;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
public class CountryMarkerOptions extends BaseMarkerOptions<CountryMarker, CountryMarkerOptions> {
private String abbrevName;
private int flagRes;
public CountryMarkerOptions abbrevName(String name) {
abbrevName = name;
return getThis();
}
public CountryMarkerOptions flagRes(int imageRes) {
flagRes = imageRes;
return getThis();
}
public CountryMarkerOptions() {
}
private CountryMarkerOptions(Parcel in) {
position((LatLng) in.readParcelable(LatLng.class.getClassLoader()));
snippet(in.readString());
String iconId = in.readString();
Bitmap iconBitmap = in.readParcelable(Bitmap.class.getClassLoader());
Icon icon = IconFactory.recreate(iconId, iconBitmap);
icon(icon);
title(in.readString());
}
@Override
public CountryMarkerOptions getThis() {
return this;
}
@Override
public CountryMarker getMarker() {
return new CountryMarker(this, abbrevName, flagRes);
}
public static final Parcelable.Creator<CountryMarkerOptions> CREATOR
= new Parcelable.Creator<CountryMarkerOptions>() {
public CountryMarkerOptions createFromParcel(Parcel in) {
return new CountryMarkerOptions(in);
}
public CountryMarkerOptions[] newArray(int size) {
return new CountryMarkerOptions[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel out, int flags) {
out.writeParcelable(position, flags);
out.writeString(snippet);
out.writeString(icon.getId());
out.writeParcelable(icon.getBitmap(), flags);
out.writeString(title);
}
}
|