issues #740 y #741 cerrados

parent 6a9cfc82
...@@ -80,12 +80,16 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -80,12 +80,16 @@ public class Vocabulary implements Iterable<Picto> {
} }
break; break;
} }
case update_category:{
Log.i(this.getClass().getCanonicalName(), "Picto category update "+args.toString());
Vocabulary.this.synchronize();
}
case add:{ case add:{
try{ try{
String text= args.getJSONObject("expression").getString("text");
String uri=args.getJSONObject("picto").getString("uri"); String uri=args.getJSONObject("picto").getString("uri");
JSONObject attrs_picto = args.getJSONObject("attributes"); JSONObject attrs_picto = args.getJSONObject("attributes");
String text= attrs_picto.getString("expression");
addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote); addPicto(new Picto(picto_id, uri, text, attrs_picto),ImgDownloader.tsource.remote);
...@@ -177,8 +181,8 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -177,8 +181,8 @@ public class Vocabulary implements Iterable<Picto> {
for (int i=0; i < result.length(); i++) { for (int i=0; i < result.length(); i++) {
ojpicto=result.getJSONObject(i); ojpicto=result.getJSONObject(i);
picto = ojpicto.getJSONObject(jpicto); picto = ojpicto.getJSONObject(jpicto);
expression = ojpicto.getString(jexpression);
attributes = ojpicto.getJSONObject(jattributes); attributes = ojpicto.getJSONObject(jattributes);
expression = attributes.getString(jexpression);
pictos[i] = new Picto(picto.getInt(jid), pictos[i] = new Picto(picto.getInt(jid),
picto.getString(juri), picto.getString(juri),
expression, expression,
......
...@@ -35,6 +35,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -35,6 +35,7 @@ public class VocabularyTalk implements Emitter.Listener {
final String param_picto_id="id"; final String param_picto_id="id";
final String param_picto_cat="id_cat"; final String param_picto_cat="id_cat";
final String action_update="update"; final String action_update="update";
final String action_update_category="update_category";
final String action_add="add"; final String action_add="add";
final String action_delete="delete"; final String action_delete="delete";
...@@ -53,8 +54,9 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -53,8 +54,9 @@ public class VocabularyTalk implements Emitter.Listener {
"' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto); "' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto);
for (iVocabularyListener listener: this.listeners) for (iVocabularyListener listener: this.listeners)
listener.change(action.equals(action_update) ? iVocabularyListener.action.update listener.change(action.equals(action_update) ? iVocabularyListener.action.update
: action.equals(action_add) ? iVocabularyListener.action.add : action.equals(action_update_category) ? iVocabularyListener.action.update_category
: iVocabularyListener.action.delete : action.equals(action_add) ? iVocabularyListener.action.add
: iVocabularyListener.action.delete
, picto_cat, picto_id, stu_picto); , picto_cat, picto_id, stu_picto);
} catch (JSONException e) { } catch (JSONException e) {
...@@ -69,7 +71,7 @@ public class VocabularyTalk implements Emitter.Listener { ...@@ -69,7 +71,7 @@ public class VocabularyTalk implements Emitter.Listener {
* @version 1.0 * @version 1.0
*/ */
public static interface iVocabularyListener { public static interface iVocabularyListener {
public enum action {delete,add,update} public enum action {delete,add, update_category, update}
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);
} }
} }
...@@ -232,7 +232,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -232,7 +232,6 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (!deleting) { if (!deleting) {
Log.i(PictogramActivity.class.getCanonicalName(), " Deleting item " + position + "-" + id + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")"); Log.i(PictogramActivity.class.getCanonicalName(), " Deleting item " + position + "-" + id + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")");
animateImageView(view, position); animateImageView(view, position);
PictogramActivity.this.tapeAdapter.notifyDataSetChanged(); PictogramActivity.this.tapeAdapter.notifyDataSetChanged();
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position))); PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position)));
...@@ -375,11 +374,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -375,11 +374,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
if (tapeAdapter.play()) { if (tapeAdapter.play())
tapeAdapter.endPlay(); tapeAdapter.endPlay();
tapeAdapter.notifyDataSetChanged();
showPictoMainGridView();
}
} }
}); });
} }
...@@ -801,6 +797,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -801,6 +797,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
} else if (tapeAdapter.getCount() < PictogramActivity.this.maxInTape) { } else if (tapeAdapter.getCount() < PictogramActivity.this.maxInTape) {
addPictoWord(p); addPictoWord(p);
} }
} else if (p==null && tapeAdapter.getCount()>0) {
tapeAdapter.endPlay();
showPictoMainGridView();
} }
} }
} }
...@@ -917,12 +916,30 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -917,12 +916,30 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
if (lp.size()>0 && !PictogramActivity.this.tapeAdapter.play()) { if (lp.size()>0 && !PictogramActivity.this.tapeAdapter.play()) {
PCBcontext.getActionLog().log(new PictosAction(lp)); PCBcontext.getActionLog().log(new PictosAction(lp));
tapeAdapter.ttsAllNew(tts); tapeAdapter.ttsAllNew(tts);
if (!PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery()) animateTapeView(0,(ViewGroup)arg0.getParent()); if (!PCBcontext.getPcbdb().getCurrentUser().delete_tape_after_delivery()) {
showOnlyTape(true);
animateTapeView(0,(ViewGroup)arg0.getParent());
}
} }
} }
} }
private void showOnlyTape(boolean onlyTape) {
if (onlyTape) {
if (this.pictoMainGridView.getAnimation() != this.hidePictoMainViewAnimation)
this.pictoMainGridView.startAnimation(this.hidePictoMainViewAnimation);
this.pictoCategoryGridAdapter.clear();
this.pictoCategoryGridView.setBackgroundColor(Color.LTGRAY);
this.showPictoCategoriesViewButton.setVisibility(View.GONE);
this.pictoCategoryGridAdapter.notifyDataSetChanged();
}
else {
this.showPictoCategoriesViewButton.setVisibility(View.VISIBLE);
showPictoMainGridView();
}
}
/** /**
* Class used for canceling a list of pictos on the tape * Class used for canceling a list of pictos on the tape
*/ */
...@@ -1236,6 +1253,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1236,6 +1253,9 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
v.setColorFilter(0); v.setColorFilter(0);
v.setBackgroundColor(ContextCompat.getColor(PCBcontext.getContext(),R.color.picto_default_background)); v.setBackgroundColor(ContextCompat.getColor(PCBcontext.getContext(),R.color.picto_default_background));
PictogramActivity.this.deleting=false; PictogramActivity.this.deleting=false;
if (tapeAdapter.getCount()==0) {
showOnlyTape(false);
}
} }
@Override @Override
......
...@@ -8,4 +8,3 @@ ...@@ -8,4 +8,3 @@
android:toXDelta="0" android:toXDelta="0"
android:interpolator="@android:anim/linear_interpolator" /> android:interpolator="@android:anim/linear_interpolator" />
</set> </set>
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<facet type="android" name="Android"> <facet type="android" name="Android">
<configuration> <configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug" /> <option name="SELECTED_BUILD_VARIANT" value="debug" />
<option name="SELECTED_TEST_ARTIFACT" value="_android_test_" />
<option name="ASSEMBLE_TASK_NAME" value="assembleDebug" /> <option name="ASSEMBLE_TASK_NAME" value="assembleDebug" />
<option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" /> <option name="COMPILE_JAVA_TASK_NAME" value="compileDebugSources" />
<afterSyncTasks> <afterSyncTasks>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" /> <option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" /> <option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" /> <option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" /> <option name="LIBRARY_PROJECT" value="true" />
</configuration> </configuration>
</facet> </facet>
</component> </component>
...@@ -53,6 +54,7 @@ ...@@ -53,6 +54,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/debug/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/res" type="java-test-resource" />
...@@ -60,6 +62,7 @@ ...@@ -60,6 +62,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/testDebug/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/res" type="java-resource" />
...@@ -67,6 +70,7 @@ ...@@ -67,6 +70,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/assets" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/aidl" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
...@@ -74,6 +78,7 @@ ...@@ -74,6 +78,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
...@@ -81,6 +86,7 @@ ...@@ -81,6 +86,7 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" /> <sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
...@@ -91,7 +97,6 @@ ...@@ -91,7 +97,6 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
...@@ -127,6 +132,7 @@ ...@@ -127,6 +132,7 @@
<orderEntry type="library" exported="" name="ion-2.1.9" level="project" /> <orderEntry type="library" exported="" name="ion-2.1.9" level="project" />
<orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-lite-9.2.1" level="project" />
<orderEntry type="module" module-name="commonlibrary" exported="" /> <orderEntry type="module" module-name="commonlibrary" exported="" />
<orderEntry type="library" exported="" name="android-android-24" level="project" />
<orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-ws-2.3.0" level="project" />
<orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" /> <orderEntry type="library" exported="" name="socket.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" /> <orderEntry type="library" exported="" name="okhttp-2.3.0" level="project" />
......
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