VOCA-VocabularyManager-SessionActivity working

parent 15664a9f
...@@ -1130,18 +1130,21 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -1130,18 +1130,21 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { // izquierda a derecha if (event.getX() > firstTouchX + 150) { // izquierda a derecha
// No action // No action
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda } else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!PCBcontext.getNetService().online()) // Pasa de VOCA a VocabularyManager
if (!PCBcontext.getNetService().online()){
GUITools.show_alert(VOCA.this, R.string.session_noinet); GUITools.show_alert(VOCA.this, R.string.session_noinet);
else }else{
nextActivity = new Intent(this, VocabularyManager.class); nextActivity = new Intent(this, VocabularyManager.class);
}
}
in = R.anim.leftin; in = R.anim.leftin;
out = R.anim.leftout; out = R.anim.leftout;
}
if (nextActivity != null) { if (nextActivity != null) {
tape_delivered=false; tape_delivered=false;
finish(); finish();
......
...@@ -836,9 +836,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -836,9 +836,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
currentCategory = p; currentCategory = p;
PCBcontext.getActionLog().log(new TalkAction(TalkAction.SELECT, p)); PCBcontext.getActionLog().log(new TalkAction(TalkAction.SELECT, p));
hidePictoMainGridView(); hidePictoMainGridView();
} else if (tapeAdapter.getCount() < VocabularyManager.this.maxInTape && !VocabularyManager.this.tapeAdapter.play()) {
addPictoWord(parent.getChildAt(position),p);
} }
} }
...@@ -909,30 +906,24 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -909,30 +906,24 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
// TODO: REVISAR // TODO: REVISAR
/** /**
* Class used for long pressing on pictos (start drag) * Class used for long pressing on pictos (pictomenu)
*/ */
private class OnPictoLongClickListener implements AdapterView.OnItemLongClickListener { private class OnPictoLongClickListener implements AdapterView.OnItemLongClickListener {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
ClipData.Item item = new ClipData.Item("" + position); // Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClipData data = new ClipData("" + position, mimeTypes, item);
Picto p = getCurrentPictoGridAdapter().getItem(position); Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && !p.is_invisible() && p.is_enabled()) { if (p == null) {
// If is not the blank picto, it isn't invisible or disabled // No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (p.get_id() != 0 && if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().has_categories()) {
!p.get_status().equalsIgnoreCase("invisible") && int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY;
!p.get_status().equalsIgnoreCase("disabled") && new PictoMenu(VocabularyManager.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
tapeAdapter.getCount() < VocabularyManager.this.maxInTape) { } else
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view); Toast.makeText(VocabularyManager.this, VocabularyManager.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
view.startDrag(data, //data to be dragged } else {
shadowBuilder, //drag shadow //Si es supervisor hacer aparecer el menú de opciones del picto
view, //local data about the drag and drop operation new PictoMenu(VocabularyManager.this).createMenuForPicto(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big(),p);
0 //no needed flags getCurrentPictoGridAdapter().notifyDataSetChanged();
);
//view.setVisibility(View.INVISIBLE);
}
} }
return true; return true;
} }
...@@ -1026,18 +1017,28 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -1026,18 +1017,28 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { // izquierda a derecha if (event.getX() > firstTouchX + 150) { // izquierda a derecha
// No action
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!PCBcontext.getNetService().online()) // Pasa de VocabularyManager a VOCA
if (!PCBcontext.getNetService().online()){
GUITools.show_alert(VocabularyManager.this, R.string.session_noinet); GUITools.show_alert(VocabularyManager.this, R.string.session_noinet);
else }else{
nextActivity = new Intent(this, VocabularyManager.class); nextActivity = new Intent(this, VOCA.class);
in=R.anim.rightin;
out=R.anim.rightout;
}
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
// Pasa de VocabularyManager a SessionActivity
if (!PCBcontext.getNetService().online()) {
GUITools.show_alert(VocabularyManager.this, R.string.session_noinet);
} else {
nextActivity = new Intent(this, SessionActivity.class);
in = R.anim.leftin; in = R.anim.leftin;
out = R.anim.leftout; out = R.anim.leftout;
} }
}
if (nextActivity != null) { if (nextActivity != null) {
tape_delivered=false; tape_delivered=false;
finish(); finish();
......
...@@ -22,6 +22,7 @@ import com.yottacode.pictogram.dao.User; ...@@ -22,6 +22,7 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.NetService; import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA; import com.yottacode.pictogram.tabletlibrary.gui.communicator.VOCA;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager;
import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper; import com.yottacode.pictogram.tabletlibrary.net.SessionWrapper;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
...@@ -273,17 +274,15 @@ public class SessionActivity extends FragmentActivity implements ListInstruction ...@@ -273,17 +274,15 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (event.getX()> firstTouchX+100) { //izquierda->derecha if (event.getX()> firstTouchX+100) { //izquierda->derecha
nextActivity=new Intent(this,VOCA.class); // Pasa de SessionActivity a Vocabulary Manager
nextActivity.putExtra("student_view", false); nextActivity=new Intent(this,VocabularyManager.class);
in=R.anim.rightin; in=R.anim.rightin;
out=R.anim.rightout; out=R.anim.rightout;
} }
else if (firstTouchX > event.getX()+100) { //derecha->izquierda else if (firstTouchX > event.getX()+100) { //derecha->izquierda
nextActivity=new Intent(this,VOCA.class);
nextActivity.putExtra("student_view", true); // No action
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
in=R.anim.leftin;
out=R.anim.leftout;
} }
if (nextActivity!=null) { if (nextActivity!=null) {
startActivity(nextActivity); startActivity(nextActivity);
......
...@@ -121,16 +121,5 @@ ...@@ -121,16 +121,5 @@
<orderEntry type="library" exported="" name="play-services-ads-9.2.1" level="project" /> <orderEntry type="library" exported="" name="play-services-ads-9.2.1" 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="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="okhttp-2.3.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-23.0.0" level="project" />
<orderEntry type="library" exported="" name="okio-1.3.0" level="project" />
<orderEntry type="library" exported="" name="gson-2.3" level="project" />
<orderEntry type="library" exported="" name="engine.io-client-0.5.0" level="project" />
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="TEST" name="json-20090211" level="project" />
</component> </component>
</module> </module>
\ No newline at end of file
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