Commit 8bcd81b844ba49b33cc41e3f093266f755cca26f

Authored by badetitou
1 parent c8a73f2c

some staff

app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java 0 → 100644
... ... @@ -0,0 +1,86 @@
  1 +package net.plil.clubinfo.etunicorn.app.event;
  2 +
  3 +import android.app.Dialog;
  4 +import android.content.DialogInterface;
  5 +import android.os.Bundle;
  6 +import android.support.v4.app.DialogFragment;
  7 +import android.support.v7.app.AlertDialog;
  8 +import android.view.LayoutInflater;
  9 +import android.view.View;
  10 +import android.widget.EditText;
  11 +import android.widget.ProgressBar;
  12 +
  13 +import com.android.volley.Request;
  14 +import com.android.volley.Response;
  15 +import com.android.volley.VolleyError;
  16 +import com.android.volley.toolbox.JsonObjectRequest;
  17 +
  18 +import net.plil.clubinfo.etunicorn.R;
  19 +import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
  20 +
  21 +import org.json.JSONException;
  22 +import org.json.JSONObject;
  23 +
  24 +
  25 +public class CreateEvent extends DialogFragment {
  26 +
  27 + EditText mName;
  28 + EditText mPrice;
  29 + EditText mDate;
  30 + ProgressBar mProgressBar;
  31 +
  32 +
  33 + @Override
  34 + public Dialog onCreateDialog(Bundle savedInstanceState) {
  35 + // Use the Builder class for convenient dialog construction
  36 + LayoutInflater inflater = getActivity().getLayoutInflater();
  37 + View view = inflater.inflate(R.layout.fragment_create_event, null);
  38 + mName = (EditText) view.findViewById(R.id.create_event_name);
  39 + mPrice = (EditText) view.findViewById(R.id.create_event_price);
  40 + mDate = (EditText) view.findViewById(R.id.create_event_date);
  41 + mProgressBar = (ProgressBar) view.findViewById(R.id.create_event_progress_bar);
  42 + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  43 + builder
  44 + .setTitle(R.string.create_event)
  45 + .setView(view)
  46 + .setPositiveButton(R.string.valid, new DialogInterface.OnClickListener() {
  47 + public void onClick(DialogInterface dialog, int id) {
  48 +
  49 + mProgressBar.setVisibility(View.VISIBLE);
  50 + mPrice.setVisibility(View.GONE);
  51 + mName.setVisibility(View.GONE);
  52 + JSONObject jsonObject = new JSONObject();
  53 + try {
  54 + jsonObject.put("nomEvenement", mName.getText().toString());
  55 + jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString()));
  56 + jsonObject.put("date", mDate.getText().toString());
  57 + } catch (JSONException e){
  58 + e.printStackTrace();
  59 + }
  60 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/evenement" ,jsonObject , new Response.Listener<JSONObject>() {
  61 + @Override
  62 + public void onResponse(JSONObject response) {
  63 + mProgressBar.setVisibility(View.GONE);
  64 + }
  65 + }, new Response.ErrorListener() {
  66 + @Override
  67 + public void onErrorResponse(VolleyError error) {
  68 + mProgressBar.setVisibility(View.GONE);
  69 + }
  70 + }
  71 + );
  72 +
  73 + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
  74 + }
  75 + })
  76 + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  77 + public void onClick(DialogInterface dialog, int id) {
  78 + // User cancelled the dialog
  79 + }
  80 + });
  81 + // Create the AlertDialog object and return it
  82 + return builder.create();
  83 + }
  84 +
  85 +
  86 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/DeleteEvent.java 0 → 100644
