Añadido menu lateral a la vista de editar picto para mostrar los supervisores

parent 7c61dd83
...@@ -18,16 +18,23 @@ import android.os.Environment; ...@@ -18,16 +18,23 @@ import android.os.Environment;
import android.provider.MediaStore; import android.provider.MediaStore;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat; import android.support.v4.app.ActivityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.util.Log; import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent; 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.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SeekBar; import android.widget.SeekBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
...@@ -44,6 +51,8 @@ import java.io.File; ...@@ -44,6 +51,8 @@ import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import pl.droidsonroids.gif.GifTextView; import pl.droidsonroids.gif.GifTextView;
...@@ -89,7 +98,15 @@ public class EditPictoActivity extends Activity { ...@@ -89,7 +98,15 @@ public class EditPictoActivity extends Activity {
//For Legend////////////////////////////////////////////////////////////////////////// //For Legend//////////////////////////////////////////////////////////////////////////
EditText legend; EditText legend;
//For Associated Supervisors/////////////////////////////////////////////////////////
Button desplegableSupervisores; Button desplegableSupervisores;
private ListView mDrawerList;
private ArrayAdapter<String> mAdapter;
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
//For Audio/////////////////////////////////////////////////////////////////////////// //For Audio///////////////////////////////////////////////////////////////////////////
private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200; private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200;
...@@ -105,6 +122,8 @@ public class EditPictoActivity extends Activity { ...@@ -105,6 +122,8 @@ public class EditPictoActivity extends Activity {
BotonCircular botonReproducir; BotonCircular botonReproducir;
BotonCircular botonBorrar; BotonCircular botonBorrar;
GifTextView gifRecord; GifTextView gifRecord;
SeekBar barraReproducir; SeekBar barraReproducir;
...@@ -209,6 +228,45 @@ public class EditPictoActivity extends Activity { ...@@ -209,6 +228,45 @@ public class EditPictoActivity extends Activity {
requestWindowFeature(Window.FEATURE_NO_TITLE); requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.edit_picto_layout); setContentView(R.layout.edit_picto_layout);
mDrawerList = (ListView)findViewById(R.id.navList);
/**Obtener la lista de supervisores y aplicarle formato*/
String supervisors = PCBcontext.getPcbdb().getCurrentUser().get_Supervisors();
ArrayList<String> supervisores = new ArrayList<>();
if(supervisors != null) {
String[] separated = supervisors.split(";");
for (String supervisor : separated) {
String[] detalles = supervisor.split(",");
supervisores.add(detalles[0] + "\n" + detalles[1]);
}
}
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, supervisores);
mDrawerList.setAdapter(mAdapter);
mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
R.string.drawer_open, R.string.drawer_close) {
/** Called when a drawer has settled in a completely open state. */
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
}
/** Called when a drawer has settled in a completely closed state. */
public void onDrawerClosed(View view) {
super.onDrawerClosed(view);
invalidateOptionsMenu();
}
};
mDrawerToggle.setDrawerIndicatorEnabled(true);
mDrawerLayout.setDrawerListener(mDrawerToggle);
dirImagePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM; dirImagePath = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_DCIM;
dirImagePath += "/PictoImages"; dirImagePath += "/PictoImages";
File fileImage = new File(dirImagePath); File fileImage = new File(dirImagePath);
...@@ -310,10 +368,21 @@ public class EditPictoActivity extends Activity { ...@@ -310,10 +368,21 @@ public class EditPictoActivity extends Activity {
desplegableSupervisores.setOnClickListener(new View.OnClickListener() { desplegableSupervisores.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
User currentUser = PCBcontext.getPcbdb().getCurrentUser(); if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT))
Log.i(DEBUG_MESSAGE,"Supervisores:"+currentUser.get_Supervisors()); mDrawerLayout.closeDrawer(Gravity.RIGHT);
else
mDrawerLayout.openDrawer(Gravity.RIGHT);
}
});
// Set the list's click listener
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(EditPictoActivity.this, "Supervisor: " + mDrawerList.getAdapter().getItem(position), Toast.LENGTH_SHORT).show();
} }
}); });
//Gestion de botones //Gestion de botones
okButton.setOnClickListener(new View.OnClickListener() { okButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout <android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/drawer_layout"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical" android:orientation="vertical"
...@@ -115,6 +118,7 @@ ...@@ -115,6 +118,7 @@
android:id="@+id/botonDesplegable" android:id="@+id/botonDesplegable"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="Ver" /> android:text="Ver" />
<TextView <TextView
...@@ -132,6 +136,7 @@ ...@@ -132,6 +136,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/textLegend" android:layout_below="@+id/textLegend"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="15dp"
android:background="@drawable/editpicto_edittext_style" android:background="@drawable/editpicto_edittext_style"
android:ems="10" android:ems="10"
android:gravity="center" android:gravity="center"
...@@ -306,4 +311,13 @@ ...@@ -306,4 +311,13 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<!-- The navigation drawer -->
<ListView
android:id="@+id/navList"
android:layout_width="250dp"
android:layout_height="match_parent"
android:layout_gravity="right|end"
android:background="#ffeeeeee"/>
</android.support.v4.widget.DrawerLayout>
...@@ -47,4 +47,6 @@ ...@@ -47,4 +47,6 @@
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string> <string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="uploadingImage">Subiendo imagen al servidor</string> <string name="uploadingImage">Subiendo imagen al servidor</string>
<string name="cancel">Cancel</string> <string name="cancel">Cancel</string>
<string name="drawer_open">Open Menu</string>
<string name="drawer_close">Close Menu</string>
</resources> </resources>
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