Subversion Repository Public Repository

Nextrek

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
package nextrek.minstrek.core;

import java.util.ArrayList;
import java.util.Locale;

import org.json.JSONException;
import org.json.JSONObject;

public class PageModel {

    String text;
    String topImage;
    ArrayList<ButtonModel> buttons = new ArrayList<ButtonModel>();

    public PageModel(JSONObject jsonData) {

        this.text = jsonData.optString("text");

        this.topImage = jsonData.optString("topImage");
        if (this.topImage != null) {
            this.topImage = this.topImage.toLowerCase(Locale.ENGLISH);
        }

        int buttonCount = jsonData.optInt("buttons");
        for (int i = 0; i < buttonCount; i++) {
            try {
                buttons.add(new ButtonModel(jsonData.getJSONObject("button" + i)));
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

    }

    public String getText() {
        return this.text;
    }

    public String getTopImage() {
        return this.topImage;
    }

    public ArrayList<ButtonModel> getButtons() {
        return this.buttons;
    }
}

Commits for Nextrek/Android/Minstrek/MinstrekLib/src/nextrek/minstrek/core/PageModel.java

Diff revisions: vs.
Revision Author Commited Message
4 FMMortaroli picture FMMortaroli Fri 19 Apr, 2013 16:54:38 +0000