... ... @@ -0,0 +1,96 @@
  1 +package net.plil.clubinfo.etunicorn.app.event;
  2 +
  3 +import android.app.Dialog;
  4 +import android.content.DialogInterface;
  5 +import android.os.Bundle;
  6 +import android.support.v4.app.DialogFragment;
  7 +import android.support.v7.app.AlertDialog;
  8 +import android.view.LayoutInflater;
  9 +import android.view.View;
  10 +import android.widget.ProgressBar;
  11 +import android.widget.Toast;
  12 +
  13 +import com.android.volley.Request;
  14 +import com.android.volley.Response;
  15 +import com.android.volley.VolleyError;
  16 +import com.android.volley.toolbox.JsonObjectRequest;
  17 +
  18 +import net.plil.clubinfo.etunicorn.R;
  19 +import net.plil.clubinfo.etunicorn.data.Consommation;
  20 +import net.plil.clubinfo.etunicorn.data.Event;
  21 +import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
  22 +
  23 +import org.json.JSONObject;
  24 +
  25 +
  26 +public class DeleteEvent extends DialogFragment {
  27 +
  28 + ProgressBar mProgressBar;
  29 +
  30 + public DeleteEvent(){}
  31 +
  32 + /**
  33 + * Create a new instance of MyDialogFragment, providing "num"
  34 + * as an argument.
  35 + */
  36 + public static DeleteEvent newInstance(Event event) {
  37 + DeleteEvent f = new DeleteEvent();
  38 +
  39 + // Supply num input as an argument.
  40 + Bundle args = new Bundle();
  41 + args.putSerializable("evenement", event);
  42 + f.setArguments(args);
  43 +
  44 + return f;
  45 + }
  46 +
  47 +
  48 + @Override
  49 + public Dialog onCreateDialog(Bundle savedInstanceState) {
  50 + // Use the Builder class for convenient dialog construction
  51 + LayoutInflater inflater = getActivity().getLayoutInflater();
  52 + View view = inflater.inflate(R.layout.fragment_delete_event, null);
  53 +
  54 + mProgressBar = (ProgressBar) view.findViewById(R.id.delete_consommation_progress_bar);
  55 + final Event event = (Event) getArguments().getSerializable("event");
  56 +
  57 +
  58 + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  59 + builder
  60 + .setTitle(R.string.verif_delete_event)
  61 + .setView(view)
  62 + .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
  63 + @Override
  64 + public void onClick(DialogInterface dialog, int which) {
  65 + mProgressBar.setVisibility(View.VISIBLE);
  66 +
  67 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, VolleyUtils.baseUri + "/evenement/" + event.getIdEvent(), null, new Response.Listener<JSONObject>() {
  68 + @Override
  69 + public void onResponse(JSONObject response) {
  70 + mProgressBar.setVisibility(View.GONE);
  71 + Toast.makeText(getContext(), R.string.delete_done, Toast.LENGTH_LONG).show();
  72 + dismiss();
  73 + }
  74 + }, new Response.ErrorListener() {
  75 + @Override
  76 + public void onErrorResponse(VolleyError error) {
  77 + mProgressBar.setVisibility(View.GONE);
  78 + Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show();
  79 + dismiss();
  80 + }
  81 + }
  82 + );
  83 +
  84 + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
  85 + }
  86 + })
  87 + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  88 + public void onClick(DialogInterface dialog, int id) {
  89 +
  90 + }
  91 + });
  92 + return builder.create();
  93 + }
  94 +
  95 +
  96 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/EventFragment.java
1   -package net.plil.clubinfo.etunicorn.app.Event;
  1 +package net.plil.clubinfo.etunicorn.app.event;
2 2  
3 3 import android.content.Context;
4 4 import android.os.Bundle;
  5 +import android.support.design.widget.FloatingActionButton;
