aboutsummaryrefslogtreecommitdiff
path: root/WordPress/src/main/java/org/wordpress/android/ui/plans/models/PlanFeaturesHighlightSection.java
blob: d74e568dec6efc84d31288e816b91d38df726557 (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
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;
    }
}