Commit 8a03979f by Arturo Montejo Ráez

Merge branch 'develop'

parents e1bd1eff aa9d9dae
Showing with 538 additions and 189 deletions
......@@ -5,14 +5,9 @@ import android.util.Log;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
/**
* User actions regarding a pictogram that happens when the user is online --> they are sent to the server by websockets (Room class)
* It is required, inter alia, to support session state diagram such
......
package com.yottacode.pictogram.action;
import android.util.Log;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
import org.json.JSONObject;
/**
* User actions regarding a pictogram that happens when the user is online --> they are sent to the server by websockets (Room class)
......@@ -33,4 +27,5 @@ public class TalkAction extends PictoAction {
public String get_action() {return ACTION;}
}
\ No newline at end of file
}
......@@ -2,32 +2,28 @@ package com.yottacode.pictogram.dao;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.AssetManager;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.AsyncTask;
import android.util.Log;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.tools.Img;
import org.json.JSONException;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Vector;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.tools.Img;
import org.json.JSONException;
/**
* Data Access Object to manage Pictogram Communicator Board database regarding App information that is not user-dependent
* This class requires:
......@@ -173,7 +169,7 @@ public class Device extends SQLiteOpenHelper {
* @return sup_id selected or 0.
*/
public int getLastSupId() {
return Integer.parseInt(getParamValue(PARAMS.sup_id));
return getParamValue(PARAMS.sup_id)==null ? 0 : Integer.parseInt(getParamValue(PARAMS.sup_id));
}
/**
......
......@@ -34,7 +34,7 @@ public class Picto extends Img {
public static String COLOR = "color";
public static String PCB_STATUS_MODIFICATION="pcb_status_modification";
public static String EXPRESSION = "expression";
public static String MIRROR = "mirror";
}
public final static class JSON_ATTTR_STATUS_VALUES {
......@@ -49,6 +49,11 @@ public class Picto extends Img {
private JSONObject attributes;
private String translation;
private boolean is_mirror=false;
public boolean is_mirror() {return is_mirror;}
public void set_mirror(boolean is_mirror) {
this.is_mirror=is_mirror;}
public Picto(int id, String url, String translation, int cat, int row, int column, int freeRow, int freeColumn) throws JSONException {
this(id, url, translation, new JSONObject()
......@@ -113,7 +118,15 @@ public class Picto extends Img {
* @return a JSON attributes of the picto
*/
public String get_json_attrs() {
return this.attributes.toString();
try {
if(PCBcontext.getPcbdb().getCurrentUser().is_mirror_on())
this.attributes.put(JSON_ATTTRS.MIRROR,true);
else
this.attributes.remove(JSON_ATTTRS.MIRROR);
} catch (JSONException e) {
e.printStackTrace();
}
return this.attributes.toString();
}
/**
......@@ -269,50 +282,6 @@ public class Picto extends Img {
}
}
/**
*
* @return the lighter color of the picto
*/
public int get_lighter_color() {
final int LIGHT=0x22;
int color = this.get_color();
int red = Color.red(color)+LIGHT, blue = Color.blue(color)+LIGHT, green = Color.green(color)+LIGHT;
return Color.rgb(red, green, blue);
}
/**
*
* @return the darkner color of the picto
*/
public int get_darkner_color() {
/*
final int DARK=-0x22;
int color = this.get_color();
int red = Color.red(color)+DARK, blue = Color.blue(color)+DARK, green = Color.green(color)+DARK;
return Color.rgb(red,green,blue);
*/
/*
String hexColor = String.format("#%06X", (0xFFFFFF & this.get_color()));
String hexColorDarker = String.format("#%06X", (0xFFFFFF & darker(this.get_color(), (float)0.9)));
Log.d(LOG_TAG, "Color actual: " + hexColor);
Log.d(LOG_TAG, "Color darker: " + hexColorDarker);
*/
return darker(this.get_color(), (float) 0.9);
}
public static int darker (int color, float factor) {
int a = Color.alpha(color);
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
return Color.argb(a,
Math.max((int) (r * factor), 0),
Math.max((int) (g * factor), 0),
Math.max((int) (b * factor), 0));
}
/**
......
......@@ -37,7 +37,7 @@ public class User {
private JSONObject attributes_stu;
private Img img_sup;
private String email_sup, pwd_sup, name_sup, surname_sup, gender_sup, lang_sup, tts_engine_sup;
private int max_columns,max_rows;
private boolean mirror_mode=false;
public User(int id_stu, String nickname_stu, String pwd_stu, String name_stu, String surname_stu, String url_img_stu, String gender_stu, String lang_stu, String attributes_stu) throws JSONException {
......@@ -66,7 +66,11 @@ public class User {
}
public boolean alter_mirror_mode() {
mirror_mode=!mirror_mode;
return mirror_mode;
}
public boolean is_mirror_on() { return mirror_mode;}
/**
*
......
package com.yottacode.pictogram.grammar;
import android.util.Log;
import com.github.nkzawa.emitter.Emitter;
import com.yottacode.pictogram.action.Room;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.tools.PCBcontext;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Websocket Vocabulary Room based on Room
* @author Fernando Martinez Santiago
* @version 1.0
*/
public class ActionTalk implements Emitter.Listener {
private static final String URL ="action";
private Room room;
iActionListener listeners[];
public ActionTalk(Room room, iActionListener listeners[]) {
this.room = room;
this.room.listen(URL, this);
this.listeners=listeners;
}
@Override
public void call(Object... args) {
final String param_action="action";
final String param_attributes="attributes";
final String param_picto="picto";
final String param_stu_picto="stu_picto";
final String param_picto_id="id";
final String param_picto_cat="id_cat";
final String action_select="select";
final String action_add="add";
JSONObject msg = (JSONObject) args[0];
try {
Log.i(this.getClass().getName(), "raw Received message " +msg.toString());
String action = msg.getString(param_action).toLowerCase();
if (action.equals(action_add) || action.equals(action_select)) {
JSONObject stu_picto = msg.getJSONObject(param_attributes).getJSONObject(param_stu_picto);
JSONObject attrs_stu_picto = stu_picto.optJSONObject(param_attributes);
JSONObject picto_stupicto = stu_picto.optJSONObject(param_picto);
int picto_id = picto_stupicto.getInt(param_picto_id);
int picto_cat = attrs_stu_picto != null ? attrs_stu_picto.optInt(param_picto_cat, Picto.NO_CATEGORY) : 0;
if (PCBcontext.getPcbdb().getCurrentUser().is_mirror_on() || attrs_stu_picto.has(Picto.JSON_ATTTRS.MIRROR)) {
Log.i(this.getClass().getName(), "Received message '" + action +
"' for picto " + picto_id + " (cat " + picto_cat + ", picto: " + picto_stupicto);
for (iActionListener listener : this.listeners)
listener.action(action.equals(action_add) ? iActionListener.action.add : iActionListener.action.select, picto_cat, picto_id);
}
}
} catch (JSONException e) {
Log.e(this.getClass().getCanonicalName(), e.getClass().getCanonicalName() + "--" + e);
}
}
}
......@@ -3,16 +3,15 @@ package com.yottacode.pictogram.grammar;
import android.os.AsyncTask;
import android.util.Log;
import com.yottacode.net.iRestapiListener;
import com.yottacode.pictogram.R;
import com.yottacode.pictogram.action.Room;
import com.yottacode.pictogram.action.VocabularyAction;
import com.yottacode.pictogram.dao.PCBDBHelper;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.net.PictoUploader;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.net.iRestapiListener;
import com.yottacode.pictogram.action.Room;
import com.yottacode.pictogram.net.iImgDownloaderListener;
import com.yottacode.pictogram.tools.Img;
import com.yottacode.pictogram.tools.PCBcontext;
import com.yottacode.tools.GUITools;
......@@ -38,7 +37,6 @@ public class Vocabulary implements Iterable<Picto> {
Hashtable<Integer,LinkedList<Picto>> pictos;
static int DEFAULT_VOCABULARY_SIZE=200;
VocabularyTalk talk;
iImgDownloaderListener imgListener;
......@@ -62,7 +60,7 @@ public class Vocabulary implements Iterable<Picto> {
}
}
public void listen(Room room, iVocabularyListener listener) {
public void listen(Room room, iVocabularyListener listener, iActionListener action_listener) {
iVocabularyListener listeners[] = {new iVocabularyListener() {
@Override
public void change(action action, int picto_cat, int picto_id, JSONObject args) {
......@@ -100,7 +98,8 @@ public class Vocabulary implements Iterable<Picto> {
}
}
},listener};
talk = new VocabularyTalk(room, listeners);
new VocabularyTalk(room, listeners);
new ActionTalk(room, new iActionListener[] {action_listener});
}
/**
......@@ -274,6 +273,14 @@ public class Vocabulary implements Iterable<Picto> {
if (pictos_cat.get(i).get_id()==pic_id) index=i;
return index;
}
public Picto get_picto(int pic_cat, int pic_id) {
Picto picto=null;
LinkedList<Picto> pictos_cat=this.pictos.get(pic_cat);
for (int i=0; i<pictos_cat.size() && picto==null; i++)
if (pictos_cat.get(i).get_id()==pic_id) picto=pictos_cat.get(i);
return picto;
}
/**
* It removes de given pic from the user collection
* @param pic_id
......
......@@ -3,14 +3,12 @@ package com.yottacode.pictogram.grammar;
import android.util.Log;
import com.github.nkzawa.emitter.Emitter;
import com.yottacode.pictogram.action.Room;
import com.yottacode.pictogram.dao.Picto;
import org.json.JSONException;
import org.json.JSONObject;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.action.Room;
import com.yottacode.pictogram.tools.PCBcontext;
/**
* Websocket Vocabulary Room based on Room
* @author Fernando Martinez Santiago
......@@ -26,7 +24,7 @@ public class VocabularyTalk implements Emitter.Listener {
public VocabularyTalk(Room room, iVocabularyListener listeners[]) {
this.room = room;
this.room.listen(URL, this);
this.listeners=listeners;
this.listeners=listeners;
}
@Override
......@@ -42,7 +40,6 @@ public class VocabularyTalk implements Emitter.Listener {
final String action_delete="delete";
JSONObject msg = (JSONObject) args[0];
try {
Log.i(this.getClass().getName(), "raw Received message " +msg.toString());
String action = msg.getString(param_action).toLowerCase();
......
package com.yottacode.pictogram.grammar;
/**
* Vocabulary Listener
* @author Fernando Martinez Santiago
* @version 1.0
*/
public interface iActionListener {
public enum action {add,select}
public void action(iActionListener.action action, int picto_cat, int picto_id);
}
......@@ -4,9 +4,11 @@ package com.yottacode.pictogram.tools;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.util.Log;
import com.yottacode.tools.BitmapTools;
import com.yottacode.tools.FileTools;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
......@@ -15,9 +17,6 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import com.yottacode.tools.FileTools;
import com.yottacode.tools.BitmapTools;
/**
* Img
* @author Fernando
......
......@@ -60,7 +60,7 @@ public final class PCBcontext {
throw new java.lang.AssertionError("init must be called once previously ");
}
Log.e(PCBcontext.class.getCanonicalName(), "User set at student " + student.get_name_stu());
Log.i(PCBcontext.class.getCanonicalName(), "User set at student " + student.get_name_stu());
wrapper.setToken(token);
pcbdb = new PCBDBHelper(null, 1, student);
pcbdb.user_online(token!=null);
......
package com.yottacode.tools;
import android.graphics.Bitmap;
import android.graphics.BlurMaskFilter;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.PorterDuff;
/**
* Created by Fernando on 15/03/2016.
......@@ -58,4 +63,77 @@ public class BitmapTools {
return this;
}
/**
*
* @return the lighter color of the picto
*/
public static int get_lighter_color(int color) {
final int LIGHT=0x22;
int red = Color.red(color)+LIGHT, blue = Color.blue(color)+LIGHT, green = Color.green(color)+LIGHT;
return Color.rgb(red, green, blue);
}
/**
*
* @return the darkner color of the picto
*/
public static int get_darkner_color(int color) {
/*
final int DARK=-0x22;
int color = this.get_color();
int red = Color.red(color)+DARK, blue = Color.blue(color)+DARK, green = Color.green(color)+DARK;
return Color.rgb(red,green,blue);
*/
/*
String hexColor = String.format("#%06X", (0xFFFFFF & this.get_color()));
String hexColorDarker = String.format("#%06X", (0xFFFFFF & darker(this.get_color(), (float)0.9)));
Log.d(LOG_TAG, "Color actual: " + hexColor);
Log.d(LOG_TAG, "Color darker: " + hexColorDarker);
*/
return darker(color, (float) 0.9);
}
public static int darker (int color, float factor) {
int a = Color.alpha(color);
int r = Color.red(color);
int g = Color.green(color);
int b = Color.blue(color);
return Color.argb(a,
Math.max((int) (r * factor), 0),
Math.max((int) (g * factor), 0),
Math.max((int) (b * factor), 0));
}
public Bitmap highlightImage() {
Bitmap src=this.bitmap;
// create new bitmap, which will be painted and becomes result image
Bitmap bmOut = Bitmap.createBitmap(src.getWidth() + 96, src.getHeight() + 96, Bitmap.Config.ARGB_8888);
// setup canvas for painting
Canvas canvas = new Canvas(bmOut);
// setup default color
canvas.drawColor(0, PorterDuff.Mode.CLEAR);
// create a blur paint for capturing alpha
Paint ptBlur = new Paint();
ptBlur.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.NORMAL));
int[] offsetXY = new int[2];
// capture alpha into a bitmap
Bitmap bmAlpha = src.extractAlpha(ptBlur, offsetXY);
// create a color paint
Paint ptAlphaColor = new Paint();
ptAlphaColor.setColor(0xFFFFFFFF);
// paint color for captured alpha region (bitmap)
canvas.drawBitmap(bmAlpha, offsetXY[0], offsetXY[1], ptAlphaColor);
// free memory
bmAlpha.recycle();
// paint the image source
canvas.drawBitmap(src, 0, 0, null);
// return out final image
return bmOut;
}
}
......@@ -59,4 +59,8 @@
<!--online/offline status-->
<string name="pictogram_offline">Pictogram offline</string>
<string name="pictogram_online">Pictogram online</string>
<!--mirror mode-->
<string name="mirror_mode_off">Mirror mode off</string>
<string name="mirror_mode_on">Mirror mode on</string>
</resources>
......@@ -59,5 +59,10 @@
<!--online/offline status-->
<string name="pictogram_offline">Pictogram offline</string>
<string name="pictogram_online">Pictogram online</string>
<!--mirror mode-->
<string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</string>
</resources>
......@@ -75,4 +75,8 @@
<!--online/offline status-->
<string name="pictogram_offline">Compruebe si tiene conexión a Internet. </string>
<string name="pictogram_online">Conexión con el servidor establecida. </string>
<!--mirror mode-->
<string name="mirror_mode_off">Modo espejo desactivado</string>
<string name="mirror_mode_on">Modo espejo activado</string>
</resources>
......@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/CIFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/CIFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/CIFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/assets" type="java-test-resource" />
......@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestCIFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testCIFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
......@@ -106,14 +106,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
......@@ -122,9 +114,16 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
......
package com.yottacode.pictogram.tabletlibrary.gui;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
......@@ -20,6 +21,7 @@ import java.io.IOException;
public class PictoItemViewGenerator {
public static final int LAYOUT = R.layout.picto_grid_item;
public static final int LAYOUT_BIG = R.layout.picto_grid_item_big;
public static int mirror_color=0;
public static View getPictoView(Picto picto, View convertView, ViewGroup parent) {
if (convertView == null) {
......@@ -28,7 +30,7 @@ public class PictoItemViewGenerator {
RelativeLayout layoutWrapper ;
FrameLayout layout ;
ImageView pictoImage ;
final ImageView pictoImage ;
ImageView redCrossImage ;
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
......@@ -83,6 +85,16 @@ public class PictoItemViewGenerator {
if (picto.is_category()) {
layout.setBackgroundColor(picto.get_color());
}
if (picto.is_mirror()) {
int color[]={Color.WHITE,Color.LTGRAY,Color.GRAY,Color.DKGRAY,Color.BLACK,Color.DKGRAY,Color.GRAY,Color.LTGRAY,Color.WHITE};
float scale[]={1f,1.1f,1.2f,1.3f,1.4f,1.6f,1.3f,1.2f,1.1f};
mirror_color++;
pictoImage.setScaleX(scale[mirror_color%scale.length]);
pictoImage.setScaleY(scale[mirror_color%scale.length]);
// layout.setBackgroundColor(color[mirror_color%color.length]);
}
}
} catch (IOException e) {
e.printStackTrace();
......
......@@ -36,6 +36,7 @@ import com.yottacode.pictogram.action.TalkAction;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iActionListener;
import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.grammar.iVocabularyListener;
import com.yottacode.pictogram.net.PictoUploader;
......@@ -53,6 +54,9 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class PictogramActivity extends Activity implements iVocabularyListener, TextToSpeech.OnInitListener {
......@@ -94,7 +98,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
ImageButton showPictoCategoriesViewButton;
int maxColumns,maxRows,maxInTape;
ScheduledThreadPoolExecutor exec_mirror=null;
@Override
protected void onCreate(Bundle savedInstanceState) {
......@@ -123,7 +127,37 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
}
this.vocabulary = PCBcontext.getVocabulary();
this.vocabulary.listen(PCBcontext.getRoom(), this);
this.vocabulary.listen(PCBcontext.getRoom(), this, new iActionListener() {
Picto prev=null;
@Override
public void action(action action, int picto_cat, int picto_id) {
Log.i(this.getClass().getCanonicalName(),action+" from "+picto_cat+","+picto_id+" catched");
final Picto picto=vocabulary.get_picto(picto_cat,picto_id);
picto.set_mirror(true);
if (exec_mirror!=null) {
exec_mirror.shutdown();
exec_mirror=null;
prev.set_mirror(false);
}
exec_mirror = new ScheduledThreadPoolExecutor(1);
prev=picto;
ScheduledFuture s = exec_mirror.scheduleAtFixedRate(new Runnable() {
int repeating=0;
@Override
public void run() {
refresh();
if (repeating++==20) {
picto.set_mirror(false);
if (exec_mirror!=null) {
exec_mirror.shutdown();
exec_mirror = null;
}
}
}
},0,500, TimeUnit.MILLISECONDS);
}
}
);
this.vocabulary.setImgDownloaderListener(new iImgDownloaderListener() {
@Override
public void loadComplete() {
......@@ -164,16 +198,20 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
tts.setOnUtteranceProgressListener(new OnTTSEndListener());
this.tapeGridView.setOnDragListener(new OnPictoDragListener());
this.tapeGridView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
this.tapeGridView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.i(this.getClass().getCanonicalName()," Delete item "+position+"("+PictogramActivity.this.tapeAdapter.getItem(position).get_translation()+")");
PCBcontext.getActionLog().log(new TalkAction(TalkAction.DELETE, PictogramActivity.this.tapeAdapter.getItem(position)));
PictogramActivity.this.tapeAdapter.deleteItem(position);
PictogramActivity.this.tapeAdapter.notifyDataSetChanged();
return true;
}
});
Log.e(this.getClass().getCanonicalName(),this.tapeGridView.isClickable()+" "+this.tapeGridView.isLongClickable()+":"+this.tapeGridView.getOnItemLongClickListener());
this.pictoMainGridView.setOnDragListener(new OnPictoDragListener());
this.pictoCategoryGridView.setOnDragListener(new OnPictoDragListener());
......@@ -186,6 +224,18 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
final ImageButton deleteButton = (ImageButton) findViewById(R.id.button_delete);
final ImageButton ttsButton = (ImageButton) findViewById(R.id.button_tts);
ttsButton.setOnClickListener(new OnTTSButtonClickListener());
ttsButton.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
Log.i(this.getClass().getCanonicalName()," Changing mirror mode");
if (PCBcontext.getPcbdb().getCurrentUser().is_supervisor()) {
int res_id=PCBcontext.getPcbdb().getCurrentUser().alter_mirror_mode()==true ? R.string.mirror_mode_on : R.string.mirror_mode_off;
Toast.makeText(PictogramActivity.this,res_id,Toast.LENGTH_SHORT).show();
}
return true;
}
});
deleteButton.setOnClickListener(new OnDeleteButtonClickListener());
deleteButton.setOnLongClickListener(new OnDeleteButtonLongClickListener());
......@@ -594,7 +644,7 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Picto p = getCurrentPictoGridAdapter().getItem(position);
p.set_mirror(false);
if (p != null && !p.is_invisible() && p.is_enabled()) {
Log.d(LOG_TAG, "Clic en picto: " + p.toString());
//Log.d(LOG_TAG, "STATUS: " + p.get_status());
......@@ -941,4 +991,145 @@ public class PictogramActivity extends Activity implements iVocabularyListener,
return uri.getPath();
}
/*
Animator mCurrentAnimator=null;
private void zoomImageFromThumb(Picto picto, final View thumbView, int imageResId) {
// If there's an animation in progress, cancel it
// immediately and proceed with this one.
if (mCurrentAnimator != null) {
mCurrentAnimator.cancel();
}
this.pictoMainGridView.findViewById()
// Load the high-resolution "zoomed-in" image.
final ImageView expandedImageView = (ImageView) findViewById(
R.id.expanded_image);
expandedImageView.setImageResource(imageResId);
// Calculate the starting and ending bounds for the zoomed-in image.
// This step involves lots of math. Yay, math.
final Rect startBounds = new Rect();
final Rect finalBounds = new Rect();
final Point globalOffset = new Point();
// The start bounds are the global visible rectangle of the thumbnail,
// and the final bounds are the global visible rectangle of the container
// view. Also set the container view's offset as the origin for the
// bounds, since that's the origin for the positioning animation
// properties (X, Y).
thumbView.getGlobalVisibleRect(startBounds);
findViewById(R.id.container)
.getGlobalVisibleRect(finalBounds, globalOffset);
startBounds.offset(-globalOffset.x, -globalOffset.y);
finalBounds.offset(-globalOffset.x, -globalOffset.y);
// Adjust the start bounds to be the same aspect ratio as the final
// bounds using the "center crop" technique. This prevents undesirable
// stretching during the animation. Also calculate the start scaling
// factor (the end scaling factor is always 1.0).
float startScale;
if ((float) finalBounds.width() / finalBounds.height()
> (float) startBounds.width() / startBounds.height()) {
// Extend start bounds horizontally
startScale = (float) startBounds.height() / finalBounds.height();
float startWidth = startScale * finalBounds.width();
float deltaWidth = (startWidth - startBounds.width()) / 2;
startBounds.left -= deltaWidth;
startBounds.right += deltaWidth;
} else {
// Extend start bounds vertically
startScale = (float) startBounds.width() / finalBounds.width();
float startHeight = startScale * finalBounds.height();
float deltaHeight = (startHeight - startBounds.height()) / 2;
startBounds.top -= deltaHeight;
startBounds.bottom += deltaHeight;
}
// Hide the thumbnail and show the zoomed-in view. When the animation
// begins, it will position the zoomed-in view in the place of the
// thumbnail.
thumbView.setAlpha(0f);
expandedImageView.setVisibility(View.VISIBLE);
// Set the pivot point for SCALE_X and SCALE_Y transformations
// to the top-left corner of the zoomed-in view (the default
// is the center of the view).
expandedImageView.setPivotX(0f);
expandedImageView.setPivotY(0f);
// Construct and run the parallel animation of the four translation and
// scale properties (X, Y, SCALE_X, and SCALE_Y).
AnimatorSet set = new AnimatorSet();
set
.play(ObjectAnimator.ofFloat(expandedImageView, View.X,
startBounds.left, finalBounds.left))
.with(ObjectAnimator.ofFloat(expandedImageView, View.Y,
startBounds.top, finalBounds.top))
.with(ObjectAnimator.ofFloat(expandedImageView, View.SCALE_X,
startScale, 1f)).with(ObjectAnimator.ofFloat(expandedImageView,
View.SCALE_Y, startScale, 1f));
set.setDuration(mShortAnimationDuration);
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
mCurrentAnimator = null;
}
});
set.start();
mCurrentAnimator = set;
// Upon clicking the zoomed-in image, it should zoom back down
// to the original bounds and show the thumbnail instead of
// the expanded image.
final float startScaleFinal = startScale;
expandedImageView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (mCurrentAnimator != null) {
mCurrentAnimator.cancel();
}
// Animate the four positioning/sizing properties in parallel,
// back to their original values.
AnimatorSet set = new AnimatorSet();
set.play(ObjectAnimator
.ofFloat(expandedImageView, View.X, startBounds.left))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.Y,startBounds.top))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.SCALE_X, startScaleFinal))
.with(ObjectAnimator
.ofFloat(expandedImageView,
View.SCALE_Y, startScaleFinal));
set.setDuration(mShortAnimationDuration);
set.setInterpolator(new DecelerateInterpolator());
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
thumbView.setAlpha(1f);
expandedImageView.setVisibility(View.GONE);
mCurrentAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
thumbView.setAlpha(1f);
expandedImageView.setVisibility(View.GONE);
mCurrentAnimator = null;
}
});
set.start();
mCurrentAnimator = set;
}
});
}*/
}
......@@ -4,6 +4,7 @@ import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
......@@ -69,7 +70,7 @@ public class SerialActivity extends Activity {
// Escribo el último valor indicado de username
mSerialViewMail.setText(username);
Log.e(this.getClass().getCanonicalName(),"resetPrevUser:"+getIntent().getBooleanExtra("resetPrevUser", true));
if (!username.equals("") && !password.equals("") && !getIntent().getBooleanExtra("resetPrevUser", true)) new UserLogin().login(username, password,SerialActivity.this, PictogramActivity.class, LoginActivity.class);
Button mEntrarButton = (Button) findViewById(R.id.entrar_button);
......
......@@ -80,6 +80,7 @@ public class NetServiceTablet implements iNetServiceDevice {
serialActivity = new Intent(PCBcontext.getContext(), serialClass);
}
serialActivity.putExtra("resetPrevUser", true);
Log.e(this.getClass().getCanonicalName(),"resetPrevUser:"+serialActivity.getBooleanExtra("resetPrevUser", true));
PCBcontext.getContext().startActivity(serialActivity);
}
......
......@@ -34,6 +34,7 @@
android:accessibilityLiveRegion="none"
android:background="@android:color/holo_red_light"
android:clickable="true"
android:longClickable="true"
android:horizontalSpacing="@dimen/picto_grid_spacing">
</GridView>
......
......@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/DefaultFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/assets" type="java-test-resource" />
......@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestDefaultFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
......
......@@ -66,14 +66,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/PreFlavor/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/PreFlavor/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/PreFlavor/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/assets" type="java-test-resource" />
......@@ -82,6 +74,14 @@
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTestPreFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/testPreFlavor/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/res" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/debug/assets" type="java-resource" />
......@@ -106,14 +106,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/jni" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/rs" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/shaders" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/assets" type="java-test-resource" />
......@@ -122,7 +114,17 @@
<sourceFolder url="file://$MODULE_DIR$/src/test/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/res" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/resources" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/assets" type="java-test-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/aidl" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/jni" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/rs" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/androidTest/shaders" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/assets" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/builds" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/animated-vector-drawable/24.2.1/jars" />
......@@ -135,11 +137,22 @@
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-vector-drawable/24.2.1/jars" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-runtime-classes" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-safeguard" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental-verifier" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-resources" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/instant-run-support" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/reload-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/restart-dex" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/shaders" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
......
......@@ -68,6 +68,9 @@ module.exports = {
* free_category_coord_y: 0 .. 9 or null,
* status: '[invisible]/enabled/disabled',
* highlight: true/[false],
* legend: true/[false],
* legend_size: '[small]/large',
* expression: 'custom expression',
* color: any valid HEX color or [null]
* }
* @return {Object} Validated attributes that can be safetly stored.
......
......@@ -138,7 +138,7 @@ module.exports = {
* }
* legend: true/[false] Show or hide picto's name on the grid
* legend_size: "small/[normal]/large" How big the legend should be respect to the picto
* size: "[normal]/large"
* size: "small/[large]" How big pictos are: 'small' -> a grid of 5x10, 'large' -> a grid of 4x8
* picto_background: [#0000ff] Can be any valid HEX color. May be overriden by the
* category color
* tape_background: [#ff0000] Can be any valid HEX color
......@@ -170,7 +170,7 @@ module.exports = {
legend: false,
legend_size: 'normal',
pic: "defaultAvatar.jpg",
size: 'normal',
size: 'large',
picto_background: '#0000ff',
tape_background: '#00ffff',
};
......@@ -213,7 +213,7 @@ module.exports = {
if (!((/^(small|normal|large)$/).test(validAttributes.legend_size))) {
delete validAttributes.legend_size;
}
if (!((/^(normal|large)$/).test(validAttributes.size))) {
if (!((/^(small|large)$/).test(validAttributes.size))) {
delete validAttributes.size;
}
if (!((/^#([0-9a-f]{3}){1,2}$/i).test(validAttributes.picto_background))) {
......
......@@ -196,6 +196,7 @@
"picto_behavior": "Behavior of a pictogram when it is selected (without phrase tape)",
"picto_labels": "Pictogram labels",
"picto_removed": "Picto has been removed from vocabulary",
"picto_size": "Pictograms size",
"picto_style": "Pictogram style",
"picto_upload_error": "Error uploading picto",
"picto_upload_limit": "Image size is too large",
......
......@@ -196,6 +196,7 @@
"picto_behavior": "Comportamiento de un pictograma al seleccionarlo (sin cinta de frase)",
"picto_labels": "Etiquetas del pictograma",
"picto_removed": "El pictograma se ha eliminado del vocabulario",
"picto_size": "Tamaño pictogramas",
"picto_style": "Aspecto de los pictogramas",
"picto_upload_error": "Hubo un error al guardar el picto",
"picto_upload_limit": "El tamaño del picto es demasiado grande",
......@@ -251,7 +252,7 @@
"state_spontaneous": "Espontáneo",
"state_supervised": "Guiado",
"student_added": "Estudiante añadido",
"student_already_exists": "Ya existe un estudiante con ese nombre de usuario. Por favor, inténtelo de nuevo con algo diferente.",
"student_already_exists": "Ya existe un estudiante con ese nombre de usuario. Por favor, inténtelo de nuevo con algo diferente.",
"student_deleted": "Estudiante eliminado",
"student_not_added": "Estudiante no añadido",
"student_not_deleted": "No se ha podido eliminar el estudiante",
......
......@@ -25,7 +25,7 @@
ng-init="rowIndex = $index"
class="picto-grid__row">
<div
class="picto pull-left"
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
data-row="{{ rowIndex }}"
data-column="{{ colIndex }}"
id="student-picto-{{
......@@ -103,10 +103,12 @@
class="picto-grid picto-main-grid">
<div
ng-repeat="studentPictoRow in studentPictos[getCategoryId(emptyStudentPicto)]"
ng-init="rowIndex = $index"
class="picto-grid__row">
<div
class="picto pull-left"
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index"
popover="{{studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression}}"
popover-trigger="mouseenter">
<div class="picto-description"> {{ studentData.attributes.legend?studentPicto.expression.text:'' }} </div>
......@@ -157,7 +159,7 @@
ng-init="rowIndex = $index"
class="picto-grid__row">
<div
class="picto pull-left"
class="picto pull-left ng-class:{'picto-out': studentData.attributes.size == 'large' && (rowIndex > 3 || colIndex > 7)};"
data-row="{{ rowIndex }}"
data-column="{{ colIndex }}"
id="student-picto-{{
......@@ -167,8 +169,8 @@
draggable droppable drop="handleDrop"
popover="{{studentPicto.attributes.expression==null ? studentPicto.expression.text : studentPicto.attributes.expression}}"
popover-trigger="mouseenter"
ng-init="colIndex = $index"
ng-repeat="studentPicto in studentPictoRow track by $index">
ng-repeat="studentPicto in studentPictoRow track by $index"
ng-init="colIndex = $index">
<div class="picto-description"> {{ studentData.attributes.legend?studentPicto.expression.text:'' }} </div>
<img
src="/app/img/redcross.png"
......
......@@ -184,6 +184,34 @@
</span>
<label class="form-control" for="studentSetupUseCategories">{{ 'use_categories' | translate }}</label>
</div>
<legend>{{ 'picto_style' | translate }}</legend>
<div class="form-group">
<h4>{{ 'size' | translate }}</h4>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
value="normal"
id="studentSetupPictoSizeNormal"
ng-model="studentData.attributes.size"
ng-change="update_attributes()">
</span>
<label class="form-control" for="studentSetupPictoSizeNormal">
{{ 'small' | translate }}
</label>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
value="large"
id="studentSetupPictoSizeLarge"
ng-model="studentData.attributes.size"
ng-change="update_attributes()">
</span>
<label class="form-control" for="studentSetupPictoSizeLarge">
{{ 'large' | translate }}
</label>
</div>
</div>
</fieldset>
<!-- DISABLED, NOT IMPLEMENTED YET
<fieldset>
......@@ -275,46 +303,6 @@
</div>
</fieldset>
<fieldset>
<legend>{{ 'picto_style' | translate }}</legend>
<div class="form-group">
<h4>{{ 'size' | translate }}</h4>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
value="small"
id="studentSetupPictoSizeSmall"
ng-model="studentData.attributes.size"
ng-change="update_attributes()">
</span>
<label class="form-control" for="studentSetupPictoSizeSmall">
{{ 'small' | translate }}
</label>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
value="normal"
id="studentSetupPictoSizeNormal"
ng-model="studentData.attributes.size"
ng-change="update_attributes()">
</span>
<label class="form-control" for="studentSetupPictoSizeNormal">
{{ 'normal' | translate }}
</label>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="radio"
value="large"
id="studentSetupPictoSizeLarge"
ng-model="studentData.attributes.size"
ng-change="update_attributes()">
</span>
<label class="form-control" for="studentSetupPictoSizeLarge">
{{ 'large' | translate }}
</label>
</div>
</div>
<div class="input-group">
<span class="input-group-addon">
<input type="color"
......
......@@ -310,12 +310,16 @@ textarea.editable{
margin: 0.4%;
width: 80px;
height: 80px;
border: 1px solid #bbb;
border: 1px solid #555;
border-radius: 4px;
padding: 2px;
position: relative; /* Para posicionar después las opciones de forma absoluta dentro de este div */
cursor: pointer;
transition: all 0.2s ease;
transition: all 0.2s ease;
}
.picto-out { /* pictogram out of bounds */
border: 1px dotted #ccc;
}
......@@ -369,6 +373,7 @@ textarea.editable{
.picto_cat .panel-body{
padding: 0px;
margin: 0 auto;
}
.picto_cat .panel-body .picto_peq{
......
......@@ -59,6 +59,7 @@
margin-top: @spacingUnit * 2;
border-radius: @roundness;
transition: background-color ease 0.3s 0.25s;
width: 900px;
&__title {
margin-top: 0;
......
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