5 6 import android.support.v7.widget.LinearLayoutManager;
6 7 import android.support.v7.widget.RecyclerView;
7 8 import android.view.LayoutInflater;
... ... @@ -46,22 +47,29 @@ public class EventFragment extends FragmentNFC {
46 47 View view = inflater.inflate(R.layout.fragment_event_list, container, false);
47 48  
48 49 // Set the adapter
49   - if (view instanceof RecyclerView) {
50   - Context context = view.getContext();
51   - RecyclerView recyclerView = (RecyclerView) view;
52   - recyclerView.setLayoutManager(new LinearLayoutManager(context));
53   -
54   - List<Event> events = new ArrayList<>();
55   - for (int i = 0; i< 150; ++i){
56   - Event ev = new Event();
57   - ev.setNomEvent("Hello " + i);
58   - ev.setPrice(15.52);
59   - ev.setDate(new Date(Calendar.getInstance().getTimeInMillis()));
60   - events.add(ev);
  50 + Context context = view.getContext();
  51 + RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.event_list);
  52 + recyclerView.setLayoutManager(new LinearLayoutManager(context));
  53 +
  54 + List<Event> events = new ArrayList<>();
  55 + for (int i = 0; i< 150; ++i) {
  56 + Event ev = new Event();
  57 + ev.setNomEvent("Hello " + i);
  58 + ev.setPrice(15.52);
  59 + ev.setDate(new Date(Calendar.getInstance().getTimeInMillis()));
  60 + events.add(ev);
  61 + }
  62 +
  63 + FloatingActionButton fAB = (FloatingActionButton) view.findViewById(R.id.event_add);
  64 + fAB.setOnClickListener(new View.OnClickListener() {
  65 + @Override
  66 + public void onClick(View v) {
  67 + CreateEvent newFragment = new CreateEvent();
  68 + newFragment.show(getFragmentManager(), "CreateEvent");
61 69 }
  70 + });
62 71  
63   - recyclerView.setAdapter(new MyEventRecyclerViewAdapter(events, mListener, getActivity()));
64   - }
  72 + recyclerView.setAdapter(new MyEventRecyclerViewAdapter(events, mListener, getActivity()));
65 73 return view;
66 74 }
67 75  
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java 0 → 100644
... ... @@ -0,0 +1,112 @@
  1 +package net.plil.clubinfo.etunicorn.app.event;
  2 +
  3 +import android.app.Dialog;
  4 +import android.content.DialogInterface;
  5 +import android.os.Bundle;
  6 +import android.support.v4.app.DialogFragment;
  7 +import android.support.v7.app.AlertDialog;
  8 +import android.view.LayoutInflater;
  9 +import android.view.View;
  10 +import android.widget.EditText;
  11 +import android.widget.ProgressBar;
  12 +import android.widget.Toast;
  13 +
  14 +import com.android.volley.Request;
  15 +import com.android.volley.Response;
  16 +import com.android.volley.VolleyError;
  17 +import com.android.volley.toolbox.JsonObjectRequest;
  18 +
  19 +import net.plil.clubinfo.etunicorn.R;
  20 +import net.plil.clubinfo.etunicorn.data.Event;
  21 +import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
  22 +
  23 +import org.json.JSONException;
  24 +import org.json.JSONObject;
  25 +
  26 +import java.util.Locale;
  27 +
  28 +
  29 +public class ModifyEvent extends DialogFragment {
  30 +
  31 + EditText mNom;
  32 + EditText mPrice;
  33 + EditText mDate;
  34 + ProgressBar mProgressBar;
  35 +
  36 + public static ModifyEvent newInstance(Event event) {
  37 + ModifyEvent f = new ModifyEvent();
  38 +
  39 + // Supply num input as an argument.
  40 + Bundle args = new Bundle();
  41 + args.putSerializable("event", event);
  42 + f.setArguments(args);
  43 +
  44 + return f;
  45 + }
  46 +
  47 +
  48 + @Override
  49 + public Dialog onCreateDialog(Bundle savedInstanceState) {
  50 + // Use the Builder class for convenient dialog construction
  51 + LayoutInflater inflater = getActivity().getLayoutInflater();
  52 + View view = inflater.inflate(R.layout.fragment_modify_event, null);
  53 + mNom = (EditText) view.findViewById(R.id.modify_event_name);
  54 + mPrice = (EditText) view.findViewById(R.id.modify_event_price);
  55 + mDate = (EditText) view.findViewById(R.id.modify_event_date);
  56 + mProgressBar = (ProgressBar) view.findViewById(R.id.modify_event_progress_bar);
  57 +
  58 + final Event event = (Event) getArguments().getSerializable("event");
  59 +
  60 + mNom.setText(event.getNomEvent());
  61 + mPrice.setText(String.format(Locale.FRANCE, "%.2f", event.getPrice()));
  62 + mDate.setText(event.getDate().toString());
  63 +
  64 + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  65 + builder
  66 + .setTitle(R.string.modify)
  67 + .setView(view)
  68 + .setPositiveButton(R.string.modify, new DialogInterface.OnClickListener() {
  69 + public void onClick(DialogInterface dialog, int id) {
  70 +
  71 + mProgressBar.setVisibility(View.VISIBLE);
  72 + mPrice.setVisibility(View.GONE);
  73 + mNom.setVisibility(View.GONE);
  74 + JSONObject jsonObject = new JSONObject();
  75 + try {
  76 + jsonObject.put("nomEvenement", mNom.getText().toString());
  77 + jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString()));
  78 + jsonObject.put("date", mDate.getText().toString());
  79 + } catch (JSONException e){
  80 + e.printStackTrace();
  81 + }
  82 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/evenement/" + event.getIdEvent() ,jsonObject , new Response.Listener<JSONObject>() {
  83 + @Override
  84 + public void onResponse(JSONObject response) {
  85 + mProgressBar.setVisibility(View.GONE);
  86 + Toast.makeText(getContext(), R.string.modify_done, Toast.LENGTH_LONG).show();
  87 +
  88 + }
  89 + }, new Response.ErrorListener() {
  90 + @Override
  91 + public void onErrorResponse(VolleyError error) {
  92 + mProgressBar.setVisibility(View.GONE);
  93 + Toast.makeText(getContext(), R.string.modify_refused, Toast.LENGTH_LONG).show();
  94 +
  95 + }
  96 + }
  97 + );
  98 +
  99 + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
  100 + }
  101 + })
  102 + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  103 + public void onClick(DialogInterface dialog, int id) {
  104 + // User cancelled the dialog
  105 + }
  106 + });
  107 + // Create the AlertDialog object and return it
  108 + return builder.create();
  109 + }
  110 +
  111 +
  112 +}
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/MyEventRecyclerViewAdapter.java
1   -package net.plil.clubinfo.etunicorn.app.Event;
  1 +package net.plil.clubinfo.etunicorn.app.event;
