revisando mirror mode en PictogramActivity y SessionActivity

parent 673d1552
...@@ -52,7 +52,6 @@ public class ActionTalk implements Emitter.Listener { ...@@ -52,7 +52,6 @@ public class ActionTalk implements Emitter.Listener {
if (action.equals(action_add) || action.equals(action_select) || action.equals(action_show) || action.equals(action_delete)) { if (action.equals(action_add) || action.equals(action_select) || action.equals(action_show) || action.equals(action_delete)) {
int picto_id; int picto_id;
int picto_cat; int picto_cat;
boolean mirroing=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on();
if (action.equals(action_show)) { if (action.equals(action_show)) {
picto_id=picto_cat=-1; picto_id=picto_cat=-1;
} else { } else {
...@@ -61,12 +60,10 @@ public class ActionTalk implements Emitter.Listener { ...@@ -61,12 +60,10 @@ public class ActionTalk implements Emitter.Listener {
JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto); JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto);
picto_id = picto_stupicto.getInt(param_picto_id); picto_id = picto_stupicto.getInt(param_picto_id);
picto_cat = attrs_stu_picto != null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0; picto_cat = attrs_stu_picto != null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0;
mirroing|=attrs_stu_picto.has(Picto.JSON_ATTTRS.MIRROR);
} }
if ( mirroing) { Log.i(LOG_TAG, "Received message '" + action +
Log.i(LOG_TAG, "Received message '" + action +
"' for picto " + picto_id + " (cat " + picto_cat); "' for picto " + picto_id + " (cat " + picto_cat);
for (iActionListener listener : this.listeners) for (iActionListener listener : this.listeners)
listener.action(action.equals(action_add) listener.action(action.equals(action_add)
? iActionListener.action.add ? iActionListener.action.add
: action.equals(action_select) : action.equals(action_select)
...@@ -75,7 +72,7 @@ public class ActionTalk implements Emitter.Listener { ...@@ -75,7 +72,7 @@ public class ActionTalk implements Emitter.Listener {
? iActionListener.action.delete ? iActionListener.action.delete
: iActionListener.action.show : iActionListener.action.show
, picto_cat, picto_id); , picto_cat, picto_id);
}
} }
} catch (JSONException e) { } catch (JSONException e) {
......
...@@ -160,7 +160,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -160,7 +160,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched"); Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
if (action==ActionTalk.iActionListener.action.show) { if (action==ActionTalk.iActionListener.action.show) {
} }
else { else if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on()) {
Picto picto = vocabulary.get_picto(picto_cat, picto_id); Picto picto = vocabulary.get_picto(picto_cat, picto_id);
PictogramActivity.this.execHighligthFeeback(picto, true); PictogramActivity.this.execHighligthFeeback(picto, true);
} }
......
...@@ -45,7 +45,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -45,7 +45,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
float firstTouchX=-1; float firstTouchX=-1;
ListInstructionsFragment listInstructionsFragment= new ListInstructionsFragment(); ListInstructionsFragment listInstructionsFragment= new ListInstructionsFragment();
boolean previous_mirrormode=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on();
private void addLogMsg(final String msg) { private void addLogMsg(final String msg) {
...@@ -301,9 +301,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -301,9 +301,7 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
final Button failBtn =((Button)findViewById(R.id.btn_fail)); final Button failBtn =((Button)findViewById(R.id.btn_fail));
final Button supBtn =((Button)findViewById(R.id.btn_supervised)); final Button supBtn =((Button)findViewById(R.id.btn_supervised));
final Button modBtn =((Button)findViewById(R.id.btn_model)); final Button modBtn =((Button)findViewById(R.id.btn_model));
previous_mirrormode=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on();
if (!PCBcontext.getPcbdb().getCurrentUser().is_mirror_on())
PCBcontext.getPcbdb().getCurrentUser().alter_mirror_mode();
SessionFragment sessionFragment = (SessionFragment) getSupportFragmentManager().findFragmentByTag(SessionActivity.FRAGMENT_SESSION); SessionFragment sessionFragment = (SessionFragment) getSupportFragmentManager().findFragmentByTag(SessionActivity.FRAGMENT_SESSION);
if (sessionFragment==null) sessionFragment=new SessionFragment(); if (sessionFragment==null) sessionFragment=new SessionFragment();
getSupportFragmentManager() getSupportFragmentManager()
...@@ -330,10 +328,6 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -330,10 +328,6 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
final Button supBtn =((Button)findViewById(R.id.btn_supervised)); final Button supBtn =((Button)findViewById(R.id.btn_supervised));
final Button modBtn =((Button)findViewById(R.id.btn_model)); final Button modBtn =((Button)findViewById(R.id.btn_model));
if (previous_mirrormode!=PCBcontext.getPcbdb().getCurrentUser().is_mirror_on())
PCBcontext.getPcbdb().getCurrentUser().alter_mirror_mode();
getSupportFragmentManager() getSupportFragmentManager()
.beginTransaction() .beginTransaction()
.replace(R.id.sessions_fragment_container, listInstructionsFragment, SessionActivity.FRAGMENT_METHOD) .replace(R.id.sessions_fragment_container, listInstructionsFragment, SessionActivity.FRAGMENT_METHOD)
......
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