SHOW:
|
|
- or go back to the newest paste.
1 | [ | |
2 | ||
3 | { | |
4 | "sett": " ", | |
5 | "glHdr": { | |
6 | "sm": [ ], | |
7 | "scleHPad": false, | |
8 | "st": "sbsm" | |
9 | }, | |
10 | "colrBG": [ | |
11 | 23, | |
12 | 105, | |
13 | 184, | |
14 | 100 | |
15 | ], | |
16 | "colrTB": [ | |
17 | 0, | |
18 | 0, | |
19 | 0, | |
20 | 0 | |
21 | ], | |
22 | "colrTR": [ | |
23 | 255, | |
24 | 255, | |
25 | 255, | |
26 | 100 | |
27 | ], | |
28 | "glFtr": { | |
29 | "icoSz": "icoSzN", | |
30 | "sm": [ ], | |
31 | "scleHPad": false, | |
32 | "gvNR": 3, | |
33 | "gvHIT": false, | |
34 | "gvNC": 3, | |
35 | "st": "igsm" | |
36 | }, | |
37 | "statBr": true | |
38 | }, | |
39 | { | |
40 | "sm": [ | |
41 | { | |
42 | "tbico": "b43-jeep.png", | |
43 | "t": "Welcome!", | |
44 | "w": "http://google.com/start", | |
45 | "st": "w", | |
46 | "wTBL": "wTBLN" | |
47 | }, | |
48 | { | |
49 | "t": "Content screen title", | |
50 | "f": "Eltec%20Spec%20sheet%20Gim%20RD30W.pdf", | |
51 | "st": "f" | |
52 | }, | |
53 | { | |
54 | "tbico": "109-chicken.png", | |
55 | "t": "Sub menu", | |
56 | "sm": [ | |
57 | { | |
58 | "t": "Screen 1", | |
59 | "st": "f" | |
60 | }, | |
61 | { | |
62 | "t": "Screen 2", | |
63 | "w": "Http://google.com", | |
64 | "st": "w", | |
65 | "wTBL": "wTBLT" | |
66 | } | |
67 | ], | |
68 | "st": "sm" | |
69 | }, | |
70 | { | |
71 | "st": "f" | |
72 | } | |
73 | ], | |
74 | "st": "tbm" | |
75 | } | |
76 | ||
77 | - | ] |
77 | + | ] |
78 | ||
79 | ||
80 | //USING GSON In Parse.java | |
81 | public class Parse{ | |
82 | public class Setting { | |
83 | ||
84 | String sett; | |
85 | int[] clorBG; | |
86 | int[] colrTR; | |
87 | int[] colrTRT; | |
88 | int fntIcoGrd; | |
89 | boolean statBr; | |
90 | //List<Share> shrMnuPrest; //Place name that matches to json from json-file element | |
91 | List<SM>sm; | |
92 | List<Share>shrMnuPrest; | |
93 | ||
94 | /* | |
95 | public boolean getStatbar(){ | |
96 | return statBr; | |
97 | } | |
98 | ||
99 | public boolean setStatbar(){ | |
100 | return this.statBr; | |
101 | } | |
102 | */ | |
103 | ||
104 | } | |
105 | ||
106 | public class Share { | |
107 | ||
108 | String shrFBLnk; | |
109 | String shrTwtBdy; | |
110 | String shrTxtMsgBdy; | |
111 | String shrFBBdy; | |
112 | String sndEmlBtn; | |
113 | ||
114 | } | |
115 | ||
116 | public class Screen { | |
117 | ||
118 | String tbico; | |
119 | String t; | |
120 | String st; | |
121 | List<SM>sm; | |
122 | //List<SM2>sm2; should auto load from <SM> List | |
123 | } | |
124 | ||
125 | public class SM { //for Table View | |
126 | ||
127 | String bgFile; | |
128 | String icoSz; | |
129 | String t; | |
130 | boolean gvHIT; | |
131 | int gvNR; | |
132 | int gvNC; | |
133 | String st; | |
134 | List<SM2>sm2; | |
135 | List<Share> share; | |
136 | } | |
137 | ||
138 | static class SM2{ //Sub-menu screen type | |
139 | ||
140 | String st; | |
141 | String t; | |
142 | String f; | |
143 | String cusico; | |
144 | String bgFile; | |
145 | String icoSz; | |
146 | String fb; | |
147 | String wTBL; | |
148 | String w; | |
149 | } | |
150 | ||
151 | public static void main (String[] args) throws Exception{ | |
152 | ||
153 | Log.i("RUNNING","Running Main call"); | |
154 | String jsonLink = readUrl("http://10.0.2.2/"+"json/config.json"); | |
155 | ||
156 | JsonElement json = new JsonParser().parse(jsonLink); | |
157 | JsonArray array = json.getAsJsonArray(); | |
158 | Iterator iterator = array.iterator(); | |
159 | ||
160 | while (iterator.hasNext()){ | |
161 | JsonElement json2 = (JsonElement) iterator.next(); | |
162 | Gson gson = new Gson(); | |
163 | Setting sett = gson.fromJson(json2, Setting.class); | |
164 | //prints entire class | |
165 | System.out.println(sett.toString()); | |
166 | //print WHAT you want!! | |
167 | System.out.println(sett.statBr); | |
168 | System.out.println(sett.clorBG); | |
169 | //System.out.println(sett.colrTRT); | |
170 | System.out.println(sett.colrTRT); | |
171 | ||
172 | } | |
173 | //Gson gson = new Gson(); | |
174 | //Setting sett = gson.fromJson(json, Setting.class); | |
175 | ||
176 | //System.out.println(sett.toString()); | |
177 | ||
178 | } | |
179 | ||
180 | } |