Issue #171,#172,# terminados (Falta asociar bien el archivo de audio al Media…

Issue #171,#172,# terminados (Falta asociar bien el archivo de audio al Media Player de la actividad)
parent f9daed10
......@@ -59,6 +59,7 @@ public class Picto extends Img {
public static String LEGEND = "legend";
public static String URI_SOUND = "uri_sound";
public static String USER_AVATAR = "user_avatar";
//public static String SCENE = "scene";
}
......@@ -97,7 +98,7 @@ public class Picto extends Img {
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/*, int scene*/) throws JSONException {
this(id, url, new JSONObject()
.put(JSON_ATTTRS.CATEGORY, cat)
.put(JSON_ATTTRS.COLUMN, column)
......@@ -109,6 +110,7 @@ public class Picto extends Img {
.put(JSON_ATTTRS.STUPICTO_ID,stupicto_id)
.put(JSON_ATTTRS.EXPRESSION,translation)
.put(JSON_ATTTRS.USER_AVATAR,user_avatar)
/*.put(JSON_ATTTRS.SCENE,scene)*/
);
}
public Picto(int id, String url,String translation, String attributes) throws JSONException {
......@@ -348,6 +350,14 @@ public class Picto extends Img {
/**
*
* @return the id of an scene of a picto
*/
/*public int get_id_scene() throws JSONException {
return this.attributes.getInt(JSON_ATTTRS.SCENE);
}
*/
/**
*
* @return the row of the picto
*/
public int get_row() {
......
......@@ -440,7 +440,7 @@ public class Vocabulary implements Iterable<Picto> {
int id=PCBcontext.getDevice().getNextLocalPictoID();
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,user_avatar);
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,user_avatar/*, prev_picto.get_id_scene()*/);
if (path_sound!=null)
new File(path_sound).renameTo(new File(picto.get_audioPath()));
......
......@@ -149,6 +149,8 @@ public class PictoUploader {
try {
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());
/*json_attrs.put("scene",picto.get_id_scene());*/
if (PCBcontext.getPcbdb().getCurrentUser().has_categories())
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.get_category())
.put(Picto.JSON_ATTTRS.COLUMN, picto.get_column())
......@@ -157,7 +159,7 @@ public class PictoUploader {
json_attrs.put(Picto.JSON_ATTTRS.CATEGORY, picto.NO_CATEGORY)
.put(Picto.JSON_ATTTRS.FREE_COLUMN, picto.getFreeColumn())
.put(Picto.JSON_ATTTRS.FREE_ROW, picto.getFreeRow());
params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",44).toString());
params.put("json", new JSONObject().put("attributes",json_attrs).put("id_scene",50).toString());
} catch (JSONException e) {
e.printStackTrace();
......
......@@ -39,13 +39,16 @@ import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.yottacode.net.RestapiWrapper;
import com.yottacode.pictogram.action.PictosAction;
import com.yottacode.pictogram.action.TalkAction;
import com.yottacode.pictogram.dao.PCBDBHelper;
import com.yottacode.pictogram.dao.Picto;
import com.yottacode.pictogram.dao.User;
import com.yottacode.pictogram.grammar.Vocabulary;
import com.yottacode.pictogram.grammar.iLocalPicto;
import com.yottacode.pictogram.net.ImgDownloader;
import com.yottacode.pictogram.net.NetService;
import com.yottacode.pictogram.net.PictoUploader;
import com.yottacode.pictogram.net.websockets.ActionTalk;
import com.yottacode.pictogram.net.websockets.VocabularyTalk;
......@@ -158,6 +161,7 @@ public class PictogramActivity extends Activity implements VocabularyTalk.iVocab
this.vocabulary.listen(PCBcontext.getRoom(), this, new ActionTalk.iActionListener() {
@Override
public void action(action action, int picto_cat, int picto_id) {
Log.i(this.getClass().getCanonicalName(), action + " from " + picto_cat + "," + picto_id + " catched");
if (action==ActionTalk.iActionListener.action.show) {
Log.i(LOG_TAG,"show message received:"+action.toString());
......@@ -1164,7 +1168,7 @@ protected void showOnlyTape(boolean onlyTape) {
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 user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR);
String user_avatar = data.getExtras().getString(Picto.JSON_ATTTRS.USER_AVATAR)/* : getIntent().getStringExtra(Picto.JSON_ATTTRS.USER_AVATAR, "----")*/;
int cat = edit ? data.getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1) : getIntent().getIntExtra(Picto.JSON_ATTTRS.CATEGORY, -1);
......@@ -1188,7 +1192,7 @@ protected void showOnlyTape(boolean onlyTape) {
// Set up the buttons
Log.i(LOG_TAG,"Uploading "+legend+" at row "+row+"/"+freeRow+", col "+col+"/"+freeColumn+" sound "+path_sound );
Log.i("TAG_PRUEBAS","Uploading "+legend+" at row "+row+"/"+freeRow+", col "+col+"/"+freeColumn+" sound "+path_sound +" user_avatar: "+user_avatar);
PCBcontext.getVocabulary().saveLocalPicto(
selectedImagePath,
......@@ -1203,8 +1207,6 @@ protected void showOnlyTape(boolean onlyTape) {
new iLocalPicto() {
@Override
public void saved(Picto localPicto) {
refresh();
try {
if (PCBcontext.is_user_online())
......
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