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

parent 7c61dd83
......@@ -18,16 +18,23 @@ import android.os.Environment;
import android.provider.MediaStore;
import android.support.annotation.NonNull;
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.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
......@@ -44,6 +51,8 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Random;
import pl.droidsonroids.gif.GifTextView;
......@@ -89,7 +98,15 @@ public class EditPictoActivity extends Activity {
//For Legend//////////////////////////////////////////////////////////////////////////
EditText legend;
//For Associated Supervisors/////////////////////////////////////////////////////////
Button desplegableSupervisores;
private ListView mDrawerList;
private ArrayAdapter<String> mAdapter;
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
//For Audio///////////////////////////////////////////////////////////////////////////
private static final int REQUEST_RECORD_AUDIO_PERMISSION = 200;
......@@ -105,6 +122,8 @@ public class EditPictoActivity extends Activity {
BotonCircular botonReproducir;
BotonCircular botonBorrar;
GifTextView gifRecord;
SeekBar barraReproducir;
......@@ -209,6 +228,45 @@ public class EditPictoActivity extends Activity {
requestWindowFeature(Window.FEATURE_NO_TITLE);
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 += "/PictoImages";
File fileImage = new File(dirImagePath);
......@@ -310,10 +368,21 @@ public class EditPictoActivity extends Activity {
desplegableSupervisores.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
User currentUser = PCBcontext.getPcbdb().getCurrentUser();
Log.i(DEBUG_MESSAGE,"Supervisores:"+currentUser.get_Supervisors());
if (mDrawerLayout.isDrawerOpen(Gravity.RIGHT))
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
okButton.setOnClickListener(new View.OnClickListener() {
@Override
......
......@@ -47,4 +47,6 @@
<string name="crop_TextRequired">Por favor, introduzca una leyenda para el pictograma</string>
<string name="uploadingImage">Subiendo imagen al servidor</string>
<string name="cancel">Cancel</string>
<string name="drawer_open">Open Menu</string>
<string name="drawer_close">Close Menu</string>
</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