Commit 2c9a01b0 by Arturo Montejo Ráez

Merge branch 'develop' of http://gitlab.ujaen.es/yotta/pictogram into develop

parents e1b6287a 252741c0
...@@ -50,6 +50,9 @@ public class Picto extends Img { ...@@ -50,6 +50,9 @@ public class Picto extends Img {
public static String EXPRESSION = "expression"; public static String EXPRESSION = "expression";
public static String MIRROR = "mirror"; public static String MIRROR = "mirror";
public static String LEGEND = "legend"; public static String LEGEND = "legend";
public static String URI_SOUND = "uri_sound";
public static String USER_AVATAR = "user_avatar";
public static String ASSOCIATED_PERSON = "associated_person";
} }
...@@ -88,7 +91,7 @@ public class Picto extends Img { ...@@ -88,7 +91,7 @@ public class Picto extends Img {
Log.e(LOG_TAG,e.getMessage()); Log.e(LOG_TAG,e.getMessage());
} }
} }
public Picto(int id, String url, String translation, int cat, int row, int column, int freeRow, int freeColumn, int stupicto_id) throws JSONException { public Picto(int id, String url, String translation, int cat, int row, int column, int freeRow, int freeColumn, int stupicto_id, String uri_sound, String user_avatar, String associated_person) throws JSONException {
this(id, url, new JSONObject() this(id, url, new JSONObject()
.put(JSON_ATTTRS.CATEGORY, cat) .put(JSON_ATTTRS.CATEGORY, cat)
.put(JSON_ATTTRS.COLUMN, column) .put(JSON_ATTTRS.COLUMN, column)
...@@ -98,7 +101,11 @@ public class Picto extends Img { ...@@ -98,7 +101,11 @@ public class Picto extends Img {
.put(JSON_ATTTRS.STATUS, JSON_ATTTR_STATUS_VALUES.ENABLED) .put(JSON_ATTTRS.STATUS, JSON_ATTTR_STATUS_VALUES.ENABLED)
.put(JSON_ATTTRS.LEGEND,JSON_ATTTR_LEGEND_VALUES.NONE) .put(JSON_ATTTRS.LEGEND,JSON_ATTTR_LEGEND_VALUES.NONE)
.put(JSON_ATTTRS.STUPICTO_ID,stupicto_id) .put(JSON_ATTTRS.STUPICTO_ID,stupicto_id)
.put(JSON_ATTTRS.EXPRESSION,translation)); .put(JSON_ATTTRS.EXPRESSION,translation)
.put(JSON_ATTTRS.URI_SOUND,uri_sound)
.put(JSON_ATTTRS.USER_AVATAR,user_avatar)
.put(JSON_ATTTRS.ASSOCIATED_PERSON,associated_person)
);
} }
public Picto(int id, String url,String translation, String attributes) throws JSONException { public Picto(int id, String url,String translation, String attributes) throws JSONException {
this(id, url, new JSONObject(attributes).put(JSON_ATTTRS.EXPRESSION,translation)); this(id, url, new JSONObject(attributes).put(JSON_ATTTRS.EXPRESSION,translation));
...@@ -106,7 +113,7 @@ public class Picto extends Img { ...@@ -106,7 +113,7 @@ public class Picto extends Img {
public Picto(int id, String url, JSONObject attributes) { public Picto(int id, String url, JSONObject attributes) {
super(id,url,Img.VOCABULARY);; super(id,url,Img.VOCABULARY);
this.attributes = attributes; this.attributes = attributes;
try { try {
if (this.attributes.get(JSON_ATTTRS.CATEGORY)==null) if (this.attributes.get(JSON_ATTTRS.CATEGORY)==null)
...@@ -296,6 +303,20 @@ public class Picto extends Img { ...@@ -296,6 +303,20 @@ public class Picto extends Img {
/** /**
* *
* @return the associated person of a picto
*/
public String get_associated_person() {
String ass_person = null;
try {
ass_person = this.attributes.getString(JSON_ATTTRS.ASSOCIATED_PERSON);
} catch (JSONException e) {
e.printStackTrace();
}
return ass_person;
}
/**
*
* @return the row of the picto * @return the row of the picto
*/ */
public int get_row() { public int get_row() {
...@@ -341,7 +362,26 @@ public class Picto extends Img { ...@@ -341,7 +362,26 @@ public class Picto extends Img {
} }
} }
/**
*
* @return the uri of associated sound of the picto
*/
public String getUriSound(){
try {
return this.attributes.getString(JSON_ATTTRS.URI_SOUND);
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
/**
*
* @return the associated user avatar of the picto
*/
public String getUserAvatar(){
return this.attributes.optString(JSON_ATTTRS.USER_AVATAR);
}
/** /**
* A picto is a category iif: * A picto is a category iif:
......
...@@ -44,6 +44,7 @@ public class User { ...@@ -44,6 +44,7 @@ public class User {
public static String READ="read"; public static String READ="read";
public static String HIGHLIGHT="highlight"; public static String HIGHLIGHT="highlight";
} }
private String supervisors;
private Img img_stu; private Img img_stu;
private String nickname_stu, pwd_stu, name_stu, surname_stu, gender_stu, lang_stu; private String nickname_stu, pwd_stu, name_stu, surname_stu, gender_stu, lang_stu;
private JSONObject attributes_stu; private JSONObject attributes_stu;
...@@ -266,7 +267,13 @@ public class User { ...@@ -266,7 +267,13 @@ public class User {
} }
} }
public String get_Supervisors(){
return this.supervisors;
}
public void set_Supervisors(String newSup) {
this.supervisors = newSup;
}
/** /**
* *
* @return delivery method * @return delivery method
......
...@@ -301,6 +301,13 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -301,6 +301,13 @@ public class Vocabulary implements Iterable<Picto> {
return picto; return picto;
} }
/**
*
* @param pic_cat Category id of the picto
* @param pic_id Id image of the picto
* @description Obtain the id of picto with "picto.get_id()"
* @return
*/
public Picto get_picto(int pic_cat, int pic_id) { public Picto get_picto(int pic_cat, int pic_id) {
Picto picto=null; Picto picto=null;
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat); LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
...@@ -308,6 +315,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -308,6 +315,7 @@ public class Vocabulary implements Iterable<Picto> {
if (pictos_cat.get(i).get_id()==pic_id) picto=pictos_cat.get(i); if (pictos_cat.get(i).get_id()==pic_id) picto=pictos_cat.get(i);
return picto; return picto;
} }
/** /**
* It removes de given pic from the user collection * It removes de given pic from the user collection
* @param pic_id * @param pic_id
...@@ -399,7 +407,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -399,7 +407,7 @@ public class Vocabulary implements Iterable<Picto> {
/* /*
* It saves locally a new picto obtained from the PCB * It saves locally a new picto obtained from the PCB
*/ */
public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y, final iLocalPicto listener) { public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y, int free_category_coord_x, int free_category_coord_y,String uri_sound,String user_avatar,String associated_person, final iLocalPicto listener) {
Picto prev_picto=find_picto(cat, coord_x,coord_y); //¿estamos reemplazanddo un picto que ya existe? Picto prev_picto=find_picto(cat, coord_x,coord_y); //¿estamos reemplazanddo un picto que ya existe?
...@@ -411,7 +419,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -411,7 +419,7 @@ public class Vocabulary implements Iterable<Picto> {
int id=PCBcontext.getDevice().getNextLocalPictoID(); int id=PCBcontext.getDevice().getNextLocalPictoID();
try { try {
final Picto picto = new Picto(id, url, exp, cat, coord_x, coord_y, free_category_coord_x, free_category_coord_y, prev_picto!=null ? prev_picto.get_stupicto_id() : Picto.STUPICTO_NULL); final Picto picto = new Picto(id, url, exp, cat, coord_x, coord_y, free_category_coord_x, free_category_coord_y,prev_picto!=null ? prev_picto.get_stupicto_id() : Picto.STUPICTO_NULL,uri_sound,user_avatar,associated_person);
addPicto(picto, ImgDownloader.tsource.local, new ImgDownloader.iImgDownloaderListener() { addPicto(picto, ImgDownloader.tsource.local, new ImgDownloader.iImgDownloaderListener() {
@Override @Override
public void loadComplete() { public void loadComplete() {
......
...@@ -50,7 +50,7 @@ public class PictoUploader { ...@@ -50,7 +50,7 @@ public class PictoUploader {
bmp=img.get_bitmap(PCBcontext.getContext()); bmp=img.get_bitmap(PCBcontext.getContext());
Log.i(LOG_TAG, "Uploading Picto img " + img.file_name() + " from " + img.get_type() + "- Size:" + bmp.getWidth() + " " + bmp.getHeight()); /*Log.i(LOG_TAG, "Uploading Picto img " + img.file_name() + " from " + img.get_type() + "- Size:" + bmp.getWidth() + " " + bmp.getHeight());*/
File file = img.file(PCBcontext.getContext()); File file = img.file(PCBcontext.getContext());
......
...@@ -26,7 +26,11 @@ import static android.graphics.Color.argb; ...@@ -26,7 +26,11 @@ import static android.graphics.Color.argb;
public class PictoMenu { public class PictoMenu {
private static final String LOG_TAG = PictoMenu.class.getName(); public static final String ID_PICTO_IMAGE = "id_imagen_picto";
public static final String IS_EDIT = "is_edit";
public static final String PATH = "pathImage";
public static final String IMAGE_PICTO = "imagePicto";
PictogramActivity activity; PictogramActivity activity;
//Variables used on the picto menu (only supervisors) //Variables used on the picto menu (only supervisors)
...@@ -50,9 +54,8 @@ public class PictoMenu { ...@@ -50,9 +54,8 @@ public class PictoMenu {
* *
* @param row * @param row
* @param col * @param col
* @param expression
*/ */
public void createMenuForNewPicto(final int row, final int col, final int cat, final String expression) { public void createMenuForNewPicto(final int row, final int col, final int cat) {
ll = new RelativeLayout(PCBcontext.getContext()); ll = new RelativeLayout(PCBcontext.getContext());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT,
...@@ -75,16 +78,14 @@ public class PictoMenu { ...@@ -75,16 +78,14 @@ public class PictoMenu {
PieMenu.setCenterCircle(new Close()); PieMenu.setCenterCircle(new Close());
PieMenu.addMenuEntry(new newPickFromCamera(row,col,cat,expression)); PieMenu.addMenuEntry(new newPickFromCamera(row,col,cat/*,expression*/));
PieMenu.addMenuEntry(new newPickFromGallery(row,col,cat,expression)); PieMenu.addMenuEntry(new newPickFromGallery(row,col,cat/*,expression*/));
ll.addView(PieMenu); ll.addView(PieMenu);
} }
public void addPicto(int row, int col, int cat, String expression, int source) { public void addPicto(int row, int col, int cat, int source) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.EXPRESSION, expression);
//Enviar al PictogramActivity los datos necesarios para crear el picto despues //Enviar al PictogramActivity los datos necesarios para crear el picto despues
if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) { if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
...@@ -95,7 +96,7 @@ public class PictoMenu { ...@@ -95,7 +96,7 @@ public class PictoMenu {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col); activity.getIntent().putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col);
} }
if (source== 0) { //Pick from camera if (source == 0) { //Pick from camera
Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
activity.startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); activity.startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST);
} else { //Pick from file } else { //Pick from file
...@@ -107,10 +108,10 @@ public class PictoMenu { ...@@ -107,10 +108,10 @@ public class PictoMenu {
} }
public void setPicto(int row, int col, int cat, String expression, Bitmap bitmap){ public void setPicto(int row, int col, int cat, Bitmap bitmap, int id_picto){
Intent intent = new Intent(activity, EditPictoActivity.class); Intent intent = new Intent(activity, EditPictoActivity.class);
intent.putExtra(ID_PICTO_IMAGE,id_picto);
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, expression);
//Enviar al PictogramActivity los datos necesarios para editar el picto despues //Enviar al PictogramActivity los datos necesarios para editar el picto despues
if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) { if (PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
...@@ -121,24 +122,11 @@ public class PictoMenu { ...@@ -121,24 +122,11 @@ public class PictoMenu {
intent.putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col); intent.putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, col);
} }
if(bitmap!=null) { ByteArrayOutputStream stream = new ByteArrayOutputStream();
Point size= GUITools.getScreenSize(activity); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
float bWidth = bitmap.getWidth(); byte[] byteArray = stream.toByteArray();
float bHeight = bitmap.getHeight(); intent.putExtra(IMAGE_PICTO, byteArray);
float factorX=size.x*0.7f/bWidth; intent.putExtra(IS_EDIT,true);
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
Bitmap rescaled = Bitmap.createScaledBitmap(bitmap,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
}
intent.putExtra("tipo",true);
activity.startActivityForResult(intent,EditPictoActivity.EDIT_PICTO_REQUEST); activity.startActivityForResult(intent,EditPictoActivity.EDIT_PICTO_REQUEST);
} }
...@@ -297,67 +285,22 @@ public class PictoMenu { ...@@ -297,67 +285,22 @@ public class PictoMenu {
ll.removeAllViewsInLayout(); ll.removeAllViewsInLayout();
try { try {
setPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),p.get_bitmap(PCBcontext.getContext())); setPicto(p.get_row(),p.get_column(),p.get_category(),p.get_bitmap(PCBcontext.getContext()),p.get_id());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
//ll.getChildAt(1).setX(ll.getChildAt(1).getX() + 30);
//children = new ArrayList<>(Arrays.asList(new PickFromCamera(p),new PickFromGallery(p)));
}
public void menuDisabled(){
//ll.getChildAt(1).setX(ll.getChildAt(1).getX() - 30);
}
}
/*public class PickFromCamera implements RadialMenuWidget.RadialMenuEntry
{
Picto p;
public PickFromCamera(Picto picto){
p = picto;
}
public String getName() { return "editText"; }
public String getLabel() { return null; }
public int getIcon() { return R.drawable.camera; }
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; }
public void menuActiviated()
{
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),0);
} }
public void menuDisabled(){} public void menuDisabled(){}
} }
public class PickFromGallery implements RadialMenuWidget.RadialMenuEntry
{
Picto p;
public PickFromGallery(Picto picto){
p = picto;
}
public String getName() { return "editImage"; }
public String getLabel() { return null; }
public int getIcon() { return R.drawable.gallery; }
public List<RadialMenuWidget.RadialMenuEntry> getChildren() { return null; }
public void menuActiviated()
{
ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout();
addPicto(p.get_row(),p.get_column(),p.get_category(),p.get_translation(),1);
}
public void menuDisabled(){}
}*/
public class newPickFromCamera implements RadialMenuWidget.RadialMenuEntry public class newPickFromCamera implements RadialMenuWidget.RadialMenuEntry
{ {
int row,col,cat; int row,col,cat;
String expression; public newPickFromCamera(int row, int col,int cat){
public newPickFromCamera(int row, int col,int cat,String expression){
this.row = row; this.row = row;
this.col = col; this.col = col;
this.cat = cat; this.cat = cat;
this.expression = expression;
} }
public String getName() { return ""; } public String getName() { return ""; }
public String getLabel() { return null; } public String getLabel() { return null; }
...@@ -368,7 +311,7 @@ public class PictoMenu { ...@@ -368,7 +311,7 @@ public class PictoMenu {
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout(); ll.removeAllViewsInLayout();
addPicto(row,col,cat,expression,0); addPicto(row,col,cat,0);
} }
public void menuDisabled(){} public void menuDisabled(){}
} }
...@@ -376,12 +319,10 @@ public class PictoMenu { ...@@ -376,12 +319,10 @@ public class PictoMenu {
public class newPickFromGallery implements RadialMenuWidget.RadialMenuEntry public class newPickFromGallery implements RadialMenuWidget.RadialMenuEntry
{ {
int row,col,cat; int row,col,cat;
String expression; public newPickFromGallery(int row, int col,int cat){
public newPickFromGallery(int row, int col,int cat,String expression){
this.row = row; this.row = row;
this.col = col; this.col = col;
this.cat = cat; this.cat = cat;
this.expression = expression;
} }
public String getName() { return ""; } public String getName() { return ""; }
public String getLabel() { return null; } public String getLabel() { return null; }
...@@ -391,7 +332,7 @@ public class PictoMenu { ...@@ -391,7 +332,7 @@ public class PictoMenu {
{ {
ll.setVisibility(View.GONE); ll.setVisibility(View.GONE);
ll.removeAllViewsInLayout(); ll.removeAllViewsInLayout();
addPicto(row,col,cat,expression,1); addPicto(row,col,cat,1);
} }
public void menuDisabled(){} public void menuDisabled(){}
} }
......
...@@ -869,7 +869,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab ...@@ -869,7 +869,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
if (p == null) { if (p == null) {
// No tengo pictograma. Abro una nueva ventana de selección desde el Carrete del device si no es categoria // 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()) { if (getCurrentCategory() != null || !PCBcontext.getPcbdb().getCurrentUser().has_categories()) {
new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), currentCategory.get_id(),null); new PictoMenu(PictogramActivity.this).createMenuForNewPicto(position % maxColumns, (int) (position / maxColumns), currentCategory.get_id());
} else } else
Toast.makeText(PictogramActivity.this, PictogramActivity.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show(); Toast.makeText(PictogramActivity.this, PictogramActivity.this.getResources().getString(R.string.notNewCats), Toast.LENGTH_SHORT).show();
...@@ -1127,7 +1127,7 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1127,7 +1127,7 @@ protected void showOnlyTape(boolean onlyTape) {
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
Bitmap imagen = null; Bitmap imagen;
switch(requestCode) { switch(requestCode) {
case CAMERA_PIC_REQUEST: //Captura de foto case CAMERA_PIC_REQUEST: //Captura de foto
if (data != null && resultCode==RESULT_OK) { if (data != null && resultCode==RESULT_OK) {
...@@ -1149,18 +1149,24 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1149,18 +1149,24 @@ protected void showOnlyTape(boolean onlyTape) {
break; break;
case EditPictoActivity.EDIT_PICTO_REQUEST: case EditPictoActivity.EDIT_PICTO_REQUEST:
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
boolean edit = data.getBooleanExtra("tipo",false); boolean edit = data.getBooleanExtra(PictoMenu.IS_EDIT,false);
int row = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.ROW, -1); int row = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.ROW, -1);
int col = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.COLUMN, -1); int col = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.COLUMN, -1);
int freeRow = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_ROW, -1); int freeRow = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_ROW) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_ROW, -1);
int freeColumn = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1); int freeColumn = edit ? data.getExtras().getInt(Picto.JSON_ATTTRS.FREE_COLUMN) : getIntent().getIntExtra(Picto.JSON_ATTTRS.FREE_COLUMN, -1);
String uri_sound = edit ? data.getExtras().getString(Picto.JSON_ATTTRS.URI_SOUND) : getIntent().getStringExtra(Picto.JSON_ATTTRS.URI_SOUND);
String associated_person = edit ? data.getExtras().getString(Picto.JSON_ATTTRS.ASSOCIATED_PERSON) : getIntent().getStringExtra(Picto.JSON_ATTTRS.ASSOCIATED_PERSON);
int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1); int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1);
String path = data.getExtras().getString(EditPictoActivity.PATH); String path = data.getExtras().getString(PictoMenu.PATH);
String legend = data.getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION); String legend = data.getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend); Log.i(EditPictoActivity.DEBUG_MESSAGE,"Antes de chooseText...DATOS--> ASS_PERSON: "+associated_person+"..URI_SOUND: "+uri_sound+"..PATH_IMAGE: "+path+"..EXPRESION: "+legend);
//TODO: COGER URI DEL SONIDO,EL USER AVATAR Y LA PERSONA ASOCIADA AL PICTO
chooseTextAndSavePicto(path, row, col, freeRow, freeColumn, cat, legend, uri_sound, null, associated_person);
refresh(); refresh();
} }
break; break;
...@@ -1172,7 +1178,7 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1172,7 +1178,7 @@ protected void showOnlyTape(boolean onlyTape) {
* función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto * función para la edición de un texto asociado a una nueva imagen y guardar el nuevo picto
*/ */
public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn, public void chooseTextAndSavePicto(final String selectedImagePath, final int row, final int col, final int freeRow, final int freeColumn,
final int category, final String legend) { final int category, final String legend,final String uri_sound,final String user_avatar, String associated_person) {
// Set up the buttons // Set up the buttons
int cat = category != -1 ? category : Picto.NO_CATEGORY; int cat = category != -1 ? category : Picto.NO_CATEGORY;
...@@ -1186,6 +1192,9 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1186,6 +1192,9 @@ protected void showOnlyTape(boolean onlyTape) {
col, col,
freeRow, freeRow,
freeColumn, freeColumn,
uri_sound,
user_avatar,
associated_person,
new iLocalPicto() { new iLocalPicto() {
@Override @Override
public void saved(Picto localPicto) { public void saved(Picto localPicto) {
...@@ -1207,26 +1216,12 @@ protected void showOnlyTape(boolean onlyTape) { ...@@ -1207,26 +1216,12 @@ protected void showOnlyTape(boolean onlyTape) {
Intent intent = new Intent(this, EditPictoActivity.class); Intent intent = new Intent(this, EditPictoActivity.class);
if(image!=null) { ByteArrayOutputStream stream = new ByteArrayOutputStream();
Point size=GUITools.getScreenSize(this); image.compress(Bitmap.CompressFormat.PNG, 100, stream);
float bWidth = image.getWidth(); byte[] byteArray = stream.toByteArray();
float bHeight = image.getHeight(); intent.putExtra(PictoMenu.IMAGE_PICTO, byteArray);
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
Bitmap rescaled = Bitmap.createScaledBitmap(image,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream(); startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
intent.putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, getIntent().getStringExtra(Picto.JSON_ATTTRS.EXPRESSION));
startActivityForResult(intent, EditPictoActivity.EDIT_PICTO_REQUEST);
}
} }
} }
...@@ -2,52 +2,64 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper; ...@@ -2,52 +2,64 @@ package com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper;
import android.Manifest; import android.Manifest;
import android.app.Activity; import android.app.Activity;
import android.content.ContentValues;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.database.Cursor; import android.database.Cursor;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Point; import android.graphics.Point;
import android.media.MediaActionSound;
import android.media.MediaPlayer; import android.media.MediaPlayer;
import android.media.MediaRecorder; import android.media.MediaRecorder;
import android.net.Uri; import android.net.Uri;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.Window; import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.yottacode.pictogram.dao.Picto; import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary; import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.PictoUploader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular; import com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictoMenu;
import com.yottacode.pictogram.tabletlibrary.gui.login.MainActivity;
import com.yottacode.pictogram.tools.PCBcontext; import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools; import com.yottacode.tools.GUITools;
import org.json.JSONException;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Random;
import pl.droidsonroids.gif.GifTextView; import pl.droidsonroids.gif.GifTextView;
import static java.lang.Thread.sleep; import static java.lang.Thread.sleep;
/** /**
...@@ -56,14 +68,20 @@ import static java.lang.Thread.sleep; ...@@ -56,14 +68,20 @@ import static java.lang.Thread.sleep;
public class EditPictoActivity extends Activity { public class EditPictoActivity extends Activity {
Picto p;
private boolean editar; private boolean editar;
Random nRandom = new Random();
int pathNumber;
//Sonidos de sistema para grabar
final MediaActionSound recordSoundOn = new MediaActionSound();
final MediaActionSound recordSoundOff = new MediaActionSound();
private static final int CAMERA_PIC_REQUEST = 1; private static final int CAMERA_PIC_REQUEST = 1;
private static final int GALLERY_PIC_REQUEST = 2; private static final int GALLERY_PIC_REQUEST = 2;
private static final String DEBUG_MESSAGE = "Pruebas"; public static final String DEBUG_MESSAGE = "TAG_PRUEBAS";
public static final int EDIT_PICTO_REQUEST = 2288; public static final int EDIT_PICTO_REQUEST = 2288;
public static final int FINISH_EDIT = 2500;
//Botones Final///////////////////////////////////////////////////////////////////// //Botones Final/////////////////////////////////////////////////////////////////////
Button okButton; Button okButton;
...@@ -77,16 +95,26 @@ public class EditPictoActivity extends Activity { ...@@ -77,16 +95,26 @@ public class EditPictoActivity extends Activity {
BotonCircular camara; BotonCircular camara;
BotonCircular galeria; BotonCircular galeria;
public static final String PATH = "pathImage";
public static final String IMAGE_PICTO = "imagePicto";
private static final String LOG_PATH = EditPictoActivity.class.getName();
//For Legend////////////////////////////////////////////////////////////////////////// //For Legend//////////////////////////////////////////////////////////////////////////
EditText legend; EditText legend;
//For Associated Supervisors/////////////////////////////////////////////////////////
Button desplegableSupervisores;
TextView supAsociado;
private ListView mDrawerList;
private ArrayAdapter<String> mAdapter;
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
//For Audio/////////////////////////////////////////////////////////////////////////// //For Audio///////////////////////////////////////////////////////////////////////////
private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200; private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200;
private static String mFileName = null;
private static String previewAudioPath = null;
private String dirImagePath = null;
private String dirAudioPath = null;
private MediaRecorder mRecorder = null; private MediaRecorder mRecorder = null;
private MediaPlayer mPlayer = null; private MediaPlayer mPlayer = null;
...@@ -100,18 +128,20 @@ public class EditPictoActivity extends Activity { ...@@ -100,18 +128,20 @@ public class EditPictoActivity extends Activity {
SeekBar barraReproducir; SeekBar barraReproducir;
TextView textoTTotal; TextView textoTTotal;
TextView textoTGrabacion; TextView textoTGrabacion;
LinearLayout layoutPreview; LinearLayout layoutPreview;
LinearLayout layoutGrabacion; LinearLayout layoutGrabacion;
RecordTask tareaGrabacion; RecordTask tareaGrabacion;
PlayTask tareaReproduccion; PlayTask tareaReproduccion;
//boolean grabando; boolean hayGrabacion;
boolean reproduciendo; boolean reproduciendo;
int tiempoGrabado; int tiempoGrabado;
int tiempoReproducir; int tiempoReproducir;
int tiempoTotal; int tiempoTotal;
int id_pic;
// Requesting permission to RECORD_AUDIO // Requesting permission to RECORD_AUDIO
private boolean permissionToRecordAccepted = false; private boolean permissionToRecordAccepted = false;
private String [] permissions = {Manifest.permission.RECORD_AUDIO}; private String [] permissions = {Manifest.permission.RECORD_AUDIO};
...@@ -149,8 +179,11 @@ public class EditPictoActivity extends Activity { ...@@ -149,8 +179,11 @@ public class EditPictoActivity extends Activity {
tiempoTotal = tiempoGrabado-1; tiempoTotal = tiempoGrabado-1;
barraReproducir.setMax(tiempoTotal); barraReproducir.setMax(tiempoTotal);
botonGrabar.PhidePressedRing(); botonGrabar.PhidePressedRing();
Log.i(DEBUG_MESSAGE,"Fin Grabacion.."+tiempoGrabado);
if(tiempoGrabado>1) hayGrabacion = true ;
else hayGrabacion = false;
reiniciarGrabacion(); reiniciarGrabacion();
Log.i(DEBUG_MESSAGE,"Fin Grabacion..");
} }
} }
...@@ -190,151 +223,291 @@ public class EditPictoActivity extends Activity { ...@@ -190,151 +223,291 @@ public class EditPictoActivity extends Activity {
// Activity Methods //////////////////////////////////////////////////////////////////////////// // Activity Methods ////////////////////////////////////////////////////////////////////////////
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edit_picto_layout); setContentView(R.layout.edit_picto_layout);
Log.i(DEBUG_MESSAGE,"EDITAR ABIERTO");
//Persmisos para grabar audio
ActivityCompat.requestPermissions(this, permissions, REQUEST_RECORD_AUDIO_PERMISSION);
//Editar la lista desplegable de supervisores asociados
mDrawerList = (ListView)findViewById(R.id.navList);
/**Obtener la lista de supervisores y aplicarle formato*/
Log.i(DEBUG_MESSAGE,"Usuario: "+ PCBcontext.getPcbdb().getCurrentUser().get_name_stu());
String supervisors = PCBcontext.getPcbdb().getCurrentUser().get_Supervisors();
Log.i(DEBUG_MESSAGE,"Supervisores: "+ supervisors);
ArrayList<String> supervisores = new ArrayList<>();
if(supervisors != null) {
String[] separated = supervisors.split(";");
for (String supervisor : separated) {
String[] detalles = supervisor.split(",");
supervisores.add(detalles[0] + "\n" + detalles[1]);
}
}else
Log.i(DEBUG_MESSAGE,"No tiene supervisores...");
mAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, supervisores);
mDrawerList.setAdapter(mAdapter);
mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.string.drawer_open, R.string.drawer_close) {
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
}
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu();
}
};
mDrawerToggle.setDrawerIndicatorEnabled(true);
mDrawerLayout.setDrawerListener(mDrawerToggle);
//Aplicar medidas a los elementos de la vista
DisplayMetrics metrics = new DisplayMetrics(); DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics); getWindowManager().getDefaultDisplay().getMetrics(metrics);
LinearLayout ll = (LinearLayout) findViewById(R.id.image_layout); LinearLayout ll = (LinearLayout) findViewById(R.id.image_layout);
Log.i("DETALLES", "Tam menu imagen: " + ll.getLayoutParams().width);
ll.getLayoutParams().width = (int) (metrics.widthPixels * 0.65) - (int) getResources().getDimension(R.dimen.activity_vertical_margin) * 2; ll.getLayoutParams().width = (int) (metrics.widthPixels * 0.65) - (int) getResources().getDimension(R.dimen.activity_vertical_margin) * 2;
Log.i("DETALLES", "Tam menu imagen: " + ll.getLayoutParams().width);
ll.requestLayout(); ll.requestLayout();
FrameLayout fl = (FrameLayout) findViewById(R.id.legend_menu); FrameLayout fl = (FrameLayout) findViewById(R.id.legend_menu);
Log.i("DETALLES", "Tam menu leyenda: " + fl.getLayoutParams().width);
fl.getLayoutParams().width = (int) (metrics.widthPixels * 0.25) - (int) getResources().getDimension(R.dimen.activity_vertical_margin); fl.getLayoutParams().width = (int) (metrics.widthPixels * 0.25) - (int) getResources().getDimension(R.dimen.activity_vertical_margin);
Log.i("DETALLES", "Tam menu leyenda: " + fl.getLayoutParams().width);
fl.requestLayout(); fl.requestLayout();
//Definir rutas de almacenado de imagen y audio
dirImagePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM;
dirImagePath += "/PictoImages";
File fileImage = new File(dirImagePath);
if (!fileImage.exists()) {
fileImage.mkdirs();
}
dirAudioPath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_MUSIC;
dirAudioPath += "/PictoAudio";
File fileAudio = new File(dirAudioPath);
if(!fileAudio.exists()){
fileAudio.mkdirs();
}
previewAudioPath = dirAudioPath+File.separator+"test.3gp";
// Initialize Views. // Initialize Views.
titulo = (TextView) findViewById(R.id.crop_title); titulo = (TextView) findViewById(R.id.crop_title);
cropImageView = (CropImageView) findViewById(R.id.CropImageView); cropImageView = (CropImageView) findViewById(R.id.CropImageView);
legend = (EditText) findViewById(R.id.edtLegend); legend = (EditText) findViewById(R.id.edtLegend);
okButton = (Button) findViewById(R.id.okButton); okButton = (Button) findViewById(R.id.okButton);
cancelButton = (Button) findViewById(R.id.cancelButton); cancelButton = (Button) findViewById(R.id.cancelButton);
String transcription = getIntent().getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
desplegableSupervisores = (Button) findViewById(R.id.botonDesplegable);
supAsociado = (TextView) findViewById(R.id.sup_actual);
botonGrabar = (BotonCircular) findViewById(R.id.botonGrabar);
botonReproducir = (BotonCircular) findViewById(R.id.reproducir);
botonBorrar = (BotonCircular) findViewById(R.id.botonBorrar);
camara = (BotonCircular) findViewById(R.id.camara);
galeria = (BotonCircular) findViewById(R.id.galeria);
gifRecord = (GifTextView) findViewById(R.id.recordImage);
barraReproducir = (SeekBar) findViewById(R.id.barraReproducir);
textoTTotal = (TextView) findViewById(R.id.tiempoTotal);
textoTGrabacion = (TextView) findViewById(R.id.tiempoActual);
layoutPreview = (LinearLayout) findViewById(R.id.layoutPreview);
layoutGrabacion = (LinearLayout) findViewById(R.id.layout_record);
botonReproducir.setEnabled(false);
layoutPreview.setVisibility(View.INVISIBLE);
hayGrabacion = false;
reproduciendo = false;
tiempoGrabado = 0;
tiempoReproducir = 0;
tiempoTotal = 0;
//String transcription = getIntent().getExtras().getString(Picto.JSON_ATTTRS.EXPRESSION);
cropImageView.setFixedAspectRatio(true); cropImageView.setFixedAspectRatio(true);
cropImageView.setGuidelines(2); cropImageView.setGuidelines(2);
//cropImageView.setAspectRatio(cropImageView.getWidth(),cropImageView.getHeight());
if (transcription != null && transcription.length() > 0) //Para ver si la vista es para editar uno ya existente o para añadir uno nuevo
legend.setText(transcription); editar = getIntent().getBooleanExtra(PictoMenu.IS_EDIT,false);
titulo.setText(editar ? R.string.titleCropperEdit : R.string.titleCropperNew);
//Obtener el picto a editar
if(editar){
p = PCBcontext.getVocabulary().get_picto(getIntent().getExtras().getInt(Picto.JSON_ATTTRS.CATEGORY),getIntent().getExtras().getInt(PictoMenu.ID_PICTO_IMAGE));
legend.setText(p.get_translation());
supAsociado.setText(p.get_associated_person());
}
legend.setHorizontallyScrolling(false); legend.setHorizontallyScrolling(false);
legend.setMaxLines(1); legend.setMaxLines(1);
legend.setSingleLine(true); legend.setSingleLine(true);
editar = getIntent().getBooleanExtra("tipo",false);
titulo.setText(editar ? R.string.titleCropperEdit : R.string.titleCropperNew);
//Obtener imagen del intent //Obtener imagen del intent
byte[] byteArray = getIntent().getByteArrayExtra(EditPictoActivity.IMAGE_PICTO); byte[] byteArray = getIntent().getByteArrayExtra(PictoMenu.IMAGE_PICTO);
Bitmap imagePicto = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length); Bitmap imagePicto = scale_image(BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length));
cropImageView.setAspectRatio(editar ? imagePicto.getWidth() : 4,editar ? imagePicto.getHeight() : 3); //Si es editar un picto la ventana de recorte mantiene el tamaño de la imagen, sino 4:3 cropImageView.setAspectRatio(editar ? imagePicto.getWidth() : 4,editar ? imagePicto.getHeight() : 3); //Si es editar un picto la ventana de recorte mantiene el tamaño de la imagen, sino 4:3
cropImageView.setImageBitmap(imagePicto); cropImageView.setImageBitmap(imagePicto);
cropImageView.setMaxWidth(imagePicto.getWidth()); cropImageView.setMaxWidth(imagePicto.getWidth());
cropImageView.setMaxHeight(imagePicto.getHeight()); cropImageView.setMaxHeight(imagePicto.getHeight());
if (transcription != null && transcription.length() > 0) /*if (transcription != null && transcription.length() > 0)
legend.setText(transcription); legend.setText(transcription);*/
editar = getIntent().getBooleanExtra("tipo",false); //TODO: Aqui comprobar si ya hay grabación
titulo.setText(editar ? R.string.titleCropperEdit : R.string.titleCropperNew); //if (hayGrabacionAnterior){
layoutGrabacion.setVisibility(View.VISIBLE);
layoutPreview.setVisibility(View.GONE);
//}else{ Cargar el audio en el mediaPlayer
//layoutGrabacion.setVisibility(View.GONE);
//layoutPreview.setVisibility(View.VISIBLE);
//}
pathNumber = nRandom.nextInt();
//Gestion de botones desplegableSupervisores.setOnClickListener(new View.OnClickListener() {
okButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT))
if (legend.getText().toString().trim().length() > 0) { mDrawerLayout.closeDrawer(Gravity.RIGHT);
final Bitmap croppedImage = cropImageView.getCroppedImage(); else
mDrawerLayout.openDrawer(Gravity.RIGHT);
//Guardar imagen en galeria y obtener la ruta
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
croppedImage.compress(Bitmap.CompressFormat.PNG, 100, bytes);
String title = getResources().getString(R.string.app_name) + ' ' + legend.getText().toString();
String path = MediaStore.Images.Media.insertImage(getContentResolver(), croppedImage, title, null);
path = getRealPathFromURI(Uri.parse(path));
Log.i(LOG_PATH, " New image " + title + " saved at " + path);
Intent intent = getIntent(); //Mandar a pictogram activity el path y el texto de la imagen
intent.putExtra(PATH, path);
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, legend.getText().toString());
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY,getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1));
intent.putExtra("tipo",editar); //Para saber despues si estas editando o añadiendo nuevo y coger los datos de intent o de data en OnActivityResult
setResult(RESULT_OK, intent);
cropImageView.setImageBitmap(croppedImage);
finish(); //Termina la actividad de editar
} else
Toast.makeText(getBaseContext(), R.string.crop_TextRequired, Toast.LENGTH_LONG).show();
} }
}); });
//Si cancela, volver a pictogram activity // Set the list's click listener
cancelButton.setOnClickListener(new View.OnClickListener() { mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onClick(View v) { public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
finish(); String[] assocciated_person = mDrawerList.getAdapter().getItem(position).toString().split("\n");
setResult(RESULT_CANCELED, getIntent()); supAsociado.setText(assocciated_person[1]);
mDrawerLayout.closeDrawer(Gravity.RIGHT);
//Log.i(DEBUG_MESSAGE, "Supervisor Asociado Actual: " + p.get_associated_person());
//p.alter_associated_person(assocciated_person[1]); //cambiar el la persona asociada
//Log.i(DEBUG_MESSAGE,"String: "+assocciated_person[1]);
//Log.i(DEBUG_MESSAGE, "Supervisor Asociado Nuevo: " + p.get_associated_person());
} }
}); });
// Record to the external cache directory for visibility //Gestion de botones
mFileName = getFilesDir().getPath(); okButton.setOnClickListener(new View.OnClickListener() {
mFileName += "/audiorecordtest.3gp"; @Override
public void onClick(View v) {
ContentValues values = new ContentValues(3); if (legend.getText().toString().trim().length() > 0) {
values.put(MediaStore.MediaColumns.TITLE, mFileName); //Guardar imagen en galeria y obtener la ruta
String filepath = null;
String audioPath = null;
try {
id_pic = getIntent().getExtras().getInt(PictoMenu.ID_PICTO_IMAGE);
ActivityCompat.requestPermissions(this, permissions, REQUEST_RECORD_AUDIO_PERMISSION);
//Initialize elements and variables filepath = editar ? dirImagePath + File.separator + legend.getText().toString() + "_" + id_pic + ".png"
botonGrabar = (BotonCircular) findViewById(R.id.botonGrabar); : dirImagePath + File.separator + legend.getText().toString() + "_new_" + pathNumber+ ".png";
botonReproducir = (BotonCircular) findViewById(R.id.reproducir);
botonBorrar = (BotonCircular) findViewById(R.id.botonBorrar);
camara = (BotonCircular) findViewById(R.id.camara);
galeria = (BotonCircular) findViewById(R.id.galeria);
gifRecord = (GifTextView) findViewById(R.id.recordImage);
barraReproducir = (SeekBar) findViewById(R.id.barraReproducir);
textoTTotal = (TextView) findViewById(R.id.tiempoTotal);
textoTGrabacion = (TextView) findViewById(R.id.tiempoActual); File imageFile = new File(filepath);
layoutPreview = (LinearLayout) findViewById(R.id.layoutPreview); if(!editar) { //Si es añadir uno nuevo comprobar que el random no existe ya en el path
layoutGrabacion = (LinearLayout) findViewById(R.id.layout_record); while (imageFile.exists()) {
pathNumber = nRandom.nextInt();
}
filepath = dirImagePath + File.separator + legend.getText().toString() + "_new_" + pathNumber+ ".png";
}
botonReproducir.setEnabled(false); FileOutputStream outputStream = new FileOutputStream(imageFile);
layoutPreview.setVisibility(View.INVISIBLE);
reproduciendo = false; Bitmap bitmap = Bitmap.createBitmap(cropImageView.getCroppedImage());
tiempoGrabado = 0; bitmap.compress(Bitmap.CompressFormat.PNG, 90, outputStream);
tiempoReproducir = 0;
tiempoTotal = 0;
//TODO: Aqui comprobar si ya hay grabación outputStream.flush();
//if (hayGrabacion){ outputStream.close();
layoutGrabacion.setVisibility(View.VISIBLE);
layoutPreview.setVisibility(View.GONE); } catch (FileNotFoundException e) {
//}else{ Cargar el audio en el mediaPlayer e.printStackTrace();
//layoutGrabacion.setVisibility(View.GONE); } catch (IOException e) {
//layoutPreview.setVisibility(View.VISIBLE); e.printStackTrace();
//} }
if(hayGrabacion) { //Si ha grabado algo -> Ir a renombrarlo
File file = new File(previewAudioPath);
if (file.exists()) {
File from = new File(previewAudioPath);
File to = new File(editar ? dirAudioPath + File.separator + legend.getText().toString() + "_" + id_pic + "_audio.3gp" :
dirAudioPath + File.separator + legend.getText().toString() + "_new_" + pathNumber + "_audio.3gp");
if (from.exists()){
from.renameTo(to);
Log.i(DEBUG_MESSAGE,to.getPath().toString());
audioPath = to.getPath().toString();
}
}
}
Intent intent = getIntent(); //Mandar a pictogram activity el path y el texto de la imagen
intent.putExtra(PictoMenu.IS_EDIT, editar); //Para saber despues si estas editando o añadiendo nuevo y coger los datos de intent o de data en OnActivityResult
intent.putExtra(PictoMenu.PATH, filepath); //Mandar Path imagen
intent.putExtra(Picto.JSON_ATTTRS.URI_SOUND,audioPath); //Mandar el path del audio
intent.putExtra(Picto.JSON_ATTTRS.EXPRESSION, legend.getText().toString()); //Mandar expresion nueva
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1));
intent.putExtra(Picto.JSON_ATTTRS.ASSOCIATED_PERSON, supAsociado.getText());
setResult(RESULT_OK, intent);
finish(); //Termina la actividad de editar
} else
Toast.makeText(getBaseContext(), R.string.crop_TextRequired, Toast.LENGTH_LONG).show();
}
});
//Si cancela, volver a pictogram activity
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
setResult(RESULT_CANCELED, getIntent());
}
});
botonGrabar.setOnTouchListener(new View.OnTouchListener() { botonGrabar.setOnTouchListener(new View.OnTouchListener() {
@Override @Override
public boolean onTouch(View v, MotionEvent event) { public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()){ switch(event.getAction()){
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
recordSoundOn.play(MediaActionSound.START_VIDEO_RECORDING);
tareaGrabacion = (RecordTask) new RecordTask().execute(tiempoGrabado); tareaGrabacion = (RecordTask) new RecordTask().execute(tiempoGrabado);
startRecording();
gifRecord.setBackgroundResource(R.drawable.record_animation); gifRecord.setBackgroundResource(R.drawable.record_animation);
try { //Para que no capture el sonido del sistema
sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
startRecording();
Log.i(DEBUG_MESSAGE,"Grabando.."); Log.i(DEBUG_MESSAGE,"Grabando..");
return true; return true;
case MotionEvent.ACTION_UP: case MotionEvent.ACTION_UP:
gifRecord.setBackgroundResource(R.color.white); gifRecord.setBackgroundResource(R.color.white);
tareaGrabacion.cancel(true); tareaGrabacion.cancel(true);
recordSoundOff.play(MediaActionSound.FOCUS_COMPLETE);
return true; return true;
} }
return false; return false;
...@@ -424,7 +597,7 @@ public class EditPictoActivity extends Activity { ...@@ -424,7 +597,7 @@ public class EditPictoActivity extends Activity {
private void startPlaying() { private void startPlaying() {
mPlayer = new MediaPlayer(); mPlayer = new MediaPlayer();
try { try {
mPlayer.setDataSource(mFileName); mPlayer.setDataSource(previewAudioPath);
mPlayer.prepare(); mPlayer.prepare();
mPlayer.start(); mPlayer.start();
} catch (IOException e) { } catch (IOException e) {
...@@ -441,9 +614,9 @@ public class EditPictoActivity extends Activity { ...@@ -441,9 +614,9 @@ public class EditPictoActivity extends Activity {
mRecorder = new MediaRecorder(); mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
Log.i(DEBUG_MESSAGE,mFileName);
mRecorder.setOutputFile(mFileName);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
mRecorder.setOutputFile(previewAudioPath);
try { try {
mRecorder.prepare(); mRecorder.prepare();
...@@ -466,6 +639,7 @@ public class EditPictoActivity extends Activity { ...@@ -466,6 +639,7 @@ public class EditPictoActivity extends Activity {
private void reiniciarGrabacion(){ private void reiniciarGrabacion(){
tiempoGrabado = 0; tiempoGrabado = 0;
textoTGrabacion.setText("00:00 | 00:10"); textoTGrabacion.setText("00:00 | 00:10");
//hayGrabacion = false;
} }
private void reiniciarReproducción(){ private void reiniciarReproducción(){
...@@ -494,6 +668,8 @@ public class EditPictoActivity extends Activity { ...@@ -494,6 +668,8 @@ public class EditPictoActivity extends Activity {
@Override @Override
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT))
mDrawerLayout.closeDrawer(Gravity.RIGHT);
finish(); finish();
setResult(RESULT_CANCELED, getIntent()); setResult(RESULT_CANCELED, getIntent());
return true; return true;
...@@ -504,32 +680,19 @@ public class EditPictoActivity extends Activity { ...@@ -504,32 +680,19 @@ public class EditPictoActivity extends Activity {
protected void onActivityResult(int requestCode, int resultCode, Intent data) { protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data);
//int cat = getIntent().getIntExtra("cat", -1); Bitmap imagen;
Bitmap imagen = null;
Bitmap rescaled = null;
switch(requestCode) { switch(requestCode) {
case CAMERA_PIC_REQUEST: //Captura de foto case CAMERA_PIC_REQUEST: //Captura de foto
if (data != null && resultCode==RESULT_OK) { if (data != null && resultCode==RESULT_OK) {
imagen = (Bitmap) data.getExtras().get("data"); imagen = (Bitmap) data.getExtras().get("data");
if(imagen!=null) { Bitmap rescaled = scale_image(imagen);
Point size= GUITools.getScreenSize(EditPictoActivity.this);
float bWidth = imagen.getWidth();
float bHeight = imagen.getHeight();
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
rescaled = Bitmap.createScaledBitmap(imagen,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
getIntent().putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
}
cropImageView.setImageBitmap(rescaled); cropImageView.setImageBitmap(rescaled);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
getIntent().putExtra(PictoMenu.IMAGE_PICTO, byteArray);
} }
break; break;
...@@ -542,27 +705,35 @@ public class EditPictoActivity extends Activity { ...@@ -542,27 +705,35 @@ public class EditPictoActivity extends Activity {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
if(bitmap!=null) {
Point size= GUITools.getScreenSize(EditPictoActivity.this); Bitmap rescaled = scale_image(bitmap);
float bWidth = bitmap.getWidth();
float bHeight = bitmap.getHeight();
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
rescaled = Bitmap.createScaledBitmap(bitmap,(int) bWidth, (int) bHeight, true);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
getIntent().putExtra(EditPictoActivity.IMAGE_PICTO, byteArray);
}
cropImageView.setImageBitmap(rescaled); cropImageView.setImageBitmap(rescaled);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
rescaled.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
getIntent().putExtra(PictoMenu.IMAGE_PICTO, byteArray);
} }
break; break;
} }
} }
public Bitmap scale_image(Bitmap bitmap){
Bitmap rescaled = null;
if(bitmap!=null) {
Point size= GUITools.getScreenSize(EditPictoActivity.this);
float bWidth = bitmap.getWidth();
float bHeight = bitmap.getHeight();
float factorX=size.x*0.7f/bWidth;
float factorY=size.y*0.7f/bHeight;
float factor= factorY>factorX ? factorX : factorY;
bWidth=bWidth*factor;
bHeight=bHeight*factor;
rescaled = Bitmap.createScaledBitmap(bitmap,(int) bWidth, (int) bHeight, true);
}
return rescaled;
}
} }
...@@ -18,6 +18,7 @@ import com.yottacode.pictogram.dao.User; ...@@ -18,6 +18,7 @@ import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.net.ImgDownloader; import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.tabletlibrary.R; import com.yottacode.pictogram.tabletlibrary.R;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictogramActivity;
import com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.EditPictoActivity;
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.tools.GUITools; import com.yottacode.tools.GUITools;
...@@ -27,6 +28,8 @@ import org.json.JSONException; ...@@ -27,6 +28,8 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector; import java.util.Vector;
/** /**
...@@ -80,8 +83,10 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -80,8 +83,10 @@ public class StudentFragmentGrid extends Fragment{
PCBcontext.set_user(currentUser, null, null); PCBcontext.set_user(currentUser, null, null);
Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class); Intent pictogramActivity = new Intent(getActivity(), PictogramActivity.class);
startActivity(pictogramActivity); startActivity(pictogramActivity);
} else } else {
new_user(i); new_user(i);
download_supervisors(PCBcontext.getPcbdb().getCurrentUser().get_id_stu());
}
} }
private void new_user(int i) { private void new_user(int i) {
...@@ -90,7 +95,7 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -90,7 +95,7 @@ public class StudentFragmentGrid extends Fragment{
try { try {
User new_user = new User( User new_user = new User(
st.getInt(TAG_ID), st.getInt(TAG_ID),
st.getString(TAG_USERNAME), st.getString(TAG_USERNAME),
null, null,
st.getString(TAG_NAME), st.getString(TAG_NAME),
st.getString(TAG_SURNAME), st.getString(TAG_SURNAME),
...@@ -198,6 +203,47 @@ public class StudentFragmentGrid extends Fragment{ ...@@ -198,6 +203,47 @@ public class StudentFragmentGrid extends Fragment{
downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs); downloader.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, imgs);
} }
private void download_supervisors(int stu_id) {
String token = getActivity().getIntent().getExtras().getString("token");
RestapiWrapper wrapper = PCBcontext.getRestapiWrapper();
wrapper.setToken(token);
String operation = "stu/" + stu_id + "/supervisors";
wrapper.ask(operation, new RestapiWrapper.iRestapiListener() {
@Override
public void error(RestapiWrapper.HTTPException e) {
Log.e(this.getClass().getName(), " Server restapi error: " + e.getLocalizedMessage());
GUITools.show_alert(getActivity(), R.string.loginErrorTxt, getString(R.string.serverError), new GUITools.iOKListener() {
@Override
public void ok() {
PCBcontext.getNetService().restart_app(false);
}
});
}
@Override
public void preExecute() {
}
@Override
public void result(JSONArray supervisors) {
String supervisorsFormat = "";
for (int i=0;i<supervisors.length();i++) {
JSONObject supervisor;
try {
supervisor = supervisors.getJSONObject(i);
supervisorsFormat += supervisor.get("name") +" " + supervisor.get("surname") + "," + supervisor.get("email") + ";";
} catch (JSONException e) {
e.printStackTrace();
}
}
PCBcontext.getPcbdb().getCurrentUser().set_Supervisors(supervisorsFormat);
}
@Override
public void result(JSONObject result) {
}
});
}
private void download_students(int sup_id ) { private void download_students(int sup_id ) {
String token = getActivity().getIntent().getExtras().getString("token"); String token = getActivity().getIntent().getExtras().getString("token");
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical" <!-- The main content view -->
android:id="@+id/TotalLayout"
android:background="@android:color/white">
<TextView
android:id="@+id/crop_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/VerdeApp"
android:paddingBottom="8dp"
android:paddingTop="@dimen/content_padding_half"
android:text="@string/titleCropperNew"
android:textAlignment="center"
android:textColor="@color/BlancoApp"
android:textSize="24sp" />
<LinearLayout <LinearLayout
android:orientation="horizontal"
android:layout_height="match_parent"
android:layout_width="match_parent" android:layout_width="match_parent"
android:id="@+id/crop_legend" android:layout_height="match_parent"
android:layout_gravity="center_horizontal"> android:orientation="vertical"
android:id="@+id/TotalLayout"
android:background="@android:color/white">
<TextView
android:id="@+id/crop_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="@color/VerdeApp"
android:paddingBottom="8dp"
android:paddingTop="@dimen/content_padding_half"
android:text="@string/titleCropperNew"
android:textAlignment="center"
android:textColor="@color/BlancoApp"
android:textSize="24sp" />
<LinearLayout <LinearLayout
android:id="@+id/image_layout" android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginLeft="@dimen/activity_vertical_margin" android:layout_width="match_parent"
android:layout_marginTop="@dimen/activity_vertical_margin" android:id="@+id/crop_legend"
android:gravity="center" android:layout_gravity="center_horizontal">
android:orientation="horizontal">
<com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.CropImageView <LinearLayout
android:id="@+id/CropImageView" android:id="@+id/image_layout"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="match_parent"
android:layout_gravity="center" android:layout_marginLeft="@dimen/activity_vertical_margin"
android:adjustViewBounds="true" android:layout_marginTop="@dimen/activity_vertical_margin"
android:cropToPadding="false" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal">
android:scaleType="centerInside" />
</LinearLayout>
<LinearLayout
android:id="@+id/botonera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="25dp"
android:orientation="vertical">
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/camara"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:layout_weight="0.01"
android:background="#00ffffff"
android:src="@drawable/photo_camera" />
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/galeria"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:layout_weight="0.02"
android:background="#00ffffff"
android:src="@drawable/photo_gallery" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
android:layout_marginRight="@dimen/activity_vertical_margin" />
<FrameLayout <com.yottacode.pictogram.tabletlibrary.gui.communicator.cropper.CropImageView
android:id="@+id/legend_menu" android:id="@+id/CropImageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="center"
android:gravity="center" android:adjustViewBounds="true"
android:orientation="vertical" android:cropToPadding="false"
android:paddingRight="5dp" android:orientation="horizontal"
android:weightSum="1"> android:scaleType="centerInside" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:id="@+id/botonera"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginRight="25dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView <com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/textLegend" android:id="@+id/camara"
android:layout_width="match_parent" android:layout_width="64dp"
android:layout_height="wrap_content" android:layout_height="64dp"
android:layout_gravity="center" android:layout_alignParentBottom="false"
android:text="@string/legendText" android:layout_centerHorizontal="false"
android:textColor="@color/gray" android:layout_weight="0.01"
android:textSize="20sp" /> android:background="#00ffffff"
android:src="@drawable/photo_camera" />
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/galeria"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:layout_weight="0.02"
android:background="#00ffffff"
android:src="@drawable/photo_gallery" />
</LinearLayout>
<EditText <View
android:id="@+id/edtLegend" android:layout_width="1dp"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
android:layout_marginRight="@dimen/activity_vertical_margin" />
<FrameLayout
android:id="@+id/legend_menu"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:gravity="center"
android:orientation="vertical"
android:paddingRight="5dp"
android:weightSum="1">
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/textLegend"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@drawable/editpicto_edittext_style" android:orientation="vertical">
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:textColor="@color/black"
android:textColorLink="?android:attr/colorAccent"
android:textCursorDrawable="@null"
android:textSize="20sp" />
<TextView
android:id="@+id/textView_Audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Audio"
android:textColor="@color/gray"
android:textSize="20sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout <LinearLayout
android:id="@+id/layout_record"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="horizontal">
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="visible"
android:weightSum="1">
<pl.droidsonroids.gif.GifTextView
android:id="@+id/recordImage"
android:layout_width="14dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_weight="0.36"
android:background="@color/white" />
<TextView <TextView
android:id="@+id/tiempoActual" android:id="@+id/textAssociated"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:gravity="center" android:layout_weight="1"
android:paddingLeft="5dp" android:text="Asociar a:"
android:paddingRight="16dp" android:textColor="@color/gray"
android:text="00:00 | 00:10" android:textSize="20sp" />
android:textColor="@color/VerdeApp" />
<Button
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular android:id="@+id/botonDesplegable"
android:id="@+id/botonGrabar" android:layout_width="match_parent"
android:layout_width="64dp" android:layout_height="wrap_content"
android:layout_height="64dp" android:layout_weight="1"
android:layout_alignParentBottom="false" android:text="Ver" />
android:layout_centerHorizontal="false"
android:background="#00ffffff"
android:clickable="true"
android:src="@drawable/micro" />
</LinearLayout> </LinearLayout>
<LinearLayout <TextView
android:id="@+id/layoutPreview" android:id="@+id/sup_actual"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:textAlignment="center"
android:textColor="@color/black"
android:textSize="18sp" />
<TextView
android:id="@+id/textLegend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/BlancoApp" android:text="@string/legendText"
android:orientation="vertical" android:textColor="@color/gray"
android:paddingBottom="5dp" android:textSize="20sp" />
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:visibility="invisible">
<TextView <EditText
android:id="@+id/textView" android:id="@+id/edtLegend"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.02" android:layout_below="@+id/textLegend"
android:text="Preview" android:layout_gravity="center"
android:textAlignment="center" android:layout_marginBottom="15dp"
android:textColor="@android:color/black" /> android:background="@drawable/editpicto_edittext_style"
android:ems="10"
android:gravity="center"
android:imeOptions="actionDone"
android:maxLines="1"
android:textColor="@color/black"
android:textColorLink="?android:attr/colorAccent"
android:textCursorDrawable="@null"
android:textSize="20sp" />
<TextView
android:id="@+id/textView_Audio"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:text="Audio"
android:textColor="@color/gray"
android:textSize="20sp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="5dp">
<LinearLayout <LinearLayout
android:id="@+id/LinearLayout" android:id="@+id/layout_record"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:orientation="horizontal"> android:orientation="horizontal"
android:paddingTop="5dp"
android:visibility="visible"
android:weightSum="1">
<pl.droidsonroids.gif.GifTextView
android:id="@+id/recordImage"
android:layout_width="14dp"
android:layout_height="20dp"
android:layout_gravity="center"
android:layout_weight="0.36"
android:background="@color/white" />
<TextView
android:id="@+id/tiempoActual"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:paddingLeft="5dp"
android:paddingRight="16dp"
android:text="00:00 | 00:10"
android:textColor="@color/VerdeApp" />
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular <com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/reproducir" android:id="@+id/botonGrabar"
android:layout_width="48dp" android:layout_width="64dp"
android:layout_height="48dp" android:layout_height="64dp"
android:layout_alignParentBottom="false" android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false" android:layout_centerHorizontal="false"
android:background="#00ffffff" android:background="#00ffffff"
android:src="@android:drawable/ic_media_play" /> android:clickable="true"
android:src="@drawable/micro" />
<LinearLayout </LinearLayout>
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/layoutPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/BlancoApp"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:visibility="invisible">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0.00" android:layout_weight="0.02"
android:orientation="vertical"> android:text="Preview"
android:textAlignment="center"
<SeekBar android:textColor="@android:color/black" />
android:id="@+id/barraReproducir"
style="@style/Widget.AppCompat.SeekBar" <LinearLayout
android:layout_width="125dp" android:id="@+id/LinearLayout"
android:layout_height="wrap_content" /> android:layout_width="match_parent"
android:layout_height="match_parent"
<TextView android:gravity="center"
android:id="@+id/tiempoTotal" android:orientation="horizontal">
android:layout_width="match_parent"
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/reproducir"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:background="#00ffffff"
android:src="@android:drawable/ic_media_play" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="top|center" android:layout_weight="0.00"
android:text="00:00 | 00:00" android:orientation="vertical">
android:textColor="@color/VerdeApp" />
<SeekBar
android:id="@+id/barraReproducir"
style="@style/Widget.AppCompat.SeekBar"
android:layout_width="125dp"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tiempoTotal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center"
android:text="00:00 | 00:00"
android:textColor="@color/VerdeApp" />
</LinearLayout>
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/botonBorrar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:background="#00ffffff"
android:src="@android:drawable/ic_menu_delete" />
</LinearLayout> </LinearLayout>
<com.yottacode.pictogram.tabletlibrary.gui.communicator.BotonCircular
android:id="@+id/botonBorrar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="false"
android:background="#00ffffff"
android:src="@android:drawable/ic_menu_delete" />
</LinearLayout> </LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout> </FrameLayout>
<LinearLayout </LinearLayout>
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_marginBottom="10dp"
android:gravity="bottom|center_horizontal"
android:orientation="horizontal">
<Button <LinearLayout
android:id="@+id/okButton" android:layout_width="260dp"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="@string/accept"
android:textAlignment="center"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp" />
<Button
android:id="@+id/cancelButton"
android:layout_width="110dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/cancel" android:layout_gravity="bottom|center"
android:textAlignment="center" android:layout_marginBottom="10dp"
android:textColor="?android:attr/textColorPrimary" android:gravity="bottom|center_horizontal"
android:textSize="18sp" /> android:orientation="horizontal">
</LinearLayout> <Button
android:id="@+id/okButton"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="@string/accept"
android:textAlignment="center"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp" />
<Button
android:id="@+id/cancelButton"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:text="@string/cancel"
android:textAlignment="center"
android:textColor="?android:attr/textColorPrimary"
android:textSize="18sp" />
</LinearLayout>
</FrameLayout>
</FrameLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/navList"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="right|end"
android:background="#ffeeeeee"/>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
...@@ -47,4 +47,6 @@ ...@@ -47,4 +47,6 @@
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string> <string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="uploadingImage">Subiendo imagen al servidor</string> <string name="uploadingImage">Subiendo imagen al servidor</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="drawer_open">Open Menu</string>
<string name="drawer_close">Close Menu</string>
</resources> </resources>
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
TIMESTAMP=`date +"%Y%m%d"` TIMESTAMP=`date +"%Y%m%d"`
tar zcf /home/ubuntu/backup/${TIMESTAMP}-sails_src.tgz /home/ubuntu/pictogram/sails/src tar zcf /home/ubuntu/backup/${TIMESTAMP}-sails_src.tgz /home/ubuntu/pictogram/sails/src
mysqldump -u root -p'r00...Tt' pictodb |gzip > /ho:::me/ubuntu/backup/${TIMESTAMP}-mysql.sql.gz mysqldump -u root -p'r00...Tt' pictodb |gzip > /home/ubuntu/backup/${TIMESTAMP}-mysql.sql.gz
git pull git pull
sudo forever stopall sudo forever stopall
(cd src; sudo forever start app.js) (cd src; sudo forever start app.js)
...@@ -4,7 +4,7 @@ Changes to be performed manually in servers to upgrade ...@@ -4,7 +4,7 @@ Changes to be performed manually in servers to upgrade
## AngularJS ## AngularJS
(already done in dev) (already done in dev & pre)
- angular-re-captcha has been replaced by angular-recaptcha, so bower has to be run - angular-re-captcha has been replaced by angular-recaptcha, so bower has to be run
- reinstall ui-bootstrap - reinstall ui-bootstrap
...@@ -13,14 +13,13 @@ Changes to be performed manually in servers to upgrade ...@@ -13,14 +13,13 @@ Changes to be performed manually in servers to upgrade
## Database ## Database
(ToDo in dev) (already done in dev & pre)
- add arasaac to source table
`INSERT INTO `source` (`id`, `name`, `description`) VALUES (3, 'Arasaac', 'Arasaac pictograms collection');`
- add arasaac to source table
`INSERT INTO `source` (`id`, `name`, `description`) VALUES (3, 'Arasaac', 'Arasaac pictograms collection');`
- alter table supervisor add arasaac license: - alter table supervisor add arasaac license:
`ALTER TABLE supervisor ADD COLUMN arasaac_license BOOLEAN DEFAULT FALSE;` `ALTER TABLE supervisor ADD COLUMN arasaac_license BOOLEAN DEFAULT FALSE;`
- load arasaac.sql into MySQL
(already done in dev)
- load pictocat_tree_populate.sql - load pictocat_tree_populate.sql
`source /vagrant/roles/database/files/pictocat_tree_populate.sql;` `source /vagrant/roles/database/files/pictocat_tree_populate.sql;`
......
...@@ -95,24 +95,42 @@ module.exports = { ...@@ -95,24 +95,42 @@ module.exports = {
* @param {request} req {} (with studentId specified as url parameters) * @param {request} req {} (with studentId specified as url parameters)
* @param {response} res * @param {response} res
* { * {
* id: 12, "office": 383,
* office: 1234, "id": 92,
* username: 'johnydoe', "username": "jose",
* name: 'Johny', "name": "AAjose",
* surname: 'Doe', "surname": "AAjose antonio",
* birthdate: '2009-12-10T00:00:00.000Z', "birthdate": "2009-05-12T00:00:00.000Z",
* gender: 'F', "gender": "M",
* country: 'ES', "country": "ES",
* pic: 'avatar/nice/url.jpg', "pic": "/upload/studentAvatar/defaultAvatar.jpg",
* notes: null, "notes": "",
* lang: 'en-en', "lang": "es-es",
* iat: 123512, "current_method": "Comunicación Aumentativa y Adaptativa", // May be "no method"
* exp: 1231292, "current_instruction": "Fase 4 - Estructura de la oración", // May be "no instruction"
* attributes: { @see Student.getValidAttributes() }, "supervision": 2 // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist, 3 -> student himself
* current_method: 'Do Things', // May be null "attributes": { @see Student.getValidAttributes()
* current_instruction: 'Do Stuff', // May be null "categories": true,
* supervision: 0|1|2, // supervision level according to requester 0 -> office admin, 1 -> tutor, 2 -> therapist "input_feedback": {
* } "vibration": true,
"read": false,
"beep": false,
"highlight": false
},
"input_selection": {
"click": true,
"double_click": false,
"long_press": false,
"drag": true
},
"legend": false,
"legend_size": "normal",
"size": "large",
"picto_background": "#0000ff",
"tape_background": "#00ffff",
"delivery": 0
}
}
*/ */
getInfo: function (req, res) { getInfo: function (req, res) {
Student.findOne({id: req.params.id_stu}) Student.findOne({id: req.params.id_stu})
...@@ -144,9 +162,9 @@ module.exports = { ...@@ -144,9 +162,9 @@ module.exports = {
else if (stu_sup && !req.token.office) else if (stu_sup && !req.token.office)
student.supervision = 1; // requester is tutor of the studend student.supervision = 1; // requester is tutor of the studend
else if (stu_sup && req.token.office && student.office == req.token.office.id) else if (stu_sup && req.token.office && student.office == req.token.office.id)
student.supervision = 2; // requester is supervisor of student student.supervision = 2; // requester is supervisor of student
else if (req.token.isStudent && req.token.id == student.id) else if (req.token.isStudent && req.token.id == student.id)
student.supervision = 3 // requester is the student himself student.supervision = 3 // requester is the student himself
if (student.supervision == -1) // should not hace access!!! if (student.supervision == -1) // should not hace access!!!
return res.forbidden("Access to this student should not be granted to you"); return res.forbidden("Access to this student should not be granted to you");
...@@ -966,7 +984,9 @@ module.exports = { ...@@ -966,7 +984,9 @@ module.exports = {
* legend: true/[false], * legend: true/[false],
* legend_size: '[small]/large', * legend_size: '[small]/large',
* expression: 'custom expression', * expression: 'custom expression',
* color: any valid HEX color or [null] * color: any valid HEX color or [null],
* sound_uri: path to sound file,
* user_avatar: email (supervisor) or username (student) for associated account
* } * }
* }, * },
* } * }
......
...@@ -90,6 +90,8 @@ module.exports = { ...@@ -90,6 +90,8 @@ module.exports = {
color: null, color: null,
expression: null, expression: null,
legend: 'none', legend: 'none',
uri_sound: null,
user_avatar: null
}; };
if (typeof attributes === 'object') { if (typeof attributes === 'object') {
...@@ -128,13 +130,19 @@ module.exports = { ...@@ -128,13 +130,19 @@ module.exports = {
} }
if (!((/^(none|normal|full)$/).test(validAttributes.legend))) { if (!((/^(none|normal|full)$/).test(validAttributes.legend))) {
delete validAttributes.legend; delete validAttributes.legend;
} }
if (typeof validAttributes.highlight !== 'boolean') { if (typeof validAttributes.highlight !== 'boolean') {
delete validAttributes.highlight; delete validAttributes.highlight;
} }
if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.color))) { if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.color))) {
delete validAttributes.color; delete validAttributes.color;
} }
if (typeof validAttributes.sound_uri!== 'string') {
delete validAttributes.sound_uri;
}
if (typeof validAttributes.user_avatar !== 'string') {
delete validAttributes.user_avatar;
}
} }
sails.log.verbose('Valid attributes for StuPicto', validAttributes); sails.log.verbose('Valid attributes for StuPicto', validAttributes);
return Object.assign({}, defaultAttributes, validAttributes); return Object.assign({}, defaultAttributes, validAttributes);
......
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
"apply":"Apply", "apply":"Apply",
"annual": "Annual", "annual": "Annual",
"April": "April", "April": "April",
"arasaac_license": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao.",
"arasaac_license_import": "The pictographic symbols used in this section are the property of CATEDU (http://arasaac.org/) under a Creative Commons license and have been created by Sergio Palau. By importing you accept the ",
"arasaac_license_import2": "terms of use",
"arasaac_license_link": "http://www.arasaac.org/condiciones_uso.php",
"attributes_not_updated": "Changes not saved", "attributes_not_updated": "Changes not saved",
"attributes_updated": "Changes saved", "attributes_updated": "Changes saved",
"attributes_updating": "Saving...", "attributes_updating": "Saving...",
...@@ -95,6 +99,7 @@ ...@@ -95,6 +99,7 @@
"disclaimer_accept": "I have read and accept <a href='/app/#/disclaimer' target='_blank'>conditions of use</a>", "disclaimer_accept": "I have read and accept <a href='/app/#/disclaimer' target='_blank'>conditions of use</a>",
"disclaimer_p1": "In conformance with Organic Law 15/1999 on Data Protection, Yottacode S.L. informs that it commits to maintaining the secrecy and confidentiality of the personal information received by adopting all the necessary measures to avoid its loss, modification without consent, or unauthorized access in accordance with the Law on Personal Data Protection and its Development Regulation approved by Royal Decree 1720/2007 of December 21. Likewise, the User may exercise, at any given moment, the rights established in Organic Law 15/1999 of December 13 on Personal Data Protection to access, rectify, cancel or oppose the data by notifying Yottacode S.L.", "disclaimer_p1": "In conformance with Organic Law 15/1999 on Data Protection, Yottacode S.L. informs that it commits to maintaining the secrecy and confidentiality of the personal information received by adopting all the necessary measures to avoid its loss, modification without consent, or unauthorized access in accordance with the Law on Personal Data Protection and its Development Regulation approved by Royal Decree 1720/2007 of December 21. Likewise, the User may exercise, at any given moment, the rights established in Organic Law 15/1999 of December 13 on Personal Data Protection to access, rectify, cancel or oppose the data by notifying Yottacode S.L.",
"disclaimer_p2": "Yottacode S.L. is not responsible for the consequences derived of the use of its products. Yottacode S.L. forbids malicious usage of the Pictogram platform and any access form out from its security policies. Any of these acts may result in legal prosecution.", "disclaimer_p2": "Yottacode S.L. is not responsible for the consequences derived of the use of its products. Yottacode S.L. forbids malicious usage of the Pictogram platform and any access form out from its security policies. Any of these acts may result in legal prosecution.",
"disclaimer_p3": "By using our Services, you are agreeing to allow Yottacode S.L. to use all the data you submit and kept in our servers for analytical and scientific purposes, yet maintaining the privacy of your data.",
"disclaimer_requested": "Conditions of use must be read and accepted", "disclaimer_requested": "Conditions of use must be read and accepted",
"double_click": "Double click", "double_click": "Double click",
"down": "Down", "down": "Down",
...@@ -146,6 +151,7 @@ ...@@ -146,6 +151,7 @@
"highlighted": "Highlighted", "highlighted": "Highlighted",
"hours": "hours", "hours": "hours",
"how_many": "How many?", "how_many": "How many?",
"import": "Import",
"inactive_account": "This account has not been activated. Please, follow the link sent to your email address.", "inactive_account": "This account has not been activated. Please, follow the link sent to your email address.",
"input_selection": "How to place a pictogram", "input_selection": "How to place a pictogram",
"instruction": "Instruction", "instruction": "Instruction",
......
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
"apply":"Aplicar", "apply":"Aplicar",
"annual": "Anual", "annual": "Anual",
"April": "Abril", "April": "Abril",
"arasaac_license": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao.",
"arasaac_license_import": "Los símbolos pictográficos utilizados en esta sección son propiedad de CATEDU (http://arasaac.org/) bajo licencia Creative Commons y han sido creados por Sergio Palao. Al importarlos acepta las ",
"arasaac_license_import2": "condiciones de uso",
"arasaac_license_link": "http://www.arasaac.org/condiciones_uso.php",
"attributes_not_updated": "Cambios no guardados", "attributes_not_updated": "Cambios no guardados",
"attributes_updated": "Cambios guardados", "attributes_updated": "Cambios guardados",
"attributes_updating": "Guardando...", "attributes_updating": "Guardando...",
...@@ -95,6 +99,7 @@ ...@@ -95,6 +99,7 @@
"disclaimer_accept": "He leído y acepto las <a href='/app/#/disclaimer' target='_blank'>condiciones de uso</a>", "disclaimer_accept": "He leído y acepto las <a href='/app/#/disclaimer' target='_blank'>condiciones de uso</a>",
"disclaimer_p1": "De conformidad con lo establecido en el Art. 5 de la Ley Orgánica 15/1999 de diciembre de Protección de Datos de Carácter Personal, por el que se regula el derecho de información en la recogida de datos le informamos que los datos de carácter personal que se recogen en este formulario online serán objeto de tratamiento en los ficheros responsabilidad de Yottacode S.L. La finalidad del tratamiento es la de gestionar de forma adecuada la prestación del servicio que nos ha requerido y con fines estadísticos e investigación, y estos datos no serán cedidos a terceros. Asimismo, le informamos de la posibilidad de ejercitar los correspondiente derechos de acceso, rectificación, cancelación y oposición de conformidad con lo establecido en la Ley 15/1999 mediante un escrito a Yottacode S.L. Calle Virgen de la Cabeza 2, 23008, Jaén, incluyendo la fotocopia del DNI del solicitante.", "disclaimer_p1": "De conformidad con lo establecido en el Art. 5 de la Ley Orgánica 15/1999 de diciembre de Protección de Datos de Carácter Personal, por el que se regula el derecho de información en la recogida de datos le informamos que los datos de carácter personal que se recogen en este formulario online serán objeto de tratamiento en los ficheros responsabilidad de Yottacode S.L. La finalidad del tratamiento es la de gestionar de forma adecuada la prestación del servicio que nos ha requerido y con fines estadísticos e investigación, y estos datos no serán cedidos a terceros. Asimismo, le informamos de la posibilidad de ejercitar los correspondiente derechos de acceso, rectificación, cancelación y oposición de conformidad con lo establecido en la Ley 15/1999 mediante un escrito a Yottacode S.L. Calle Virgen de la Cabeza 2, 23008, Jaén, incluyendo la fotocopia del DNI del solicitante.",
"disclaimer_p2": "Yottacode S.L. no se hace responsable del uso indebido que de sus productos puedan hacerse, así como de los daños o perjuicidos que pudieran derivarse de los mismos. Los usuarios de la plataforma Pictogram pueden hacer uso libremente de sus funcionalidades, siempre dentro de los límites de acceso establecidos. Un uso inadecuado o que persiga fines maliciosos como el acceso a funciones no autorizadas o la aplicación de técnicas que persigan la ruptura de la seguridad de nuestros sistemas será perseguido legalmente.", "disclaimer_p2": "Yottacode S.L. no se hace responsable del uso indebido que de sus productos puedan hacerse, así como de los daños o perjuicidos que pudieran derivarse de los mismos. Los usuarios de la plataforma Pictogram pueden hacer uso libremente de sus funcionalidades, siempre dentro de los límites de acceso establecidos. Un uso inadecuado o que persiga fines maliciosos como el acceso a funciones no autorizadas o la aplicación de técnicas que persigan la ruptura de la seguridad de nuestros sistemas será perseguido legalmente.",
"disclaimer_p3": "Al usar nuestros servicios, acepta permitir a Yottacode S.L. el uso de sus datos con fines estadísticos y científicos, asegurando no obstante la privacidad de sus datos en todo momento.",
"disclaimer_requested": "Las condiciones de uso deben ser leídas y aceptadas", "disclaimer_requested": "Las condiciones de uso deben ser leídas y aceptadas",
"double_click": "Doble clic", "double_click": "Doble clic",
"down": "Abajo", "down": "Abajo",
...@@ -146,6 +151,7 @@ ...@@ -146,6 +151,7 @@
"highlighted": "Resaltado", "highlighted": "Resaltado",
"hours": "horas", "hours": "horas",
"how_many": "¿Cuántas?", "how_many": "¿Cuántas?",
"import": "Importar",
"inactive_account": "Esta cuenta no ha sido activada. Por favor, siga el enlace de confirmación enviado a su dirección de correo electrónico.", "inactive_account": "Esta cuenta no ha sido activada. Por favor, siga el enlace de confirmación enviado a su dirección de correo electrónico.",
"input_selection": "Cómo colocar un pictograma", "input_selection": "Cómo colocar un pictograma",
"instruction": "Instrucción", "instruction": "Instrucción",
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<h2 translate>disclaimer</h2> <h2 translate>disclaimer</h2>
<p translate>disclaimer_p1</p> <p translate>disclaimer_p1</p>
<p translate>disclaimer_p2</p> <p translate>disclaimer_p2</p>
<p translate>disclaimer_p3</p>
</div> </div>
</div> </div>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<span class="glyphicon glyphicon-th"></span> SymbolStix <span class="glyphicon glyphicon-th"></span> SymbolStix
</button> </button>
<button class="btn btn-default" btn-radio="'arasaac'" ng-model="source" ng-click="load_arasaac_pictos()"> <button class="btn btn-default" btn-radio="'arasaac'" ng-model="source" ng-click="load_arasaac_pictos()">
<i class="fa fa-th" aria-hidden="true"></i> Arasaac <i class="fa fa-th" aria-hidden="true"></i> ARASAAC
</button> </button>
<button class="btn btn-default" btn-radio="'ownpictos'" ng-model="source" ng-click="load_own_pictos()"> <button class="btn btn-default" btn-radio="'ownpictos'" ng-model="source" ng-click="load_own_pictos()">
<span class="glyphicon glyphicon-picture"></span> {{ 'own_pictos' | translate }} <span class="glyphicon glyphicon-picture"></span> {{ 'own_pictos' | translate }}
...@@ -76,11 +76,15 @@ ...@@ -76,11 +76,15 @@
<!-- Collections row --> <!-- Collections row -->
<div class="row"> <div class="row">
<div id="arasaac_agreement" class="col-md-12" ng-show="showArasaacLicense && source == 'arasaac'"> <div id="arasaac_agreement" class="col-md-12" ng-show="showArasaacLicense && source == 'arasaac'">
<h2><small> <div class="panel panel-warning">
Los símbolos pictográficos utilizados en esta sección son propiedad de <b>CATEDU</b> (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao. <div class="panel-heading">
<br>Para usarlos deberá aceptar la licencia de uso haciendo clic sobre el botón importar.</small> <h3 class="panel-title">ARASAAC</h3>
</h2> </div>
<button class="btn btn-primary" ng-click="accept_arasaac()">Importar</button> <div class="panel-body">
<p>{{'arasaac_license_import' | translate}} <a href="{{ 'arasaac_license_link' | translate }}">{{ 'arasaac_license_import2' | translate }}</a>.</p>
<button class="btn btn-primary" ng-click="accept_arasaac()">{{'import' | translate}}</button>
</div>
</div>
</div> </div>
<!-- Collections --> <!-- Collections -->
...@@ -115,8 +119,8 @@ ...@@ -115,8 +119,8 @@
</div><!-- /modal-body --> </div><!-- /modal-body -->
<div class="modal-footer"> <div class="modal-footer">
<div id="arasaac_license" ng-show="source == 'arasaac'"> <div class="arasaac_license" ng-show="source == 'arasaac'">
<p class="small">Los símbolos pictográficos utilizados son propiedad de CATEDU (<a href="http://arasaac.org/">Arasaac</a>) bajo licencia Creative Commons y han sido creados por Sergio Palao</p> <p><small>{{'arasaac_license' | translate}}</small></p>
</div> </div>
<button class="btn btn-success pull-left" ng-show="source == 'ownpictos'" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()"> <button class="btn btn-success pull-left" ng-show="source == 'ownpictos'" ngf-select ng-model="picFile" accept="image/*" ngf-change="addOwnPicto()">
<i class="fa fa-folder-open" aria-hidden="true"></i> {{ 'new_img' | translate }} <i class="fa fa-folder-open" aria-hidden="true"></i> {{ 'new_img' | translate }}
......
...@@ -12,6 +12,15 @@ dashboardControllers.controller('TranslateController', function( ...@@ -12,6 +12,15 @@ dashboardControllers.controller('TranslateController', function(
ngToast, ngToast,
vcRecaptchaService vcRecaptchaService
) { ) {
// onload, set lang accordingly to stored user settings
if ($window.sessionStorage.user) {
//Session variables update
var obj = JSON.parse($window.sessionStorage.user);
$translate.use(obj.lang);
}
// Changes the language when user click on footer lang
$scope.changeLanguage = function (langKey) { $scope.changeLanguage = function (langKey) {
//Translate update //Translate update
...@@ -41,7 +50,11 @@ dashboardControllers.controller('TranslateController', function( ...@@ -41,7 +50,11 @@ dashboardControllers.controller('TranslateController', function(
} }
// Reload captcha according to language (only once instance per page, so id is always 0) // Reload captcha according to language (only once instance per page, so id is always 0)
vcRecaptchaService.useLang(0, langKey.substr(0,2)); //TODO: REVISAR reCaptcha Widget ID not exists try {
vcRecaptchaService.useLang(0, langKey.substr(0,2));
} catch (err) {}
// Reload page
$window.location.reload();
}; };
}); });
...@@ -1023,6 +1023,10 @@ form .progress { ...@@ -1023,6 +1023,10 @@ form .progress {
.method-opt{ .method-opt{
font-weight: 600; font-weight: 600;
} }
.arasaac_license{
text-align: left;
color: #6c6c6c;
}
.header-image { .header-image {
width: 100%; width: 100%;
......
...@@ -8,6 +8,12 @@ module.exports = function (grunt) { ...@@ -8,6 +8,12 @@ module.exports = function (grunt) {
src: ['modules/**/*.html'], src: ['modules/**/*.html'],
dest: 'assets/app/', dest: 'assets/app/',
filter: 'isFile' filter: 'isFile'
},
{
cwd: 'assets/app/bower_components/bootstrap/dist/css/',
src: 'bootstrap.css.map',
dest: 'assets/app/css',
expand: true
} }
] ]
}, },
......
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