PCB: prevent softkeyb when editing picto, working on sound upload service

parent 8d0f2c3d
...@@ -78,7 +78,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -78,7 +78,7 @@ public class Vocabulary implements Iterable<Picto> {
modifyAttsPicto(picto_cat, picto_id, args.getJSONObject("attributes")); modifyAttsPicto(picto_cat, picto_id, args.getJSONObject("attributes"));
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace(); e.printStackTrace();
Log.e(LOG_TAG,e.getMessage()); Log.e(LOG_TAG,"Error updating picto:"+e.getMessage());
} }
break; break;
} }
...@@ -457,7 +457,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -457,7 +457,7 @@ public class Vocabulary implements Iterable<Picto> {
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Log.e(Vocabulary.class.getCanonicalName(), e.getMessage()); Log.e(Vocabulary.class.getCanonicalName(), "Error saving picto:"+e.getMessage());
} }
} }
......
...@@ -102,10 +102,10 @@ public class PictoUploader { ...@@ -102,10 +102,10 @@ public class PictoUploader {
boolean success; boolean success;
Response<JsonObject> response=null; Response<JsonObject> response=null;
String [] path = audioFile.getPath().split("\\.");
String extension = path[1];
if (extension != "mp3") String extension = audioFile.getName().substring(audioFile.getName().lastIndexOf('.')+1);
if (!extension.equalsIgnoreCase("mp3"))
throw new UnsupportedEncodingException("Extension "+extension+" is not supported. Only mp3 files"); throw new UnsupportedEncodingException("Extension "+extension+" is not supported. Only mp3 files");
Ion ion = Ion.getDefault(PCBcontext.getContext()); Ion ion = Ion.getDefault(PCBcontext.getContext());
...@@ -114,7 +114,7 @@ public class PictoUploader { ...@@ -114,7 +114,7 @@ public class PictoUploader {
response=ion.with(PCBcontext.getContext()) response=ion.with(PCBcontext.getContext())
.load("POST", PCBcontext.getContext().getResources().getString(R.string.server) + "/picto/upload_sound/"+picto.get_stupicto_id()) .load("POST", PCBcontext.getContext().getResources().getString(R.string.server) + "/picto/upload_sound/"+picto.get_stupicto_id())
.setMultipartParameter("filename", "id_del _sonido") .setMultipartParameter("filename", audioFile.getName())
.setMultipartParameter("extension", "mp3") .setMultipartParameter("extension", "mp3")
.setMultipartParameter("owner", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_sup())) .setMultipartParameter("owner", Integer.toString(PCBcontext.getPcbdb().getCurrentUser().get_id_sup()))
.setMultipartParameter("folder", "pictoSound") .setMultipartParameter("folder", "pictoSound")
...@@ -138,7 +138,7 @@ public class PictoUploader { ...@@ -138,7 +138,7 @@ public class PictoUploader {
success=false; success=false;
Log.i(LOG_TAG, "Uploaded Sound failed "); Log.i(LOG_TAG, "Uploaded Sound failed ");
if (response != null) if (response != null)
Log.i(LOG_TAG, "Uploaded Sound failed, headers: " + response.getHeaders()); Log.i(LOG_TAG, "Uploaded Sound failed, headers: " + response.getHeaders().message()+"("+response.getHeaders().code()+")");
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
Log.e(LOG_TAG, "Sound upload error: " + e.getMessage()+ "Code: "+ Log.e(LOG_TAG, "Sound upload error: " + e.getMessage()+ "Code: "+
...@@ -300,14 +300,15 @@ public class PictoUploader { ...@@ -300,14 +300,15 @@ public class PictoUploader {
if (imgUpload_success){ if (imgUpload_success){
if(this.picto.getUriSound() != "" && this.picto.getUriSound() != null ){ //Si el picto tiene audio en local if(this.picto.getUriSound() != "" && this.picto.getUriSound() != null ){ //Si el picto tiene audio en local
Log.i("TAG_PRUEBAS","Hay uri: "+this.picto.getUriSound()+" -Procede a subir archivo"); Log.i(LOG_TAG,"Uploading sound "+this.picto.getUriSound());
File file = new File(picto.getUriSound()); //Obtengo el fichero de audio local File file = new File(picto.getUriSound()); //Obtengo el fichero de audio local
boolean soundUpload_success = uploadSound(file); //Llamo a la subida boolean soundUpload_success = uploadSound(file); //Llamo a la subida
if(soundUpload_success) { if(soundUpload_success) {
Log.i("TAG_PRUEBAS","Se sube sonido hay EXITO"); Log.i(LOG_TAG,"Sound uploaded");
}else { }else {
GUITools.show_alert(PCBcontext.getActivityContext(),Integer.parseInt(R.string.upload_error+"Audio"), PictoUploader.this.picto.get_translation()); Log.e(LOG_TAG, "Uploading sound error");
GUITools.show_alert(PCBcontext.getActivityContext(),R.string.upload_error, PictoUploader.this.picto.get_translation());
} }
} }
if (stupicto_id!=Picto.STUPICTO_NULL) { if (stupicto_id!=Picto.STUPICTO_NULL) {
......
...@@ -26,6 +26,7 @@ import android.view.KeyEvent; ...@@ -26,6 +26,7 @@ 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.view.WindowManager;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
...@@ -38,7 +39,6 @@ import android.widget.TextView; ...@@ -38,7 +39,6 @@ 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.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.PictoMenu; import com.yottacode.pictogram.tabletlibrary.gui.communicator.PictoMenu;
...@@ -55,7 +55,6 @@ import java.io.IOException; ...@@ -55,7 +55,6 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Random; import java.util.Random;
import java.util.Vector;
import pl.droidsonroids.gif.GifTextView; import pl.droidsonroids.gif.GifTextView;
...@@ -225,6 +224,7 @@ public class EditPictoActivity extends Activity { ...@@ -225,6 +224,7 @@ public class EditPictoActivity extends Activity {
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);
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
setContentView(R.layout.edit_picto_layout); setContentView(R.layout.edit_picto_layout);
//Persmisos para grabar audio //Persmisos para grabar audio
......
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