VOCA-VocabularyManager-SessionActivity working

parent 15664a9f
......@@ -1130,18 +1130,21 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
case MotionEvent.ACTION_UP:
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 VOCA a VocabularyManager
if (!PCBcontext.getNetService().online()){
GUITools.show_alert(VOCA.this, R.string.session_noinet);
else
}else{
nextActivity = new Intent(this, VocabularyManager.class);
}
in = R.anim.leftin;
out = R.anim.leftout;
}
in = R.anim.leftin;
out = R.anim.leftout;
if (nextActivity != null) {
tape_delivered=false;
finish();
......
......@@ -836,9 +836,6 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
currentCategory = p;
PCBcontext.getActionLog().log(new TalkAction(TalkAction.SELECT, p));
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
// 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 {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
ClipData.Item item = new ClipData.Item("" + position);
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN};
ClipData data = new ClipData("" + position, mimeTypes, item);
// Si es supervisor al hacer longClick deshabilito ese pictograma o lo habilito
Picto p = getCurrentPictoGridAdapter().getItem(position);
if (p != null && !p.is_invisible() && p.is_enabled()) {
// If is not the blank picto, it isn't invisible or disabled
if (p.get_id() != 0 &&
!p.get_status().equalsIgnoreCase("invisible") &&
!p.get_status().equalsIgnoreCase("disabled") &&
tapeAdapter.getCount() < VocabularyManager.this.maxInTape) {
View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
view.startDrag(data, //data to be dragged
shadowBuilder, //drag shadow
view, //local data about the drag and drop operation
0 //no needed flags
);
//view.setVisibility(View.INVISIBLE);
}
if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria
if (getCurrentCategory() != null || /*!PCBcontext.getPcbdb().getCurrentUser().has_categories()*/!PCBcontext.getVocabulary().has_categories()) {
int cat = getCurrentCategory() != null ? currentCategory.get_id() : Picto.NO_CATEGORY;
new PictoMenu(VocabularyManager.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
} else
Toast.makeText(VocabularyManager.this, VocabularyManager.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
} else {
//Si es supervisor hacer aparecer el menú de opciones del picto
new PictoMenu(VocabularyManager.this).createMenuForPicto(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big(),p);
getCurrentPictoGridAdapter().notifyDataSetChanged();
}
return true;
}
......@@ -1026,18 +1017,28 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { // izquierda a derecha
// No action
// Pasa de VocabularyManager a VOCA
if (!PCBcontext.getNetService().online()){
GUITools.show_alert(VocabularyManager.this, R.string.session_noinet);
}else{
nextActivity = new Intent(this, VOCA.class);
in=R.anim.rightin;
out=R.anim.rightout;
}
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!PCBcontext.getNetService().online())
// Pasa de VocabularyManager a SessionActivity
if (!PCBcontext.getNetService().online()) {
GUITools.show_alert(VocabularyManager.this, R.string.session_noinet);
else
nextActivity = new Intent(this, VocabularyManager.class);
} else {
nextActivity = new Intent(this, SessionActivity.class);
in = R.anim.leftin;
out = R.anim.leftout;
}
in = R.anim.leftin;
out = R.anim.leftout;
}
if (nextActivity != null) {
tape_delivered=false;
finish();
......
......@@ -22,6 +22,7 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.tabletlibrary.R;
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.tools.PCBcontext;
import com.yottacode.tools.GUITools;
......@@ -273,17 +274,15 @@ public class SessionActivity extends FragmentActivity implements ListInstruction
break;
case MotionEvent.ACTION_UP:
if (event.getX()> firstTouchX+100) { //izquierda->derecha
nextActivity=new Intent(this,VOCA.class);
nextActivity.putExtra("student_view", false);
// Pasa de SessionActivity a Vocabulary Manager
nextActivity=new Intent(this,VocabularyManager.class);
in=R.anim.rightin;
out=R.anim.rightout;
}
else if (firstTouchX > event.getX()+100) { //derecha->izquierda
nextActivity=new Intent(this,VOCA.class);
nextActivity.putExtra("student_view", true);
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(User.NO_SUPERVISOR);
in=R.anim.leftin;
out=R.anim.leftout;
// No action
}
if (nextActivity!=null) {
startActivity(nextActivity);
......
......@@ -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-lite-9.2.1" level="project" />
<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>
</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