issue #630 solved

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