aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java
diff options
context:
space:
mode:
authorChris Warrington <cmw@google.com>2016-10-18 12:29:21 +0100
committerChris Warrington <cmw@google.com>2016-10-18 12:34:18 +0100
commite3780081075c01aa1dff6d1f373cb43192b33e68 (patch)
treefb734615933a39f3d009210dc0d1457160479b35 /WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java
parent7e05eb7e57827eddc885570bc00aed8a50320dbf (diff)
parent025b8b226c8d8edba2b309ca878572f40512eca7 (diff)
downloadgradle-perf-android-medium-e3780081075c01aa1dff6d1f373cb43192b33e68.tar.gz
Change-Id: I63f5e16d09297c48432192761b840310935eb903
Diffstat (limited to 'WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java')
-rw-r--r--WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java b/WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java
new file mode 100644
index 000000000..d74e568de
--- /dev/null
+++ b/WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java
@@ -0,0 +1,53 @@
+package org.wordpress.android.ui.plans.models;
+
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/*
+Each single Plan has a list of features sections to highlight on the plan details screen. This class model
+a single section to highlight.
+ "features_highlight": [
+ {
+ "items": [
+ "custom-design",
+ "videopress",
+ "support",
+ "space",
+ "domain_map",
+ "no-adverts\/no-adverts.php"
+ ]
+ },
+ {
+ "title": "Included with all plans",
+ "items": [
+ "free-blog"
+ ]
+ }
+ ],
+ */
+public class PlanFeaturesHighlightSection implements Serializable {
+ private final String mTitle; // title (if available) of this section
+ private ArrayList<String> mItems; // slug of the features to highlight in this section
+
+ PlanFeaturesHighlightSection(JSONObject featureSection) throws JSONException{
+ mTitle = featureSection.optString("title");
+ JSONArray items = featureSection.getJSONArray("items");
+ mItems = new ArrayList<>(items.length());
+ for (int i=0; i < items.length(); i++) {
+ mItems.add(items.getString(i));
+ }
+ }
+
+ public String getTitle() {
+ return mTitle;
+ }
+
+ public ArrayList<String> getFeatures() {
+ return mItems;
+ }
+}