Commit 454429c3 by german callejas

Free Coords removed from Android Project

parent 586e388c
...@@ -55,8 +55,8 @@ public class Picto extends Img { ...@@ -55,8 +55,8 @@ public class Picto extends Img {
public static String CATEGORY = "id_cat"; public static String CATEGORY = "id_cat";
public static String COLUMN = "coord_x"; public static String COLUMN = "coord_x";
public static String ROW = "coord_y"; public static String ROW = "coord_y";
public static String FREE_COLUMN = "free_category_coord_x"; /*public static String FREE_COLUMN = "free_category_coord_x";
public static String FREE_ROW = "free_category_coord_y"; public static String FREE_ROW = "free_category_coord_y";*/
public static String MAGNIFY = "magnify"; public static String MAGNIFY = "magnify";
public static String HIGHLIGHT = "highlight"; public static String HIGHLIGHT = "highlight";
public static String STATUS = "status"; public static String STATUS = "status";
...@@ -105,13 +105,13 @@ public class Picto extends Img { ...@@ -105,13 +105,13 @@ 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, String user_avatar) throws JSONException { public Picto(int id, String url, String translation, int cat, int row, int column/*, int freeRow, int freeColumn*/, int stupicto_id, String user_avatar) throws JSONException {
this(id, url,stupicto_id, new JSONObject() this(id, url,stupicto_id, new JSONObject()
.put(JSON_ATTTRS.CATEGORY, cat) .put(JSON_ATTTRS.CATEGORY, cat)
.put(JSON_ATTTRS.COLUMN, column) .put(JSON_ATTTRS.COLUMN, column)
.put(JSON_ATTTRS.ROW, row) .put(JSON_ATTTRS.ROW, row)
.put(JSON_ATTTRS.FREE_ROW, freeRow) /*.put(JSON_ATTTRS.FREE_ROW, freeRow)
.put(JSON_ATTTRS.FREE_COLUMN, freeColumn) .put(JSON_ATTTRS.FREE_COLUMN, freeColumn)*/
.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)
...@@ -385,17 +385,17 @@ public class Picto extends Img { ...@@ -385,17 +385,17 @@ public class Picto extends Img {
* *
* @return the free row of the picto * @return the free row of the picto
*/ */
public int getFreeRow() { /*public int getFreeRow() {
return this.attributes.optInt(JSON_ATTTRS.FREE_ROW, -1); return this.attributes.optInt(JSON_ATTTRS.FREE_ROW, -1);
} }*/
/** /**
* *
* @return the free column of the picto * @return the free column of the picto
*/ */
public int getFreeColumn() { /*public int getFreeColumn() {
return this.attributes.optInt(JSON_ATTTRS.FREE_COLUMN, -1); return this.attributes.optInt(JSON_ATTTRS.FREE_COLUMN, -1);
} }*/
/** /**
* *
...@@ -464,9 +464,9 @@ public class Picto extends Img { ...@@ -464,9 +464,9 @@ public class Picto extends Img {
*/ */
public boolean is_category() { public boolean is_category() {
return this.get_category()==Picto.NO_CATEGORY && return this.get_category()==Picto.NO_CATEGORY &&
this.get_row() != Picto.COL_UNCATEGORIZED_CONCEPTS && this.get_row() != Picto.COL_UNCATEGORIZED_CONCEPTS; /*&&
this.getFreeColumn() == -1 && this.getFreeColumn() == -1 &&
this.getFreeRow() == -1; this.getFreeRow() == -1;*/
} }
/** /**
......
...@@ -96,9 +96,9 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -96,9 +96,9 @@ public class Vocabulary implements Iterable<Picto> {
JSONObject attrs_picto = args.getJSONObject("attributes"); JSONObject attrs_picto = args.getJSONObject("attributes");
attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id")); attrs_picto.put(Picto.JSON_ATTTRS.STUPICTO_ID,args.getInt("id"));
Picto newPicto=new Picto(picto_id, uri,args.getInt("id"), attrs_picto); Picto newPicto=new Picto(picto_id, uri,args.getInt("id"), attrs_picto);
Picto prev_picto=PCBcontext.getVocabulary().has_categories() Picto prev_picto=/*PCBcontext.getVocabulary().has_categories()
? find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column()) ? */find_picto(newPicto.get_category(), newPicto.get_row(),newPicto.get_column());/*
: find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn()); : find_picto(newPicto.getFreeRow(),newPicto.getFreeColumn());*/
if (prev_picto!=null) { if (prev_picto!=null) {
Log.i(LOG_TAG, "Pictogram "+prev_picto.get_translation()+":"+prev_picto.get_ImgId()+" to be replaced by "+newPicto.get_translation()+":"+newPicto.get_ImgId()); Log.i(LOG_TAG, "Pictogram "+prev_picto.get_translation()+":"+prev_picto.get_ImgId()+" to be replaced by "+newPicto.get_translation()+":"+newPicto.get_ImgId());
...@@ -334,7 +334,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -334,7 +334,7 @@ public class Vocabulary implements Iterable<Picto> {
LinkedList<Picto> pictos_cat=this.pictos.get(Picto.NO_CATEGORY); LinkedList<Picto> pictos_cat=this.pictos.get(Picto.NO_CATEGORY);
Picto picto=null; Picto picto=null;
for (int i=0; i<pictos_cat.size() && picto==null; i++) for (int i=0; i<pictos_cat.size() && picto==null; i++)
if (pictos_cat.get(i).getFreeColumn()==column && pictos_cat.get(i).getFreeRow()==row) picto=pictos_cat.get(i); if (pictos_cat.get(i).get_column()==column && pictos_cat.get(i).get_row()==row) picto=pictos_cat.get(i);
return picto; return picto;
} }
...@@ -422,7 +422,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -422,7 +422,7 @@ public class Vocabulary implements Iterable<Picto> {
startpictos = new LinkedList<>(); startpictos = new LinkedList<>();
LinkedList<Picto> category=pictos.get(new Integer(Picto.NO_CATEGORY)); LinkedList<Picto> category=pictos.get(new Integer(Picto.NO_CATEGORY));
for (Picto picto: category) { for (Picto picto: category) {
if (picto.getFreeRow() != -1 && picto.getFreeColumn() != -1) { if (picto.get_row() != -1 && picto.get_column() != -1) {
startpictos.add(picto); startpictos.add(picto);
} }
} }
...@@ -464,13 +464,13 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -464,13 +464,13 @@ 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,String user_avatar, String path_sound,final iLocalPicto listener) { public void saveLocalPicto(String url, String exp, int cat, int coord_x, int coord_y,String user_avatar, String path_sound,final iLocalPicto listener) {
final Picto picto; final Picto picto;
int id=PCBcontext.getDevice().getNextLocalPictoID(); int id=PCBcontext.getDevice().getNextLocalPictoID();
try { try {
picto = new Picto(id, url, exp, cat, coord_x, coord_y, free_category_coord_x, free_category_coord_y, Picto.STUPICTO_NULL, user_avatar); picto = new Picto(id, url, exp, cat, coord_x, coord_y, Picto.STUPICTO_NULL, user_avatar);
Picto prev_picto=PCBcontext.getVocabulary().has_categories() ? find_picto(cat, coord_x,coord_y) : find_picto(free_category_coord_x,free_category_coord_y); Picto prev_picto=/*PCBcontext.getVocabulary().has_categories() ? */find_picto(cat, coord_x,coord_y);/* : find_picto(free_category_coord_x,free_category_coord_y);*/
if (prev_picto!=null) { //El picto ya existe if (prev_picto!=null) { //El picto ya existe
picto.set_local_update(true); //actualizamos el picto local actual picto.set_local_update(true); //actualizamos el picto local actual
picto.set_stupicto_id(prev_picto.get_stupicto_id()); picto.set_stupicto_id(prev_picto.get_stupicto_id());
......
...@@ -152,14 +152,14 @@ public class PictoUploader { ...@@ -152,14 +152,14 @@ public class PictoUploader {
JSONObject json_attrs =new JSONObject().put("status",picto.get_status()); JSONObject json_attrs =new JSONObject().put("status",picto.get_status());
if (picto.get_user_avatar()!=null) json_attrs.put(Picto.JSON_ATTTRS.USER_AVATAR,picto.get_user_avatar()); if (picto.get_user_avatar()!=null) json_attrs.put(Picto.JSON_ATTTRS.USER_AVATAR,picto.get_user_avatar());
if (PCBcontext.getVocabulary().has_categories()) /*if (PCBcontext.getVocabulary().has_categories())*/
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.get_category()) json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.get_category())
.put(Picto.JSON_ATTTRS.COLUMN, picto.get_column()) .put(Picto.JSON_ATTTRS.COLUMN, picto.get_column())
.put(Picto.JSON_ATTTRS.ROW, picto.get_row()); .put(Picto.JSON_ATTTRS.ROW, picto.get_row());
else /*else
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.NO_CATEGORY) json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.NO_CATEGORY)
.put(Picto.JSON_ATTTRS.FREE_COLUMN, picto.getFreeColumn()) .put(Picto.JSON_ATTTRS.FREE_COLUMN, picto.getFreeColumn())
.put(Picto.JSON_ATTTRS.FREE_ROW, picto.getFreeRow()); .put(Picto.JSON_ATTTRS.FREE_ROW, picto.getFreeRow());*/
params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",PCBcontext.getPcbdb().getCurrentUser().get_active_scene()).toString()); params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",PCBcontext.getPcbdb().getCurrentUser().get_active_scene()).toString());
} catch (JSONException e) { } catch (JSONException e) {
......
...@@ -82,14 +82,14 @@ public class PictoMenu { ...@@ -82,14 +82,14 @@ public class PictoMenu {
public void addPicto(int row, int col, int cat, int source) { public void addPicto(int row, int col, int cat, int source) {
//Enviar al voca los datos necesarios para crear el picto despues //Enviar al voca los datos necesarios para crear el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) { /*if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*--PCBcontext.getVocabulary().has_categories()) {*/
activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); activity.getIntent().putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
activity.getIntent().putExtra(Picto.JSON_ATTTRS.ROW, row); activity.getIntent().putExtra(Picto.JSON_ATTTRS.ROW, row);
activity.getIntent().putExtra(Picto.JSON_ATTTRS.COLUMN, col); activity.getIntent().putExtra(Picto.JSON_ATTTRS.COLUMN, col);
} else { /* } else {
activity.getIntent().putExtra(Picto.JSON_ATTTRS.FREE_ROW, row); activity.getIntent().putExtra(Picto.JSON_ATTTRS.FREE_ROW, row);
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);
...@@ -103,20 +103,20 @@ public class PictoMenu { ...@@ -103,20 +103,20 @@ public class PictoMenu {
} }
public void setPicto(int row, int col, int free_row, int free_col, int cat, Bitmap bitmap, int id_picto){ public void setPicto(int row, int col/*, int free_row, int free_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(ID_PICTO_IMAGE,id_picto);
//Enviar al voca los datos necesarios para editar el picto despues //Enviar al voca los datos necesarios para editar el picto despues
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) { /*if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*--PCBcontext.getVocabulary().has_categories()) {*/
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat); intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, cat);
intent.putExtra(Picto.JSON_ATTTRS.ROW, row); intent.putExtra(Picto.JSON_ATTTRS.ROW, row);
intent.putExtra(Picto.JSON_ATTTRS.COLUMN, col); intent.putExtra(Picto.JSON_ATTTRS.COLUMN, col);
} else { /*} else {
intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, Picto.NO_CATEGORY); intent.putExtra(Picto.JSON_ATTTRS.CATEGORY, Picto.NO_CATEGORY);
intent.putExtra(Picto.JSON_ATTTRS.FREE_ROW, free_row); intent.putExtra(Picto.JSON_ATTTRS.FREE_ROW, free_row);
intent.putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, free_col); intent.putExtra(Picto.JSON_ATTTRS.FREE_COLUMN, free_col);
} }*/
/*ByteArrayOutputStream stream = new ByteArrayOutputStream(); /*ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
...@@ -282,7 +282,7 @@ public class PictoMenu { ...@@ -282,7 +282,7 @@ public class PictoMenu {
ll.removeAllViewsInLayout(); ll.removeAllViewsInLayout();
try { try {
setPicto(p.get_row(),p.get_column(),p.getFreeRow(),p.getFreeColumn(), p.get_category(),p.get_bitmap(PCBcontext.getContext()),p.get_ImgId()); setPicto(p.get_row(),p.get_column()/*,p.getFreeRow(),p.getFreeColumn()*/, p.get_category(),p.get_bitmap(PCBcontext.getContext()),p.get_ImgId());
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -467,17 +467,17 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -467,17 +467,17 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
Iterator<Picto> pictos = list.iterator(); Iterator<Picto> pictos = list.iterator();
while (pictos.hasNext()) { while (pictos.hasNext()) {
Picto p = pictos.next(); Picto p = pictos.next();
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) { /*if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*--PCBcontext.getVocabulary().has_categories()) {*/
if (p.get_column() != -1 && p.get_row() != -1 if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) { && p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p; mp[p.get_column()][p.get_row()] = p;
} }
} else { /*} else {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1 if (p.getFreeColumn() != -1 && p.getFreeRow() != -1
&& p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) { && p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) {
mp[p.getFreeColumn()][p.getFreeRow()] = p; mp[p.getFreeColumn()][p.getFreeRow()] = p;
} }
} }*/
} }
try { try {
...@@ -737,8 +737,8 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -737,8 +737,8 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
boolean edit = data.getBooleanExtra(PictoMenu.IS_EDIT, 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 path_sound = data.getExtras().getString(PictoMenu.PATH_SOUND); String path_sound = data.getExtras().getString(PictoMenu.PATH_SOUND);
String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR); String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR);
...@@ -749,7 +749,7 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -749,7 +749,7 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
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, path_sound, user_avatar); chooseTextAndSavePicto(path, row, col/*, freeRow, freeColumn*/, cat, legend, path_sound, user_avatar);
refresh(); refresh();
} }
break; break;
...@@ -760,7 +760,7 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -760,7 +760,7 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
/** /**
* 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 String path_sound, final String user_avatar) { final int category, final String legend, final String path_sound, final String user_avatar) {
// Set up the buttons // Set up the buttons
...@@ -769,9 +769,9 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab ...@@ -769,9 +769,9 @@ public class VocabularyManager extends Activity implements VocabularyTalk.iVocab
legend, legend,
category, category,
row, row,
col, col,/*
freeRow, freeRow,
freeColumn, freeColumn,*/
user_avatar, user_avatar,
path_sound, path_sound,
new iLocalPicto() { new iLocalPicto() {
......
...@@ -556,17 +556,17 @@ public abstract class VOCA extends Activity implements VocabularyTalk.iVocabular ...@@ -556,17 +556,17 @@ public abstract class VOCA extends Activity implements VocabularyTalk.iVocabular
Iterator<Picto> pictos = list.iterator(); Iterator<Picto> pictos = list.iterator();
while (pictos.hasNext()) { while (pictos.hasNext()) {
Picto p = pictos.next(); Picto p = pictos.next();
if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()*/PCBcontext.getVocabulary().has_categories()) { /*if (/*PCBcontext.getPcbdb().getCurrentUser().has_categories()--PCBcontext.getVocabulary().has_categories()) {*/
if (p.get_column() != -1 && p.get_row() != -1 if (p.get_column() != -1 && p.get_row() != -1
&& p.get_column() < maxRows && p.get_row() < maxColumns) { && p.get_column() < maxRows && p.get_row() < maxColumns) {
mp[p.get_column()][p.get_row()] = p; mp[p.get_column()][p.get_row()] = p;
} }
} else { /*} else {
if (p.getFreeColumn() != -1 && p.getFreeRow() != -1 if (p.getFreeColumn() != -1 && p.getFreeRow() != -1
&& p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) { && p.getFreeColumn() < maxRows && p.getFreeRow() < maxColumns) {
mp[p.getFreeColumn()][p.getFreeRow()] = p; mp[p.getFreeColumn()][p.getFreeRow()] = p;
} }
} }*/
} }
try { try {
......
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