working on #329 and #328

parent 21bf9507
...@@ -22,7 +22,6 @@ import org.json.JSONObject; ...@@ -22,7 +22,6 @@ import org.json.JSONObject;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
...@@ -69,6 +68,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -69,6 +68,7 @@ public class Vocabulary implements Iterable<Picto> {
VocabularyTalk.iVocabularyListener vocabulary_listeners[] = {new VocabularyTalk.iVocabularyListener() { VocabularyTalk.iVocabularyListener vocabulary_listeners[] = {new VocabularyTalk.iVocabularyListener() {
@Override @Override
public void change(action action, int picto_cat, int picto_id, JSONObject args) { public void change(action action, int picto_cat, int picto_id, JSONObject args) {
switch (action) { switch (action) {
case delete: { case delete: {
removePicto(picto_cat, picto_id); removePicto(picto_cat, picto_id);
...@@ -169,7 +169,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -169,7 +169,7 @@ public class Vocabulary implements Iterable<Picto> {
*/ */
public void synchronize() { public void synchronize() {
Log.e(LOG_TAG,"SYNCRO from "+ Arrays.toString(Thread.currentThread().getStackTrace()));
boolean upload_pending=synchronize_upload(); // (i) uploading boolean upload_pending=synchronize_upload(); // (i) uploading
// and (ii) downloading // and (ii) downloading
...@@ -368,7 +368,10 @@ Log.e(LOG_TAG,"SYNCRO from "+ Arrays.toString(Thread.currentThread().getStackTra ...@@ -368,7 +368,10 @@ Log.e(LOG_TAG,"SYNCRO from "+ Arrays.toString(Thread.currentThread().getStackTra
int index=find_picto_index(pic_cat, pic_id); int index=find_picto_index(pic_cat, pic_id);
if (index>=0) { //puede ocurrir que se intente modificar un pictograma que fue borrado if (index>=0) { //puede ocurrir que se intente modificar un pictograma que fue borrado
Picto picto = this.pictos.get(pic_cat).get(index); Picto picto = this.pictos.get(pic_cat).get(index);
String old_legend=picto.get_legend();
picto.set_json_attr(attrs); picto.set_json_attr(attrs);
if (!old_legend.equals(picto.get_legend())) //puede ocurrir que se cambie la leyenda de TODOS los pictos
this.synchronize();
PCBcontext.getPcbdb().modifyPicto(pic_id, attrs.toString()); PCBcontext.getPcbdb().modifyPicto(pic_id, attrs.toString());
} }
else else
......
...@@ -188,7 +188,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin { ...@@ -188,7 +188,7 @@ public class NetService implements Runnable, RestapiWrapper.iSilentLogin {
if(!PCBcontext.getRoom().inRoom()){ if(!PCBcontext.getRoom().inRoom()){
PCBcontext.getRoom().connect(); PCBcontext.getRoom().connect();
} }
//PCBcontext.getVocabulary().synchronize(); PCBcontext.getVocabulary().synchronize();
synchronizeStudentAttributes(); synchronizeStudentAttributes();
nextSynchro(now+restfullSynchroTimming); nextSynchro(now+restfullSynchroTimming);
} }
......
...@@ -5,10 +5,8 @@ import android.app.Activity; ...@@ -5,10 +5,8 @@ import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipDescription; import android.content.ClipDescription;
import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.PixelFormat;
import android.media.Ringtone; import android.media.Ringtone;
import android.media.RingtoneManager; import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
...@@ -18,14 +16,12 @@ import android.speech.tts.UtteranceProgressListener; ...@@ -18,14 +16,12 @@ import android.speech.tts.UtteranceProgressListener;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.DragEvent; import android.view.DragEvent;
import android.view.Gravity;
import android.view.HapticFeedbackConstants; import android.view.HapticFeedbackConstants;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager;
import android.view.animation.AccelerateDecelerateInterpolator; import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Animation; import android.view.animation.Animation;
import android.view.animation.TranslateAnimation; import android.view.animation.TranslateAnimation;
...@@ -51,7 +47,6 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet; ...@@ -51,7 +47,6 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img; import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.tts.TTSHelper; import com.yottacode.pictogram.tts.TTSHelper;
import com.yottacode.tools.GUITools;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
...@@ -611,7 +606,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -611,7 +606,6 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
public void change(action action, int picto_cat, int picto_id, JSONObject args) { public void change(action action, int picto_cat, int picto_id, JSONObject args) {
Log.i(LOG_TAG, "Vocabulary action listened: " + action); Log.i(LOG_TAG, "Vocabulary action listened: " + action);
if (args != null) Log.d(LOG_TAG, "args: " + args.toString()); if (args != null) Log.d(LOG_TAG, "args: " + args.toString());
vocabulary.synchronize();
refresh(); refresh();
} }
......
...@@ -87,7 +87,7 @@ public class NetServiceTablet implements NetService.iNetServiceDevice { ...@@ -87,7 +87,7 @@ public class NetServiceTablet implements NetService.iNetServiceDevice {
public void restart_app(boolean resetPrevUser) { public void restart_app(boolean resetPrevUser) {
Log.e(LOG_TAG,"App restarting, reset last login:"+resetPrevUser); Log.i(LOG_TAG,"App restarting, reset last login:"+resetPrevUser);
Context context=PCBcontext.getActivityContext(); Context context=PCBcontext.getActivityContext();
......
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