20
20
import retrofit .client .Response ;
21
21
22
22
import com .github .kingaza .aspree .model .TaxonomyModel ;
23
-
23
+ import com .github .kingaza .aspree .protocol .Taxonomies ;
24
+ import com .github .kingaza .aspree .protocol .Taxonomy ;
24
25
25
26
public class MainActivity extends ActionBarActivity
26
27
implements NavigationDrawerFragment .NavigationDrawerCallbacks {
@@ -142,10 +143,14 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
142
143
143
144
final TextView textView = (TextView ) rootView .findViewById (R .id .section_label );
144
145
145
- Callback <TaxonomyModel . Taxonomy > taxonomyCallback = new Callback <TaxonomyModel . Taxonomy >() {
146
+ Callback <Taxonomy > taxonomyCallback = new Callback <Taxonomy >() {
146
147
@ Override
147
- public void success (TaxonomyModel .Taxonomy taxonomy , Response response ) {
148
- textView .setText (taxonomy .toString ());
148
+ public void success (Taxonomy taxonomy , Response response ) {
149
+ String text = "" ;
150
+ for (String s : taxonomy .getTaxonNames () ) {
151
+ text = text + "\n " + s ;
152
+ }
153
+ textView .setText (text );
149
154
Log .i (TAG , response .toString ());
150
155
}
151
156
@@ -154,7 +159,28 @@ public void failure(RetrofitError error) {
154
159
textView .setText ("Spree access failure: " + error .getMessage ());
155
160
}
156
161
};
157
- TaxonomyModel .getTaxonomy (1 , taxonomyCallback );
162
+ //TaxonomyModel.getTaxonomy(1, taxonomyCallback);
163
+
164
+ Callback <Taxonomies > taxonomiesCallback = new Callback <Taxonomies >() {
165
+ @ Override
166
+ public void success (Taxonomies taxonomies , Response response ) {
167
+ String text = "" ;
168
+ for (Taxonomy taxonomy : taxonomies .taxonomies ) {
169
+ text = text + taxonomy .name + "\n " ;
170
+ for (String s : taxonomy .getTaxonNames ()) {
171
+ text = text + "\t " + s + ", " ;
172
+ }
173
+ text = text + "\n " ;
174
+ }
175
+ textView .setText (text );
176
+ }
177
+
178
+ @ Override
179
+ public void failure (RetrofitError error ) {
180
+ textView .setText ("Spree access failure: " + error .getMessage ());
181
+ }
182
+ };
183
+ TaxonomyModel .getTaxonomies (taxonomiesCallback );
158
184
159
185
return rootView ;
160
186
}
0 commit comments