2 2  
3 3 import android.content.Context;
  4 +import android.support.v7.app.AppCompatActivity;
  5 +import android.support.v7.widget.PopupMenu;
4 6 import android.support.v7.widget.RecyclerView;
5 7 import android.view.LayoutInflater;
  8 +import android.view.MenuItem;
6 9 import android.view.View;
7 10 import android.view.ViewGroup;
8 11 import android.widget.TextView;
... ... @@ -56,6 +59,35 @@ public class MyEventRecyclerViewAdapter extends RecyclerView.Adapter&lt;MyEventRecy
56 59 return true;
57 60 }
58 61 });
  62 +
  63 + holder.mButtonView.setOnClickListener(new View.OnClickListener() {
  64 + @Override
  65 + public void onClick(View v) {
  66 + final PopupMenu popup = new PopupMenu(v.getContext(), holder.mButtonView);
  67 + //inflating menu from xml resource
  68 + popup.inflate(R.menu.option_list);
  69 + //adding click listener
  70 + popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  71 + @Override
  72 + public boolean onMenuItemClick(MenuItem item) {
  73 + switch (item.getItemId()) {
  74 + case R.id.delete:
  75 + DeleteEvent deleteEvent = DeleteEvent.newInstance(holder.mItem);
  76 + deleteEvent.show(((AppCompatActivity) context).getSupportFragmentManager(), "deleteConsommation");
  77 + break;
  78 + case R.id.modify:
  79 + ModifyEvent modifyEvent = ModifyEvent.newInstance(holder.mItem);
  80 + modifyEvent.show(((AppCompatActivity) context).getSupportFragmentManager(), "modifyConsommation");
  81 + break;
  82 + }
  83 + return false;
  84 + }
  85 + });
  86 + //displaying the popup
  87 + popup.show();
  88 + }
  89 + });
  90 +
