Commit c98b9d20 by german callejas

Cambios para adaptar tablet a los tableros

parent 9f15998d
...@@ -169,9 +169,9 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -169,9 +169,9 @@ public class PCBDBHelper extends SQLiteOpenHelper {
+","+params.getInt("student") +","+params.getInt("student")
+",'"+params.getString("name") +",'"+params.getString("name")
+"','"+params.getBoolean("active") +"','"+params.getBoolean("active")
+"','"+params.getBoolean("categories") +"','"+false/*params.getBoolean("categories")*/
+"')"; +"')";
Log.i(LOG_TAG,"Scene to be inserted: "+sql_scene+" scenes:"+params.getBoolean("categories")); //Log.i(LOG_TAG,"Scene to be inserted: "+sql_scene+" scenes:"+params.getBoolean("categories"));
getWritableDatabase().execSQL(sql_scene); getWritableDatabase().execSQL(sql_scene);
//Added //Added
...@@ -235,7 +235,7 @@ public class PCBDBHelper extends SQLiteOpenHelper { ...@@ -235,7 +235,7 @@ public class PCBDBHelper extends SQLiteOpenHelper {
}while (cursor.moveToNext()); }while (cursor.moveToNext());
cursor.close(); cursor.close();
//db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ //db.close(); <--no es necesario cerrar la bbdd https://groups.google.com/forum/#!msg/android-developers/NwDRpHUXt0U/jIam4Q8-cqQJ
vocabulary.setHas_categories(getHasCategories(id_scene)); //vocabulary.setHas_categories(getHasCategories(id_scene));
return vocabulary; return vocabulary;
} }
......
...@@ -27,7 +27,7 @@ public class UserLogin { ...@@ -27,7 +27,7 @@ public class UserLogin {
private static final String TAG_USER = "user"; private static final String TAG_USER = "user";
private static final String TAG_TOKEN = "token"; private static final String TAG_TOKEN = "token";
private static final String TAG_ID = "id"; private static final String TAG_ID = "id";
private static final String TAG_ID_SCENE = "id_active_scene"; private static final String TAG_ID_SCENE = "id_active_grid";
private static final String TAG_NAME = "name"; private static final String TAG_NAME = "name";
private static final String TAG_SURNAME = "surname"; private static final String TAG_SURNAME = "surname";
private static final String TAG_GENDER = "gender"; private static final String TAG_GENDER = "gender";
......
...@@ -185,7 +185,7 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -185,7 +185,7 @@ public class Vocabulary implements Iterable<Picto> {
// and (ii) downloading // and (ii) downloading
if (!upload_pending) { if (!upload_pending) {
final String picto_str = "/activeScene"; final String picto_str = "/activeGrid";
String operation = PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu() + picto_str; String operation = PCBcontext.getPcbdb().getCurrentUser().get_restapi_operation_stu() + picto_str;
PCBcontext.getRestapiWrapper().ask(operation, new RestapiWrapper.iRestapiListener() { PCBcontext.getRestapiWrapper().ask(operation, new RestapiWrapper.iRestapiListener() {
@Override @Override
...@@ -201,10 +201,11 @@ public class Vocabulary implements Iterable<Picto> { ...@@ -201,10 +201,11 @@ public class Vocabulary implements Iterable<Picto> {
@Override @Override
public void result(JSONObject result) { public void result(JSONObject result) {
if (result != null && PCBcontext.is_user_logged()) { if (result != null && PCBcontext.is_user_logged()) {
Log.e("MENSAJE","JSON: "+result.toString());
JSONObject picto, attributes; JSONObject picto, attributes;
JSONObject stupicto = null; JSONObject stupicto = null;
try { try {
setHas_categories(result.getBoolean("categories")); //setHas_categories(result.getBoolean("categories"));
JSONArray stu_pictos = result.getJSONArray("pictos"); //Obtengo el JSONArray de los stupictos JSONArray stu_pictos = result.getJSONArray("pictos"); //Obtengo el JSONArray de los stupictos
Picto[] pictos = new Picto[stu_pictos.length()]; Picto[] pictos = new Picto[stu_pictos.length()];
......
...@@ -36,7 +36,7 @@ public class StudentTalk implements Emitter.Listener { ...@@ -36,7 +36,7 @@ public class StudentTalk implements Emitter.Listener {
String username=msg.getString("username"); String username=msg.getString("username");
String name=msg.getString("name"); String name=msg.getString("name");
String surname=msg.getString("surname"); String surname=msg.getString("surname");
int id_active_scene = msg.getInt("id_active_scene"); int id_active_scene = msg.getInt("id_active_grid");
String gender=msg.getString("gender"); String gender=msg.getString("gender");
String pic=msg.getString("pic"); String pic=msg.getString("pic");
String lang=msg.getString("lang"); String lang=msg.getString("lang");
......
...@@ -85,6 +85,7 @@ public class PictoItemViewGenerator { ...@@ -85,6 +85,7 @@ public class PictoItemViewGenerator {
FrameLayout layout; FrameLayout layout;
final ImageView pictoImage; final ImageView pictoImage;
ImageView redCrossImage; ImageView redCrossImage;
ImageView micro_icon;
TextView legend; TextView legend;
TextView legend_full; TextView legend_full;
...@@ -96,6 +97,7 @@ public class PictoItemViewGenerator { ...@@ -96,6 +97,7 @@ public class PictoItemViewGenerator {
if (parent.getId() == R.id.tape_grid_view) if (parent.getId() == R.id.tape_grid_view)
convertView.setPadding(0,0,0,0); convertView.setPadding(0,0,0,0);
micro_icon = (ImageView) convertView.findViewById(R.id.micro_icon);
// Picto size // Picto size
if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) { if (PCBcontext.getPcbdb().getCurrentUser().is_picto_size_big()) {
layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big); layoutWrapper = (RelativeLayout) convertView.findViewById(R.id.picto_grid_item_layout_wrapper_big);
...@@ -116,6 +118,7 @@ public class PictoItemViewGenerator { ...@@ -116,6 +118,7 @@ public class PictoItemViewGenerator {
layout.setBackgroundColor(convertView.getResources().getColor(R.color.picto_default_background)); layout.setBackgroundColor(convertView.getResources().getColor(R.color.picto_default_background));
redCrossImage.setVisibility(View.GONE); redCrossImage.setVisibility(View.GONE);
layoutWrapper.setVisibility(View.GONE); layoutWrapper.setVisibility(View.GONE);
pictoImage.setVisibility(View.GONE); pictoImage.setVisibility(View.GONE);
legend.setVisibility(View.GONE); legend.setVisibility(View.GONE);
...@@ -130,6 +133,11 @@ public class PictoItemViewGenerator { ...@@ -130,6 +133,11 @@ public class PictoItemViewGenerator {
layoutWrapper.setBackground(convertView.getResources().getDrawable(R.drawable.picto_grid_item_border)); layoutWrapper.setBackground(convertView.getResources().getDrawable(R.drawable.picto_grid_item_border));
if (picto!=null) { if (picto!=null) {
if(picto.getUriSound() == null){
micro_icon.setVisibility(View.GONE);
}else{
micro_icon.setVisibility(View.VISIBLE);
}
layoutWrapper.setAlpha(!picto.is_invisible() ? 1.00f : PCBcontext.getActivityContext().getClass().getSimpleName().equals("VocabularyManager") ? 0.25f : 0f); layoutWrapper.setAlpha(!picto.is_invisible() ? 1.00f : PCBcontext.getActivityContext().getClass().getSimpleName().equals("VocabularyManager") ? 0.25f : 0f);
try { try {
Bitmap bm = picto.get_bitmap(PCBcontext.getContext()); Bitmap bm = picto.get_bitmap(PCBcontext.getContext());
...@@ -178,6 +186,8 @@ public class PictoItemViewGenerator { ...@@ -178,6 +186,8 @@ public class PictoItemViewGenerator {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
}else{
micro_icon.setVisibility(View.GONE);
} }
} }
......
...@@ -46,7 +46,7 @@ public class StudentFragmentGrid extends Fragment { ...@@ -46,7 +46,7 @@ public class StudentFragmentGrid extends Fragment {
final String TAG_USERNAME = "username"; final String TAG_USERNAME = "username";
final String TAG_NAME = "name"; final String TAG_NAME = "name";
final String TAG_SURNAME = "surname"; final String TAG_SURNAME = "surname";
final String TAG_ID_SCENE = "id_active_scene"; final String TAG_ID_SCENE = "id_active_grid";
final String TAG_GENDER = "gender"; final String TAG_GENDER = "gender";
final String TAG_PIC = "pic"; final String TAG_PIC = "pic";
final String TAG_LANG = "lang"; final String TAG_LANG = "lang";
...@@ -183,7 +183,7 @@ public class StudentFragmentGrid extends Fragment { ...@@ -183,7 +183,7 @@ public class StudentFragmentGrid extends Fragment {
*/ */
private void new_user(int i, final boolean license_valid) { private void new_user(int i, final boolean license_valid) {
JSONObject st = this.downloaded_students.get(i); JSONObject st = this.downloaded_students.get(i);
Log.e("MENSAJE","Usuario nuevo: "+st.toString());
Intent intent = getActivity().getIntent(); Intent intent = getActivity().getIntent();
try { try {
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/picto_grid_item_layout_wrapper" android:id="@+id/picto_grid_item_layout_wrapper"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -51,6 +52,13 @@ ...@@ -51,6 +52,13 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/disabled_picto" /> android:src="@drawable/disabled_picto" />
<ImageView
android:id="@+id/micro_icon"
android:layout_width="13dp"
android:layout_height="13dp"
android:layout_gravity="bottom|left"
app:srcCompat="@drawable/micro_negro" />
</FrameLayout> </FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/picto_grid_item_layout_wrapper_big" android:id="@+id/picto_grid_item_layout_wrapper_big"
android:layout_width="@dimen/picto_big_side" android:layout_width="@dimen/picto_big_side"
...@@ -48,6 +49,13 @@ ...@@ -48,6 +49,13 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:src="@drawable/disabled_picto" /> android:src="@drawable/disabled_picto" />
<ImageView
android:id="@+id/micro_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="bottom|left"
app:srcCompat="@drawable/micro_negro" />
</FrameLayout> </FrameLayout>
</RelativeLayout> </RelativeLayout>
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