diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java index 590c227..33a9900 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java @@ -112,7 +112,7 @@ public class CreateEvent extends DialogFragment { } else { mNameInput.setError(null); } - if (((String)mDate.getSelectedItem()).equals(getString(R.string.create_event_date))) { + if ((mDate.getSelectedItem()).equals(getString(R.string.create_event_date))) { testDateInputOk = false; Toast.makeText(getContext(), getString(R.string.error_create_event_date), Toast.LENGTH_LONG).show(); } @@ -133,6 +133,7 @@ public class CreateEvent extends DialogFragment { @Override public void onResponse(JSONObject response) { mProgressBar.setVisibility(View.GONE); + dismiss(); } }, new Response.ErrorListener() { @Override diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java index 9a43a87..deb443b 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java @@ -134,6 +134,7 @@ public class ModifyEvent extends DialogFragment { public void onResponse(JSONObject response) { mProgressBar.setVisibility(View.GONE); Toast.makeText(getContext(), R.string.modify_done, Toast.LENGTH_LONG).show(); + dismiss(); } }, new Response.ErrorListener() { diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java index 66c5def..26fbfdd 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java @@ -56,7 +56,7 @@ public class PaiementEvent extends DialogFragment { Event event = (Event) getArguments().getSerializable("event"); mPaiementEventName.setText(event.getNomEvent()); - mPaiementEventPrice.setText(String.format(Locale.FRANCE, "%.2f €", event.getPrice())); + mPaiementEventPrice.setText(String.format(Locale.US, "%.2f €", event.getPrice())); eventId = event.getIdEvent(); @@ -96,7 +96,6 @@ public class PaiementEvent extends DialogFragment { public void onErrorResponse(VolleyError error) { mProgressBar.setVisibility(View.GONE); Toast.makeText(getContext(), R.string.payment_refused, Toast.LENGTH_LONG).show(); - dismiss(); } } ); diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java index 1b31855..9a84801 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java @@ -96,7 +96,13 @@ public class Crediter extends FragmentNFC { } } ); - + jsonObjectRequest.setTag(Crediter.class); VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } + + @Override + public void onStop() { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(Crediter.class); + super.onStop(); + } } diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java index 65708e0..b86fb80 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java @@ -104,7 +104,13 @@ public class Debiter extends FragmentNFC { } } ); - + jsonObjectRequest.setTag(Debiter.class); VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } + + @Override + public void onStop() { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(Debiter.class); + super.onStop(); + } } diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/CreatePersonne.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/CreatePersonne.java index f5b781f..0377c09 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/CreatePersonne.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/CreatePersonne.java @@ -4,16 +4,19 @@ import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; +import android.support.design.widget.TextInputLayout; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.widget.ArrayAdapter; +import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.ProgressBar; import android.widget.Spinner; +import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; @@ -29,6 +32,7 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import org.w3c.dom.Text; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -49,6 +53,9 @@ public class CreatePersonne extends DialogFragment { private Spinner mRole; private ProgressBar mProgressBar; + TextInputLayout mLoginInput; + TextInputLayout mCarteInput; + private String[] arraySpinnerNaissance; private ArrayAdapter adapterNaissance; @@ -64,6 +71,8 @@ public class CreatePersonne extends DialogFragment { View view = inflater.inflate(R.layout.fragment_create_personne, null); mLogin = (EditText) view.findViewById(R.id.create_personne_login); mCarte = (EditText) view.findViewById(R.id.create_personne_carte); + mLoginInput = (TextInputLayout) view.findViewById(R.id.create_personne_login_input); + mCarteInput = (TextInputLayout) view.findViewById(R.id.create_personne_carte_input); mRole = (Spinner) view.findViewById(R.id.create_personne_role); arraySpinnerRole = new ArrayList<>(); Role r = new Role(); @@ -75,53 +84,73 @@ public class CreatePersonne extends DialogFragment { changeRolePossibility(); mNaissance = (Spinner) view.findViewById(R.id.create_personne_naissance); arraySpinnerNaissance = new String[] { - "Date d'anniversaire" + getString(R.string.create_personne_naissance) }; adapterNaissance = new ArrayAdapter(getActivity(), R.layout.simple_item_layout, arraySpinnerNaissance); mNaissance.setAdapter(adapterNaissance); mProgressBar = (ProgressBar) view.findViewById(R.id.create_personne_progress_bar); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder + AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.create_personne) .setView(view) - .setPositiveButton(R.string.valid, new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.valid, null) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(CreatePersonne.class); + } + }).create(); - mProgressBar.setVisibility(View.VISIBLE); - mLogin.setVisibility(View.GONE); - mCarte.setVisibility(View.GONE); - mNaissance.setVisibility(View.GONE); - JSONObject jsonObject = new JSONObject(); - try { - jsonObject.put("login", mLogin.getText().toString()); - jsonObject.put("carte", mCarte.getText().toString()); - jsonObject.put("role", mRole.getSelectedItem()); - jsonObject.put("naissance", mNaissance.getSelectedItem()); - } catch (JSONException e){ - e.printStackTrace(); + dialog.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(final DialogInterface dialog) { + Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if (mLogin.getText().toString().isEmpty() && mCarte.getText().toString().isEmpty()){ + mLogin.setError(getString(R.string.error_create_personne_login_carte)); + mCarte.setError(getString(R.string.error_create_personne_login_carte)); } - JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/personne" ,jsonObject , new Response.Listener() { - @Override - public void onResponse(JSONObject response) { - mProgressBar.setVisibility(View.GONE); + else { + mProgressBar.setVisibility(View.VISIBLE); + mLoginInput.setVisibility(View.GONE); + mCarteInput.setVisibility(View.GONE); + mNaissance.setVisibility(View.GONE); + mRole.setVisibility(View.GONE); + JSONObject jsonObject = new JSONObject(); + try { + jsonObject.put("login", mLogin.getText().toString()); + jsonObject.put("carte", mCarte.getText().toString()); + jsonObject.put("role", mRole.getSelectedItem()); + if (!mNaissance.getSelectedItem().equals(getString(R.string.create_personne_naissance))) + jsonObject.put("naissance", mNaissance.getSelectedItem()); + } catch (JSONException e) { + e.printStackTrace(); } - }, new Response.ErrorListener() { - @Override - public void onErrorResponse(VolleyError error) { - mProgressBar.setVisibility(View.GONE); + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/personne", jsonObject, new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + mProgressBar.setVisibility(View.GONE); + dismiss(); + } + }, new Response.ErrorListener() { + @Override + public void onErrorResponse(VolleyError error) { + mProgressBar.setVisibility(View.GONE); + mLoginInput.setVisibility(View.VISIBLE); + mCarteInput.setVisibility(View.VISIBLE); + mNaissance.setVisibility(View.VISIBLE); + mRole.setVisibility(View.VISIBLE); + } } + ); + jsonObjectRequest.setTag(CreatePersonne.class); + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } - ); - - VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); - } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - // User cancelled the dialog } }); + } + }); mNaissance.setOnTouchListener(new View.OnTouchListener() { @Override @@ -134,8 +163,8 @@ public class CreatePersonne extends DialogFragment { return true; } }); - - return builder.create(); + dialog.setCanceledOnTouchOutside(false); + return dialog; } private void changeRolePossibility(){ @@ -155,16 +184,15 @@ public class CreatePersonne extends DialogFragment { e.printStackTrace(); } - } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { - + Toast.makeText(getContext(), "Can't update role", Toast.LENGTH_LONG).show(); } } ); - + jsonObjectRequest.setTag(CreatePersonne.class); VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } @@ -180,11 +208,17 @@ public class CreatePersonne extends DialogFragment { } }; - private void updateLabel() { - String myFormat = "yyyy-MM-dd"; //In which you need put here - SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE); - arraySpinnerNaissance[0] = sdf.format(myCalendar.getTime()); - adapterNaissance.notifyDataSetChanged(); - } + private void updateLabel() { + String myFormat = "yyyy-MM-dd"; //In which you need put here + SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE); + arraySpinnerNaissance[0] = sdf.format(myCalendar.getTime()); + adapterNaissance.notifyDataSetChanged(); + } + @Override + public void onStop() { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(CreatePersonne.class); + dismissAllowingStateLoss(); + super.onStop(); + } } diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/DeletePersonne.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/DeletePersonne.java index c1a97d8..f0aea8d 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/DeletePersonne.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/DeletePersonne.java @@ -7,6 +7,7 @@ import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; import android.view.View; +import android.widget.Button; import android.widget.ProgressBar; import android.widget.Toast; @@ -55,13 +56,23 @@ public class DeletePersonne extends DialogFragment { final Personne personne = (Personne) getArguments().getSerializable("personne"); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder + AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.verif_delete_personne) .setView(view) - .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.delete, null) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(DeletePersonne.class); + } + }).create(); + dialog.setCanceledOnTouchOutside(false); + dialog.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface dialog) { + Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); + button.setOnClickListener(new View.OnClickListener() { @Override - public void onClick(DialogInterface dialog, int which) { + public void onClick(View v) { mProgressBar.setVisibility(View.VISIBLE); JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, VolleyUtils.baseUri + "/personne/" + personne.getIdPersonne(), null, new Response.Listener() { @@ -76,21 +87,23 @@ public class DeletePersonne extends DialogFragment { public void onErrorResponse(VolleyError error) { mProgressBar.setVisibility(View.GONE); Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show(); - dismiss(); } } ); - + jsonObjectRequest.setTag(DeletePersonne.class); VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - - } }); - return builder.create(); + } + }); + return dialog; } + @Override + public void onStop() { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(DeletePersonne.class); + dismissAllowingStateLoss(); + super.onStop(); + } } diff --git a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/ModifyPersonne.java b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/ModifyPersonne.java index 833de72..f07b227 100644 --- a/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/ModifyPersonne.java +++ b/app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/ModifyPersonne.java @@ -1,40 +1,66 @@ package net.plil.clubinfo.etunicorn.app.personne; +import android.app.DatePickerDialog; import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; +import android.support.design.widget.TextInputLayout; import android.support.v4.app.DialogFragment; import android.support.v7.app.AlertDialog; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; +import android.widget.ArrayAdapter; +import android.widget.Button; +import android.widget.DatePicker; import android.widget.EditText; import android.widget.ProgressBar; +import android.widget.Spinner; import android.widget.Toast; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; +import com.google.gson.Gson; import net.plil.clubinfo.etunicorn.R; +import net.plil.clubinfo.etunicorn.app.event.ModifyEvent; import net.plil.clubinfo.etunicorn.data.Event; import net.plil.clubinfo.etunicorn.data.Personne; +import net.plil.clubinfo.etunicorn.data.Role; import net.plil.clubinfo.etunicorn.utils.VolleyUtils; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; import java.util.Locale; public class ModifyPersonne extends DialogFragment { + Calendar myCalendar = Calendar.getInstance(); + EditText mCarte; - EditText mNaissance; + Spinner mNaissance; EditText mLogin; - EditText mRole; + Spinner mRole; ProgressBar mProgressBar; + TextInputLayout mCarteInput; + TextInputLayout mLoginInput; + + private String[] arraySpinnerNaissance; + private ArrayAdapter adapterNaissance; + + private List arraySpinnerRole; + private ArrayAdapter adapterRole; + public static ModifyPersonne newInstance(Personne personne) { ModifyPersonne f = new ModifyPersonne(); @@ -49,49 +75,85 @@ public class ModifyPersonne extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { + myCalendar.set(Calendar.YEAR, myCalendar.get(Calendar.YEAR)-18); // Use the Builder class for convenient dialog construction LayoutInflater inflater = getActivity().getLayoutInflater(); View view = inflater.inflate(R.layout.fragment_modify_personne, null); mLogin = (EditText) view.findViewById(R.id.modify_personne_login); mCarte = (EditText) view.findViewById(R.id.modify_personne_carte); - mNaissance = (EditText) view.findViewById(R.id.modify_personne_naissance); - mRole = (EditText) view.findViewById(R.id.modify_personne_role); + mNaissance = (Spinner) view.findViewById(R.id.modify_personne_naissance); + mRole = (Spinner) view.findViewById(R.id.modify_personne_role); mProgressBar = (ProgressBar) view.findViewById(R.id.modify_event_progress_bar); + mLoginInput = (TextInputLayout) view.findViewById(R.id.create_personne_login_input); + mCarteInput = (TextInputLayout) view.findViewById(R.id.create_personne_carte_input); + final Personne personne = (Personne) getArguments().getSerializable("personne"); - mRole.setText(personne.getRole().getName()); mCarte.setText(personne.getIdCarte()); mLogin.setText(personne.getLoginPoly()); - mNaissance.setText(personne.getNaissance().toString()); - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - builder + arraySpinnerRole = new ArrayList<>(); + arraySpinnerRole.add(personne.getRole()); + adapterRole = new ArrayAdapter<>(getActivity(), + R.layout.simple_item_layout, arraySpinnerRole); + mRole.setAdapter(adapterRole); + changeRolePossibility(); + mNaissance = (Spinner) view.findViewById(R.id.modify_personne_naissance); + String myFormat = "yyyy-MM-dd"; //In which you need put here + SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE); + if (personne.getNaissance() == null){ + arraySpinnerNaissance = new String[]{ + getString(R.string.modify_personne_hint_date) + }; + } else { + arraySpinnerNaissance = new String[]{ + sdf.format(personne.getNaissance()) + }; + } + adapterNaissance = new ArrayAdapter(getActivity(), + R.layout.simple_item_layout, arraySpinnerNaissance); + mNaissance.setAdapter(adapterNaissance); + + + AlertDialog dialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.modify) .setView(view) - .setPositiveButton(R.string.modify, new DialogInterface.OnClickListener() { + .setPositiveButton(R.string.modify, null) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { - + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(ModifyPersonne.class); + } + }).create(); + // Create the AlertDialog object and return it + dialog.setOnShowListener(new DialogInterface.OnShowListener() { + @Override + public void onShow(DialogInterface dialog) { + Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); + button.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { mProgressBar.setVisibility(View.VISIBLE); mRole.setVisibility(View.GONE); - mLogin.setVisibility(View.GONE); - mCarte.setVisibility(View.GONE); + mLoginInput.setVisibility(View.GONE); + mCarteInput.setVisibility(View.GONE); mNaissance.setVisibility(View.GONE); JSONObject jsonObject = new JSONObject(); try { jsonObject.put("carte", mCarte.getText().toString()); jsonObject.put("login", mLogin.getText().toString()); - jsonObject.put("role", mRole.getText().toString()); - jsonObject.put("naissance", mNaissance.getText().toString()); + jsonObject.put("role", mRole.getSelectedItem()); + if (!mNaissance.getSelectedItem().equals(getString(R.string.modify_personne_hint_date))) + jsonObject.put("naissance", mNaissance.getSelectedItem().toString()); } catch (JSONException e){ e.printStackTrace(); } - JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/personne/" + personne.getIdPersonne() ,jsonObject , new Response.Listener() { + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, VolleyUtils.baseUri + "/personne/" + personne.getIdPersonne() ,jsonObject , new Response.Listener() { @Override public void onResponse(JSONObject response) { mProgressBar.setVisibility(View.GONE); Toast.makeText(getContext(), R.string.modify_done, Toast.LENGTH_LONG).show(); - + dismiss(); } }, new Response.ErrorListener() { @Override @@ -102,18 +164,80 @@ public class ModifyPersonne extends DialogFragment { } } ); - + jsonObjectRequest.setTag(ModifyPersonne.class); VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); } - }) - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int id) { - // User cancelled the dialog - } }); - // Create the AlertDialog object and return it - return builder.create(); + } + }); + mNaissance.setOnTouchListener(new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + if(event.getAction() == MotionEvent.ACTION_UP) { + new DatePickerDialog(getContext(), date, myCalendar + .get(Calendar.YEAR), myCalendar.get(Calendar.MONTH), + myCalendar.get(Calendar.DAY_OF_MONTH)).show(); + } + return true; + } + }); + dialog.setCanceledOnTouchOutside(false); + return dialog; + } + + DatePickerDialog.OnDateSetListener date = new DatePickerDialog.OnDateSetListener() { + + @Override + public void onDateSet(DatePicker view, int year, int monthOfYear, + int dayOfMonth) { + myCalendar.set(Calendar.YEAR, year); + myCalendar.set(Calendar.MONTH, monthOfYear); + myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth); + updateLabel(); + } + }; + + private void updateLabel() { + String myFormat = "yyyy-MM-dd"; //In which you need put here + SimpleDateFormat sdf = new SimpleDateFormat(myFormat, Locale.FRANCE); + arraySpinnerNaissance[0] = sdf.format(myCalendar.getTime()); + adapterNaissance.notifyDataSetChanged(); } + @Override + public void onStop() { + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(ModifyPersonne.class); + dismissAllowingStateLoss(); + super.onStop(); + } + + private void changeRolePossibility(){ + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, VolleyUtils.baseUri + "/role/" ,null , new Response.Listener() { + @Override + public void onResponse(JSONObject response) { + JSONArray jsonArray = null; + try { + //TODO change this by the real name of the array + jsonArray = response.getJSONArray("roles"); + arraySpinnerRole.clear(); + for (int i =0; i - - - + + + + + android:id="@+id/create_personne_carte_input"> + + - + android:id="@+id/modify_personne_carte_input"> + + - - + + + + - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 76b35eb..04cf615 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,4 +54,9 @@ Enter the date Name Price + Login + Card ID + Birthday + Need a login or a carte ID + Need a login or a carte ID -- libgit2 0.21.2