59 91 }
60 92  
61 93 @Override
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java
1   -package net.plil.clubinfo.etunicorn.app.Event;
  1 +package net.plil.clubinfo.etunicorn.app.event;
2 2  
3 3 import android.app.Dialog;
4 4 import android.content.DialogInterface;
... ... @@ -17,7 +17,6 @@ import com.android.volley.VolleyError;
17 17 import com.android.volley.toolbox.JsonObjectRequest;
18 18  
19 19 import net.plil.clubinfo.etunicorn.R;
20   -import net.plil.clubinfo.etunicorn.data.Consommation;
21 20 import net.plil.clubinfo.etunicorn.data.Event;
22 21 import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
23 22  
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/LoginActivity.java
... ... @@ -171,26 +171,27 @@ public class LoginActivity extends AppCompatActivity {
171 171 user.setUsername(username);
172 172 JsonObjectRequest jsonObjectRequest = null;
173 173 try {
174   - jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri , new JSONObject(new Gson().toJson(user)), new Response.Listener<JSONObject>() {
  174 + jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/login" , new JSONObject(new Gson().toJson(user)), new Response.Listener<JSONObject>() {
175 175 @Override
176 176 public void onResponse(JSONObject response) {
177 177 showProgress(false);
178   - Intent intent = new Intent(getApplicationContext(), MainActivity.class);
179   - startActivity(intent);
  178 +
  179 + Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_LONG).show();
  180 + //Intent intent = new Intent(getApplicationContext(), MainActivity.class);
  181 + //startActivity(intent);
180 182 }
181 183 }, new Response.ErrorListener() {
182 184 @Override
183 185 public void onErrorResponse(VolleyError error) {
184 186 showProgress(false);
185   - Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
186   -
187   - //TODO remove this line
  187 + Toast.makeText(getApplicationContext(), "error : " + error.getCause(), Toast.LENGTH_SHORT).show();
188 188 Intent intent = new Intent(getApplicationContext(), MainActivity.class);
189 189 startActivity(intent);
190 190 // END
191 191 }
192 192 }
193 193 );
  194 + Toast.makeText(getApplicationContext(), new Gson().toJson(user), Toast.LENGTH_LONG).show();
194 195 } catch (JSONException e) {
195 196 e.printStackTrace();
196 197 }
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/MainActivity.java
... ... @@ -2,7 +2,6 @@ package net.plil.clubinfo.etunicorn.app;
2 2  
3 3 import android.app.PendingIntent;
4 4 import android.content.Intent;
5   -import android.net.Uri;
6 5 import android.nfc.NfcAdapter;
7 6 import android.nfc.Tag;
8 7 import android.os.Bundle;
... ... @@ -16,13 +15,10 @@ import android.support.v7.app.AppCompatActivity;
16 15 import android.support.v7.widget.Toolbar;
17 16 import android.view.Menu;
18 17 import android.view.MenuItem;
19   -import android.view.Window;
20   -import android.view.WindowManager;
21   -import android.widget.Toast;
22 18  
23 19 import net.plil.clubinfo.etunicorn.R;
24   -import net.plil.clubinfo.etunicorn.app.Event.EventFragment;
25   -import net.plil.clubinfo.etunicorn.app.Event.PaiementEvent;
  20 +import net.plil.clubinfo.etunicorn.app.event.EventFragment;
  21 +import net.plil.clubinfo.etunicorn.app.event.PaiementEvent;
