diff options
author | Tobrun <tobrun@mapbox.com> | 2016-03-22 19:35:46 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2016-03-23 10:26:38 +0100 |
commit | b8aeb1a9f8a576de69956847fc265ea2668f62dc (patch) | |
tree | cdb1f10f5732b36df295ae2440fde14ef4496ce7 /platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model | |
parent | 77b5d77f66c7052a90ee088a503f45be22033464 (diff) | |
download | qtlocation-mapboxgl-b8aeb1a9f8a576de69956847fc265ea2668f62dc.tar.gz |
[android] #4365 - TestApp refactor with RecyclerView selection.
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java new file mode 100644 index 0000000000..32599288db --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/model/Feature.java @@ -0,0 +1,69 @@ +package com.mapbox.mapboxsdk.testapp.model; + +import android.os.Parcel; +import android.os.Parcelable; + +public class Feature implements Parcelable{ + + private String name; + private String label; + private String description; + private String category; + + public Feature(String name, String label, String description, String category) { + this.name = name; + this.label = label; + this.description = description; + this.category = category; + } + + private Feature(Parcel in) { + name = in.readString(); + label = in.readString(); + description = in.readString(); + category = in.readString(); + } + + public String getName() { + return name; + } + + public String getSimpleName() { + String[] split = name.split("\\."); + return split[split.length - 1]; + } + + public String getLabel() { + return label != null ? label : getSimpleName(); + } + + public String getDescription() { + return description != null ? description : "-"; + } + + public String getCategory() { + return category; + } + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel out, int flags) { + out.writeString(name); + out.writeString(label); + out.writeString(description); + out.writeString(category); + } + + public static final Parcelable.Creator<Feature> CREATOR + = new Parcelable.Creator<Feature>() { + public Feature createFromParcel(Parcel in) { + return new Feature(in); + } + + public Feature[] newArray(int size) { + return new Feature[size]; + } + }; +} |