working on PCB issues2

parent 89bd9d4b
...@@ -23,10 +23,17 @@ import org.json.JSONObject; ...@@ -23,10 +23,17 @@ import org.json.JSONObject;
public class Picto extends Img { public class Picto extends Img {
int cont = 0; int cont = 0;
Bitmap bitmap; Bitmap bitmap;
boolean _disvanish=false;
// String constant for logs // String constant for logs
private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName() private final String LOG_TAG = this.getClass().getSimpleName(); // Or .getCanonicalName()
public void set_disvanish(boolean _disvanish) {
this._disvanish = _disvanish;
}
public boolean disvanish() {
return _disvanish;
}
public final static class JSON_ATTTRS { public final static class JSON_ATTTRS {
public static String CATEGORY = "id_cat"; public static String CATEGORY = "id_cat";
public static String COLUMN = "coord_x"; public static String COLUMN = "coord_x";
......
...@@ -144,6 +144,7 @@ ...@@ -144,6 +144,7 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
......
...@@ -6,7 +6,6 @@ import android.graphics.Canvas; ...@@ -6,7 +6,6 @@ import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.util.Log;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.Gravity; import android.view.Gravity;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -31,6 +30,7 @@ public class PictoItemViewGenerator { ...@@ -31,6 +30,7 @@ public class PictoItemViewGenerator {
public static final int LAYOUT = R.layout.picto_grid_item; public static final int LAYOUT = R.layout.picto_grid_item;
public static final int LAYOUT_BIG = R.layout.picto_grid_item_big; public static final int LAYOUT_BIG = R.layout.picto_grid_item_big;
public static int mirror_color=0; public static int mirror_color=0;
public static double scale=1.0;
/** /**
* *
...@@ -236,6 +236,9 @@ public class PictoItemViewGenerator { ...@@ -236,6 +236,9 @@ public class PictoItemViewGenerator {
pictoImage.setScaleY(scale[mirror_color%scale.length]); pictoImage.setScaleY(scale[mirror_color%scale.length]);
if (picto.is_highlight_background()) layout.setBackgroundColor(color[mirror_color%color.length]); if (picto.is_highlight_background()) layout.setBackgroundColor(color[mirror_color%color.length]);
} }
scale = picto.disvanish() ? scale-0.1 : 1.0;
pictoImage.set
} }
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -203,8 +203,8 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -203,8 +203,8 @@ 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) {
Log.i(this.getClass().getCanonicalName(), " Delete item " + position + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")"); Log.i(this.getClass().getCanonicalName(), " Delete item " + position + "(" + PictogramActivity.this.tapeAdapter.getItem(position).get_translation() + ")");
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position))); PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position)));
PictogramActivity.this.tapeAdapter.deleteItem(position); PictogramActivity.this.tapeAdapter.disvanishItem(position);
PictogramActivity.this.tapeAdapter.notifyDataSetChanged(); execDeletePicto(PictogramActivity.this.tapeAdapter,position);
} }
}); });
...@@ -764,7 +764,22 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -764,7 +764,22 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
PictogramActivity.this.tts.play(p.get_translation()); PictogramActivity.this.tts.play(p.get_translation());
if (PictogramActivity.this.feedback_highlight) execHighligthFeeback(p, false); if (PictogramActivity.this.feedback_highlight) execHighligthFeeback(p, false);
} }
private void execDeletePicto(final TapeAdapter tapeAdapter, final int position) {
final ScheduledThreadPoolExecutor exec_delete = new ScheduledThreadPoolExecutor(1);
exec_delete.scheduleAtFixedRate(new Runnable() {
int repeating = 0;
@Override
public void run() {
tapeAdapter.notifyDataSetChanged();
if (repeating++ == 10) {
exec_delete.shutdown();
tapeAdapter.getItem(position).set_disvanish(false);
tapeAdapter.deleteItem(position);
tapeAdapter.notifyDataSetChanged();
}
}
}, 0, 100, TimeUnit.MILLISECONDS);
}
private void execHighligthFeeback(final Picto picto, boolean highlight_background) { private void execHighligthFeeback(final Picto picto, boolean highlight_background) {
boolean same_picto = false; boolean same_picto = false;
picto.set_mirror(true, highlight_background); //comienza feedback picto.set_mirror(true, highlight_background); //comienza feedback
...@@ -857,8 +872,10 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -857,8 +872,10 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
public void onClick(View arg0) { public void onClick(View arg0) {
LinkedList<Picto> lp = tapeAdapter.getAll(); LinkedList<Picto> lp = tapeAdapter.getAll();
// This triggers the "Show" websocket action // This triggers the "Show" websocket action
PCBcontext.getActionLog().log(new PictosAction(lp)); if (lp.size()>0) {
tapeAdapter.ttsAllNew(tts); PCBcontext.getActionLog().log(new PictosAction(lp));
tapeAdapter.ttsAllNew(tts);
}
} }
} }
...@@ -1086,7 +1103,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -1086,7 +1103,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
@Override @Override
public boolean dispatchTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) if (PCBcontext.getPcbdb()!=null && PCBcontext.getPcbdb().getCurrentUser().is_supervisor())
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX(); firstTouchX = event.getX();
......
...@@ -21,7 +21,6 @@ import com.yottacode.pictogram.dao.User; ...@@ -21,7 +21,6 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.dao.UserLogin; import com.yottacode.pictogram.dao.UserLogin;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet; import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException; import org.json.JSONException;
......
...@@ -52,6 +52,11 @@ public class TapeAdapter extends BaseAdapter { ...@@ -52,6 +52,11 @@ public class TapeAdapter extends BaseAdapter {
pictoLinkedList.remove(position); pictoLinkedList.remove(position);
} }
// ELIMINAR ITEM DEL ADAPTADOR
public void disvanishItem(int position){
pictoLinkedList.get(position).set_disvanish(true);
}
// ELIMINAR el último ITEM DEL ADAPTADOR // ELIMINAR el último ITEM DEL ADAPTADOR
public void deleteLastView(){ public void deleteLastView(){
// Controlar excepcion al intentar eliminar el último cuando no hay elementos // Controlar excepcion al intentar eliminar el último cuando no hay elementos
......
...@@ -69,10 +69,10 @@ ...@@ -69,10 +69,10 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_height="350px" android:layout_height="wrap_content"
android:layout_marginStart="67dp" android:layout_marginStart="67dp"
android:background="@color/common_plus_signin_btn_text_dark_pressed" android:background="@color/common_plus_signin_btn_text_dark_pressed"
android:layout_width="400px" android:layout_width="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:id="@+id/stuLay"> android:id="@+id/stuLay">
...@@ -99,12 +99,13 @@ ...@@ -99,12 +99,13 @@
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:background="@color/common_google_signin_btn_text_dark_default" android:background="@color/common_google_signin_btn_text_dark_default"
android:layout_height="350px" android:layout_height="wrap_content"
android:layout_width="400px" android:layout_width="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_alignStart="@+id/entrar_button" android:layout_toEndOf="@id/stuLay"
android:layout_marginStart="270dp"
android:id="@+id/supLay"> android:id="@+id/supLay"
android:gravity="right">
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
......
...@@ -122,7 +122,9 @@ ...@@ -122,7 +122,9 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" 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" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
...@@ -135,11 +137,21 @@ ...@@ -135,11 +137,21 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<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/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" /> <excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" /> <excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" /> <excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content> </content>
......
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