workin on issue #141

parent ae3d9e03
......@@ -78,6 +78,7 @@ public class Vocabulary implements Iterable<Picto> {
modifyAttsPicto(picto_cat, picto_id, args.getJSONObject("attributes"));
} catch (JSONException e) {
e.printStackTrace();
Log.e(LOG_TAG,e.getMessage());
}
break;
}
......@@ -134,7 +135,8 @@ public class Vocabulary implements Iterable<Picto> {
private boolean synchronize_upload() {
boolean upload_pending=false;
try {
PCBcontext.getPcbdb().getStudentVocabulary(this);
this.pictos.clear();
PCBcontext.getPcbdb().getStudentVocabulary(this);
} catch (JSONException e) {
Log.e(this.getClass().getName(), " Picto json error from local storage: " + e.getMessage());
}
......@@ -252,7 +254,7 @@ public class Vocabulary implements Iterable<Picto> {
pictos_cat = new LinkedList<>();
pictos.put(new Integer(picto.get_category()),pictos_cat);
}
pictos_cat.add(picto);
imgs.add(new Img(picto.get_id(), picto.get_url(), Img.VOCABULARY));
}
Log.d(this.getClass().getName(), "Vocabulary size: " + updated_collection.length);
......@@ -393,12 +395,13 @@ public class Vocabulary implements Iterable<Picto> {
return this.pictos.get(new Integer(Picto.NO_CATEGORY));
} else {
LinkedList<Picto> freePictos = new LinkedList<>();
for (LinkedList<Picto> category : pictos.values()) {
for (Picto picto : category) {
LinkedList<Picto> category=pictos.get(new Integer(Picto.NO_CATEGORY));
//for (Picto picto : category) {
for (Picto picto: category) {
if (picto.getFreeRow() != -1 && picto.getFreeColumn() != -1) {
freePictos.add(picto);
}
}
}
return freePictos;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment