vocabularymanager

parent 4cb773c3
...@@ -26,7 +26,7 @@ public class PictoMenu { ...@@ -26,7 +26,7 @@ public class PictoMenu {
public static final String IMAGE_PICTO = "imagePicto"; public static final String IMAGE_PICTO = "imagePicto";
public static final String PATH_SOUND = "pathSound"; public static final String PATH_SOUND = "pathSound";
VOCA activity; VocabularyManager activity;
//Variables used on the picto menu (only supervisors) //Variables used on the picto menu (only supervisors)
private static final int CAMERA_PIC_REQUEST = 1; private static final int CAMERA_PIC_REQUEST = 1;
...@@ -40,7 +40,7 @@ public class PictoMenu { ...@@ -40,7 +40,7 @@ public class PictoMenu {
// TODO describe this variable // TODO describe this variable
static final int SELECT_PICTURE = 1; static final int SELECT_PICTURE = 1;
public PictoMenu(VOCA activity) { public PictoMenu(VocabularyManager activity) {
this.activity=activity; this.activity=activity;
} }
......
...@@ -51,6 +51,7 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet; ...@@ -51,6 +51,7 @@ import com.yottacode.pictogram.tabletlibrary.net.NetServiceTablet;
import com.yottacode.pictogram.tools.Img; import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.pictogram.tts.TTSHelper; import com.yottacode.pictogram.tts.TTSHelper;
import com.yottacode.tools.GUITools;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONException; import org.json.JSONException;
...@@ -923,45 +924,27 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -923,45 +924,27 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
*/ */
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) {
/*if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) { 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};
Picto p = getCurrentPictoGridAdapter().getItem(position); ClipData data = new ClipData("" + position, mimeTypes, item);
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(VOCA.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), cat);
} else
Toast.makeText(VOCA.this, VOCA.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
} else { Picto p = getCurrentPictoGridAdapter().getItem(position);
//Si es supervisor hacer aparecer el menú de opciones del picto if (p != null && !p.is_invisible() && p.is_enabled()) {
new PictoMenu(VOCA.this).createMenuForPicto(PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big(),p); // If is not the blank picto, it isn't invisible or disabled
getCurrentPictoGridAdapter().notifyDataSetChanged(); if (p.get_id() != 0 &&
} !p.get_status().equalsIgnoreCase("invisible") &&
} else {*/ !p.get_status().equalsIgnoreCase("disabled") &&
ClipData.Item item = new ClipData.Item("" + position); tapeAdapter.getCount() < VOCA.this.maxInTape) {
String[] mimeTypes = {ClipDescription.MIMETYPE_TEXT_PLAIN}; View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder(view);
ClipData data = new ClipData("" + position, mimeTypes, item);
view.startDrag(data, //data to be dragged
Picto p = getCurrentPictoGridAdapter().getItem(position); shadowBuilder, //drag shadow
if (p != null && !p.is_invisible() && p.is_enabled()) { view, //local data about the drag and drop operation
// If is not the blank picto, it isn't invisible or disabled 0 //no needed flags
if (p.get_id() != 0 && );
!p.get_status().equalsIgnoreCase("invisible") && //view.setVisibility(View.INVISIBLE);
!p.get_status().equalsIgnoreCase("disabled") &&
tapeAdapter.getCount() < VOCA.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);
}
} }
//} }
return true; return true;
} }
} }
...@@ -1131,58 +1114,47 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener ...@@ -1131,58 +1114,47 @@ public class VOCA extends Activity implements VocabularyTalk.iVocabularyListener
} }
} }
/*@Override @Override
public boolean dispatchTouchEvent(MotionEvent event) { public boolean dispatchTouchEvent(MotionEvent event) {
int in=0,out=0; int in=0,out=0;
Intent nextActivity=null; Intent nextActivity = null;
Intent intent = getIntent(); Intent intent = getIntent();
boolean student_view=intent.getBooleanExtra("student_view",false);
if (PCBcontext.getPcbdb()!=null && (PCBcontext.getPcbdb().getCurrentUser().is_supervisor() || student_view) ) { if ( PCBcontext.getPcbdb() != null && PCBcontext.getPcbdb().getCurrentUser().is_supervisor() ) {
switch (event.getAction()) { switch (event.getAction()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
firstTouchX = event.getX(); firstTouchX = event.getX();
break; break;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
if (event.getX() > firstTouchX + 150) { //izquierda a derecha if (event.getX() > firstTouchX + 150) { // izquierda a derecha
if (!student_view || !PCBcontext.getPcbdb().getCurrentUser().is_teacher()) { // No action
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(student_view ? PCBcontext.getDevice().getLastSupId() : User.NO_SUPERVISOR);
nextActivity = intent;
} else
if (!PCBcontext.getNetService().online())
GUITools.show_alert(VOCA.this, R.string.session_noinet);
else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(PCBcontext.getDevice().getLastSupId());
nextActivity = new Intent(this, SessionActivity.class);
}
in = R.anim.rightin;
out = R.anim.rightout;
overridePendingTransition(R.anim.leftin, R.anim.leftout);
} else if (firstTouchX > event.getX() + 150) { //derecha a izquierda } else if (firstTouchX > event.getX() + 150) { //derecha a izquierda
if (!student_view && PCBcontext.getPcbdb().getCurrentUser().is_teacher() ) {
if (!PCBcontext.getNetService().online()) 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, SessionActivity.class); nextActivity = new Intent(this, VocabularyManager.class);
} else {
PCBcontext.getPcbdb().getCurrentUser().get_Img_sup().update_id(student_view ? PCBcontext.getDevice().getLastSupId() : User.NO_SUPERVISOR);
nextActivity = intent;
}
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;
intent.putExtra("student_view", !PCBcontext.getPcbdb().getCurrentUser().is_supervisor());
finish(); finish();
startActivity(nextActivity); startActivity(nextActivity);
overridePendingTransition(in, out); overridePendingTransition(in, out);
} }
break; break;
} }
} }
return super.dispatchTouchEvent(event); return super.dispatchTouchEvent(event);
}*/ }
/** /**
* Para capturar el evento para abrir camara o galeria y procesar * Para capturar el evento para abrir camara o galeria y procesar
......
...@@ -55,6 +55,12 @@ ...@@ -55,6 +55,12 @@
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="landscape" /> android:screenOrientation="landscape" />
<activity
android:name="com.yottacode.pictogram.tabletlibrary.gui.communicator.VocabularyManager"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="landscape" />
<!-- Intent Filter to run the app when the boot is completed --> <!-- Intent Filter to run the app when the boot is completed -->
<receiver android:name=".kiosk.BootReceiver"> <receiver android:name=".kiosk.BootReceiver">
<intent-filter> <intent-filter>
......
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