issue #630 solved

parent 59a02fe5
......@@ -16,18 +16,18 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
resValue "string", "server", "https://pre.yottacode.com"
resValue "string", "server", "https://pictogram.yottacode.com"
resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "true"
resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "20"
resValue "integer", "netservice_timing", "5"
}
debug {
resValue "string", "server", "https://dev.yottacode.com"
resValue "bool", "force_db_create", "false"
resValue "bool", "ssl_connect", "false"
resValue "bool", "force_img_download", "false"
resValue "integer", "netservice_timing", "20"
resValue "integer", "netservice_timing", "5"
}
}
}
......
......@@ -105,6 +105,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener {
int maxColumns,maxRows,maxInTape;
ScheduledThreadPoolExecutor exec_mirror=null;
Picto prev_picto=null;
private boolean feedback_read;
private boolean feedback_highlight;
......@@ -127,36 +128,13 @@ public class PictogramActivity extends Activity implements iVocabularyListener {
this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this, new iActionListener() {
Picto prev=null;
@Override
public void action(action action, int picto_cat, int picto_id) {
Log.i(this.getClass().getCanonicalName(),action+" from "+picto_cat+","+picto_id+" catched");
final Picto picto=vocabulary.get_picto(picto_cat,picto_id);
picto.set_mirror(true);
if (exec_mirror!=null) {
exec_mirror.shutdown();
exec_mirror=null;
prev.set_mirror(false);
}
exec_mirror = new ScheduledThreadPoolExecutor(1);
prev=picto;
exec_mirror.scheduleAtFixedRate(new Runnable() {
int repeating=0;
@Override
public void run() {
refresh();
if (repeating++==20) {
picto.set_mirror(false);
if (exec_mirror!=null) {
exec_mirror.shutdown();
exec_mirror = null;
}
}
}
},0,500, TimeUnit.MILLISECONDS);
}
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
Picto picto = vocabulary.get_picto(picto_cat, picto_id);
PictogramActivity.this.execHighligthFeeback(picto);
}
);
});
this.vocabulary.setImgDownloaderListener(new iImgDownloaderListener() {
@Override
public void loadComplete() {
......@@ -486,11 +464,13 @@ public class PictogramActivity extends Activity implements iVocabularyListener {
for (Picto p : list) {
if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
if (p.get_column() != -1 && p.get_row() != -1) {
if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p;
}
} else {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1) {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.getFreeColumn()][p.getFreeRow()] = p;
}
}
......@@ -778,24 +758,41 @@ public class PictogramActivity extends Activity implements iVocabularyListener {
}
private void execHighligthFeeback(final Picto picto) {
final ScheduledThreadPoolExecutor exec_HighligthFeeback = new ScheduledThreadPoolExecutor(1);
picto.set_mirror(true);
exec_HighligthFeeback.scheduleAtFixedRate(new Runnable() {
int repeating=0;
@Override
public void run() {
refresh();
if (repeating++==5) {
picto.set_mirror(false);
if (exec_mirror!=null) {
exec_mirror.shutdown();
exec_mirror = null;
boolean same_picto = false;
picto.set_mirror(true); //comienza feedback
if (exec_mirror != null) { //se cancela ejecución del feedbcack anterior, si lo hay
exec_mirror.shutdown();
exec_mirror = null;
}
if (prev_picto != null) { //se cancela marca de feedback del anterior, si lo hay
prev_picto.set_mirror(false);
same_picto=prev_picto == picto;
}
if (same_picto)
prev_picto = null; //por si se pulsaa el mismo boton varias veces
else {
prev_picto = picto;
exec_mirror = new ScheduledThreadPoolExecutor(1);
prev_picto = picto;
exec_mirror.scheduleAtFixedRate(new Runnable() {
int repeating = 0;
@Override
public void run() {
refresh();
if (repeating++ == 20) {
picto.set_mirror(false);
if (exec_mirror != null) {
exec_mirror.shutdown();
exec_mirror = null;
}
}
}
}
},0,500, TimeUnit.MILLISECONDS);
}, 0, 500, TimeUnit.MILLISECONDS);
}
}
/**
* Class used for long pressing on pictos (start drag)
*/
......
......@@ -145,6 +145,7 @@
<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/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
......
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