26 22 import net.plil.clubinfo.etunicorn.app.consommation.FragmentConsommation;
27 23 import net.plil.clubinfo.etunicorn.app.consommation.PaiementConsommation;
28 24 import net.plil.clubinfo.etunicorn.data.Consommation;
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/ModifyConsommation.java
... ... @@ -23,6 +23,8 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
23 23 import org.json.JSONException;
24 24 import org.json.JSONObject;
25 25  
  26 +import java.util.Locale;
  27 +
26 28  
27 29 public class ModifyConsommation extends DialogFragment {
28 30  
... ... @@ -46,13 +48,16 @@ public class ModifyConsommation extends DialogFragment {
46 48 public Dialog onCreateDialog(Bundle savedInstanceState) {
47 49 // Use the Builder class for convenient dialog construction
48 50 LayoutInflater inflater = getActivity().getLayoutInflater();
49   - View view = inflater.inflate(R.layout.fragment_create_consomation, null);
50   - mNomConsomation = (EditText) view.findViewById(R.id.create_consomation_name);
51   - mPrice = (EditText) view.findViewById(R.id.create_consomation_price);
52   - mProgressBar = (ProgressBar) view.findViewById(R.id.create_consomation_progress_bar);
  51 + View view = inflater.inflate(R.layout.fragment_modify_consommation, null);
  52 + mNomConsomation = (EditText) view.findViewById(R.id.modify_consommation_name);
  53 + mPrice = (EditText) view.findViewById(R.id.modify_consommation_price);
  54 + mProgressBar = (ProgressBar) view.findViewById(R.id.modify_consommation_progress_bar);
53 55  
54 56 final Consommation consommation = (Consommation) getArguments().getSerializable("consommation");
55 57  
  58 + mNomConsomation.setText(consommation.getNomConsomation());
  59 + mPrice.setText(String.format(Locale.FRANCE,"%.2f", consommation.getPrix()));
  60 +
56 61 AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
57 62 builder
58 63 .setTitle(R.string.modify)
... ... @@ -70,7 +75,7 @@ public class ModifyConsommation extends DialogFragment {
70 75 } catch (JSONException e){
71 76 e.printStackTrace();
72 77 }
73   - JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation() ,jsonObject , new Response.Listener<JSONObject>() {
  78 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation() ,jsonObject , new Response.Listener<JSONObject>() {
74 79 @Override
75 80 public void onResponse(JSONObject response) {
76 81 mProgressBar.setVisibility(View.GONE);
... ...
app/src/main/java/net/plil/clubinfo/etunicorn/utils/VolleyUtils.java
... ... @@ -12,10 +12,10 @@ import com.android.volley.toolbox.Volley;
12 12  
13 13 public class VolleyUtils {
14 14  
15   - private static final String uri = "https://etunicorn.plil.net/";
  15 + private static final String uri = "http://192.168.0.21:8080/";
16 16 private static final String version = "v1";
17 17  
18   - public static final String baseUri = VolleyUtils.uri + VolleyUtils.version + "/";
  18 + public static final String baseUri = VolleyUtils.uri + VolleyUtils.version ;
19 19  
20 20 private static VolleyUtils mInstance;
21 21 private RequestQueue mRequestQueue;
... ...
app/src/main/res/layout/fragment_create_event.xml 0 → 100644
... ... @@ -0,0 +1,39 @@
  1 +<LinearLayout
  2 + xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:tools="http://schemas.android.com/tools"
  4 + tools:context="net.plil.clubinfo.etunicorn.app.consommation.CreateConsommation"
  5 + android:orientation="vertical"
  6 + android:layout_width="match_parent"
  7 + android:layout_height="match_parent"
  8 + >
  9 +
  10 + <EditText
  11 + android:layout_width="match_parent"
  12 + android:layout_height="wrap_content"
  13 + android:id="@+id/create_event_name"
  14 + android:hint="@string/create_event_name"/>
  15 +
  16 + <EditText
  17 + android:layout_width="match_parent"
  18 + android:layout_height="wrap_content"
  19 + android:hint="@string/create_consumable_price"
  20 + android:id="@+id/create_event_price"
  21 + android:inputType="numberSigned|numberDecimal"
  22 + android:maxLines="1" />
  23 +
  24 + <EditText
  25 + android:layout_width="match_parent"
  26 + android:layout_height="wrap_content"
  27 + android:hint="@string/create_event_date"
  28 + android:id="@+id/create_event_date"
  29 + android:inputType="datetime" />
  30 +
  31 + <ProgressBar
  32 + style="?android:attr/progressBarStyle"
  33 + android:layout_width="match_parent"
  34 + android:layout_height="wrap_content"
  35 + android:id="@+id/create_event_progress_bar"
  36 + android:visibility="gone"/>
  37 +
  38 +</LinearLayout>
  39 +
... ...
app/src/main/res/layout/fragment_delete_event.xml 0 → 100644
... ... @@ -0,0 +1,17 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + tools:context="net.plil.clubinfo.etunicorn.app.consommation.DeleteConsommation"
  6 + android:orientation="vertical">
  7 +
  8 +
  9 + <ProgressBar
  10 + style="?android:attr/progressBarStyle"
  11 + android:layout_width="wrap_content"
  12 + android:layout_height="wrap_content"
  13 + android:id="@+id/delete_event_progress_bar"
  14 + android:visibility="gone"
  15 + android:layout_gravity="center" />
  16 +
  17 +</LinearLayout>
... ...
app/src/main/res/layout/fragment_event_list.xml
1 1 <?xml version="1.0" encoding="utf-8"?>
2   -<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
3   - xmlns:app="http://schemas.android.com/apk/res-auto"
4   - xmlns:tools="http://schemas.android.com/tools"
5   - android:id="@+id/list"
  2 +<android.support.design.widget.CoordinatorLayout
  3 +xmlns:android="http://schemas.android.com/apk/res/android"
  4 +xmlns:app="http://schemas.android.com/apk/res-auto"
  5 +xmlns:tools="http://schemas.android.com/tools"
  6 +android:layout_width="match_parent"
  7 +android:layout_height="match_parent">
  8 +
  9 +<android.support.v7.widget.RecyclerView
  10 + android:id="@+id/event_list"
6 11 android:name="net.plil.clubinfo.etunicorn.app.Event.EventFragment"
7 12 android:layout_width="match_parent"
8 13 android:layout_height="match_parent"
9 14 android:layout_marginLeft="16dp"
10 15 android:layout_marginRight="16dp"
11 16 app:layoutManager="LinearLayoutManager"
12   - tools:context="net.plil.clubinfo.etunicorn.app.Event.EventFragment"
13   - tools:listitem="@layout/fragment_event" />
  17 + tools:context="net.plil.clubinfo.etunicorn.app.event.EventFragment"
  18 + tools:listitem="@layout/fragment_event"
  19 + />
  20 +
  21 +<android.support.design.widget.FloatingActionButton
  22 + android:layout_width="wrap_content"
  23 + android:layout_height="wrap_content"
  24 + android:clickable="true"
  25 + android:layout_gravity="bottom|end"
  26 + android:layout_margin="24dp"
  27 + android:id="@+id/event_add"
  28 + app:fabSize="auto"
  29 + app:srcCompat="@android:drawable/ic_menu_add"
  30 + app:backgroundTint="@color/colorPrimaryDark"
  31 + app:elevation="6dp"
  32 + app:rippleColor="@color/colorAccent"
  33 + app:layout_anchor="@id/event_list"
  34 + app:layout_anchorGravity="bottom|right|end"
  35 + app:layout_behavior="net.plil.clubinfo.etunicorn.utils.ScrollAwareFABBehavior" />
  36 +
  37 +</android.support.design.widget.CoordinatorLayout>
14 38 \ No newline at end of file
... ...
app/src/main/res/layout/fragment_modify_consommation.xml
... ... @@ -6,12 +6,12 @@
6 6 android:orientation="vertical">
7 7  
8 8 <EditText
9   - android:layout_width="wrap_content"
  9 + android:layout_width="match_parent"
10 10 android:layout_height="wrap_content"
11 11 android:id="@+id/modify_consommation_name" />
12 12  
13 13 <EditText
14   - android:layout_width="wrap_content"
  14 + android:layout_width="match_parent"
15 15 android:layout_height="wrap_content"
16 16 android:id="@+id/modify_consommation_price"/>
17 17  
... ... @@ -20,7 +20,8 @@
20 20 android:layout_width="match_parent"
21 21 android:layout_height="wrap_content"
22 22 android:id="@+id/modify_consommation_progress_bar"
23   - android:layout_gravity="center"/>
  23 + android:layout_gravity="center"
  24 + android:visibility="gone"/>
24 25  
25 26  
26 27 </LinearLayout>
... ...
app/src/main/res/layout/fragment_modify_event.xml 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  2 + xmlns:tools="http://schemas.android.com/tools"
  3 + android:layout_width="match_parent"
  4 + android:layout_height="match_parent"
  5 + tools:context="net.plil.clubinfo.etunicorn.app.event.ModifyEvent"
  6 + android:orientation="vertical">
  7 +
  8 + <EditText
  9 + android:layout_width="match_parent"
  10 + android:layout_height="wrap_content"
  11 + android:id="@+id/modify_event_name" />
  12 +
  13 + <EditText
  14 + android:layout_width="match_parent"
  15 + android:layout_height="wrap_content"
  16 + android:id="@+id/modify_event_price"/>
  17 +
  18 +
  19 + <EditText
  20 + android:layout_width="match_parent"
  21 + android:layout_height="wrap_content"
  22 + android:id="@+id/modify_event_date"
  23 + android:inputType="date" />
  24 +
  25 +
  26 + <ProgressBar
  27 + style="?android:attr/progressBarStyle"
  28 + android:layout_width="match_parent"
  29 + android:layout_height="wrap_content"
  30 + android:id="@+id/modify_event_progress_bar"
  31 + android:layout_gravity="center"
  32 + android:visibility="gone"/>
  33 +
  34 +
  35 +</LinearLayout>
... ...
app/src/main/res/values-fr/strings.xml
... ... @@ -27,4 +27,9 @@
27 27 <string name="modify_done">Modification effectué</string>
28 28 <string name="modify_refused">Modification refusé</string>
29 29 <string name="verif_delete_consomation">Etes-vous sûr ?</string>
  30 + <string name="create_event">Créer un évenement</string>
  31 + <string name="create_event_date">Date</string>
  32 + <string name="create_event_name">Nom</string>
  33 + <string name="event">Evenement</string>
  34 + <string name="payment_event">Paiement d\'un evenement</string>
30 35 </resources>
31 36 \ No newline at end of file
... ...
app/src/main/res/values/strings.xml
... ... @@ -24,10 +24,14 @@
24 24 <string name="modify">Modify</string>
25 25 <string name="delete">Delete</string>
26 26 <string name="verif_delete_consomation">Are you sure ?</string>
  27 + <string name="verif_delete_event">Are you sure ?</string>
27 28 <string name="delete_done">Delete done</string>
28 29 <string name="delete_refused">Delete refused</string>
29 30 <string name="modify_done">Modify done</string>
30 31 <string name="modify_refused">Modify refused</string>
31 32 <string name="event">Event</string>
32 33 <string name="payment_event">Event payment</string>
  34 + <string name="create_event_date">Date</string>
  35 + <string name="create_event_name">Name</string>
  36 + <string name="create_event">Create event</string>
33 37 </resources>
... ...