Commit bed8072575a7536e45f0a9dd0b88e0df1e2ca8f6

Authored by badetitou
1 parent be13b838

Correctif/PATCH

app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/EventFragment.java
@@ -8,6 +8,7 @@ import android.support.v7.widget.RecyclerView; @@ -8,6 +8,7 @@ import android.support.v7.widget.RecyclerView;
8 import android.view.LayoutInflater; 8 import android.view.LayoutInflater;
9 import android.view.View; 9 import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
  11 +import android.widget.Toast;
11 12
12 import net.plil.clubinfo.etunicorn.R; 13 import net.plil.clubinfo.etunicorn.R;
13 import net.plil.clubinfo.etunicorn.app.FragmentNFC; 14 import net.plil.clubinfo.etunicorn.app.FragmentNFC;
@@ -93,7 +94,13 @@ public class EventFragment extends FragmentNFC { @@ -93,7 +94,13 @@ public class EventFragment extends FragmentNFC {
93 94
94 @Override 95 @Override
95 public void processNFC(String idCardUser) { 96 public void processNFC(String idCardUser) {
96 - 97 + PaiementEvent paiementEvent = (PaiementEvent) getFragmentManager().findFragmentByTag("paiementEvent");
  98 + if (paiementEvent == null){
  99 + Toast.makeText(getContext(), R.string.payment_consumable_alert_no_selection, Toast.LENGTH_LONG).show();
  100 + }
  101 + else {
  102 + paiementEvent.processNFC();
  103 + }
97 } 104 }
98 105
99 /** 106 /**
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java
@@ -71,6 +71,7 @@ public class ModifyEvent extends DialogFragment { @@ -71,6 +71,7 @@ public class ModifyEvent extends DialogFragment {
71 mProgressBar.setVisibility(View.VISIBLE); 71 mProgressBar.setVisibility(View.VISIBLE);
72 mPrice.setVisibility(View.GONE); 72 mPrice.setVisibility(View.GONE);
73 mNom.setVisibility(View.GONE); 73 mNom.setVisibility(View.GONE);
  74 + mDate.setVisibility(View.GONE);
74 JSONObject jsonObject = new JSONObject(); 75 JSONObject jsonObject = new JSONObject();
75 try { 76 try {
76 jsonObject.put("nomEvenement", mNom.getText().toString()); 77 jsonObject.put("nomEvenement", mNom.getText().toString());
app/src/main/java/net/plil/clubinfo/etunicorn/app/LoginActivity.java
@@ -39,6 +39,7 @@ import com.android.volley.toolbox.JsonObjectRequest; @@ -39,6 +39,7 @@ import com.android.volley.toolbox.JsonObjectRequest;
39 import com.google.gson.Gson; 39 import com.google.gson.Gson;
40 40
41 import net.plil.clubinfo.etunicorn.R; 41 import net.plil.clubinfo.etunicorn.R;
  42 +import net.plil.clubinfo.etunicorn.data.Permission;
42 import net.plil.clubinfo.etunicorn.data.Personne; 43 import net.plil.clubinfo.etunicorn.data.Personne;
43 import net.plil.clubinfo.etunicorn.data.User; 44 import net.plil.clubinfo.etunicorn.data.User;
44 import net.plil.clubinfo.etunicorn.utils.VolleyUtils; 45 import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
@@ -176,9 +177,16 @@ public class LoginActivity extends AppCompatActivity { @@ -176,9 +177,16 @@ public class LoginActivity extends AppCompatActivity {
176 public void onResponse(JSONObject response) { 177 public void onResponse(JSONObject response) {
177 showProgress(false); 178 showProgress(false);
178 179
179 - Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_LONG).show();  
180 - //Intent intent = new Intent(getApplicationContext(), MainActivity.class);  
181 - //startActivity(intent); 180 + Toast.makeText(getApplicationContext(), response.toString(), Toast.LENGTH_LONG).show();
  181 + Intent intent = new Intent(getApplicationContext(), MainActivity.class);
  182 + //TODO real interpretation when login work
  183 + //Personne p = new Gson().fromJson(String.valueOf(response), Personne.class);
  184 + Personne p = new Personne();
  185 + Permission permission = new Permission();
  186 + permission.setNom("ROLE_ADMIN");
  187 + p.getRole().getPermissions().add(permission);
  188 + intent.putExtra("user", p);
  189 + startActivity(intent);
182 } 190 }
183 }, new Response.ErrorListener() { 191 }, new Response.ErrorListener() {
184 @Override 192 @Override
@@ -186,12 +194,17 @@ public class LoginActivity extends AppCompatActivity { @@ -186,12 +194,17 @@ public class LoginActivity extends AppCompatActivity {
186 showProgress(false); 194 showProgress(false);
187 Toast.makeText(getApplicationContext(), "error : " + error.getCause(), Toast.LENGTH_SHORT).show(); 195 Toast.makeText(getApplicationContext(), "error : " + error.getCause(), Toast.LENGTH_SHORT).show();
188 Intent intent = new Intent(getApplicationContext(), MainActivity.class); 196 Intent intent = new Intent(getApplicationContext(), MainActivity.class);
  197 +
  198 + Personne p = new Personne();
  199 + Permission permission = new Permission();
  200 + permission.setNom("ROLE_ADMIN");
  201 + p.getRole().getPermissions().add(permission);
  202 + intent.putExtra("user", p);
  203 +
189 startActivity(intent); 204 startActivity(intent);
190 - // END  
191 } 205 }
192 } 206 }
193 ); 207 );
194 - Toast.makeText(getApplicationContext(), new Gson().toJson(user), Toast.LENGTH_LONG).show();  
195 } catch (JSONException e) { 208 } catch (JSONException e) {
196 e.printStackTrace(); 209 e.printStackTrace();
197 } 210 }
app/src/main/java/net/plil/clubinfo/etunicorn/app/MainActivity.java
@@ -15,21 +15,29 @@ import android.support.v7.app.AppCompatActivity; @@ -15,21 +15,29 @@ import android.support.v7.app.AppCompatActivity;
15 import android.support.v7.widget.Toolbar; 15 import android.support.v7.widget.Toolbar;
16 import android.view.Menu; 16 import android.view.Menu;
17 import android.view.MenuItem; 17 import android.view.MenuItem;
  18 +import android.widget.Toast;
18 19
19 import net.plil.clubinfo.etunicorn.R; 20 import net.plil.clubinfo.etunicorn.R;
  21 +import net.plil.clubinfo.etunicorn.app.credit.Crediter;
  22 +import net.plil.clubinfo.etunicorn.app.debit.Debiter;
20 import net.plil.clubinfo.etunicorn.app.event.EventFragment; 23 import net.plil.clubinfo.etunicorn.app.event.EventFragment;
21 import net.plil.clubinfo.etunicorn.app.event.PaiementEvent; 24 import net.plil.clubinfo.etunicorn.app.event.PaiementEvent;
22 import net.plil.clubinfo.etunicorn.app.consommation.FragmentConsommation; 25 import net.plil.clubinfo.etunicorn.app.consommation.FragmentConsommation;
23 import net.plil.clubinfo.etunicorn.app.consommation.PaiementConsommation; 26 import net.plil.clubinfo.etunicorn.app.consommation.PaiementConsommation;
  27 +import net.plil.clubinfo.etunicorn.app.personne.PersonneFragment;
24 import net.plil.clubinfo.etunicorn.data.Consommation; 28 import net.plil.clubinfo.etunicorn.data.Consommation;
25 import net.plil.clubinfo.etunicorn.data.Event; 29 import net.plil.clubinfo.etunicorn.data.Event;
  30 +import net.plil.clubinfo.etunicorn.data.Personne;
26 import net.plil.clubinfo.etunicorn.utils.ConvertBytesToString; 31 import net.plil.clubinfo.etunicorn.utils.ConvertBytesToString;
27 32
28 import java.util.ArrayList; 33 import java.util.ArrayList;
29 import java.util.List; 34 import java.util.List;
30 35
31 36
32 -public class MainActivity extends AppCompatActivity implements FragmentConsommation.OnListFragmentInteractionListener, EventFragment.OnListFragmentInteractionListener{ 37 +public class MainActivity extends AppCompatActivity
  38 + implements FragmentConsommation.OnListFragmentInteractionListener,
  39 + EventFragment.OnListFragmentInteractionListener,
  40 + PersonneFragment.OnListFragmentInteractionListener{
33 41
34 /** 42 /**
35 * The {@link android.support.v4.view.PagerAdapter} that will provide 43 * The {@link android.support.v4.view.PagerAdapter} that will provide
@@ -41,6 +49,8 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -41,6 +49,8 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
41 */ 49 */
42 private SectionsPagerAdapter mSectionsPagerAdapter; 50 private SectionsPagerAdapter mSectionsPagerAdapter;
43 51
  52 + private int nbPages = 0;
  53 +
44 /** 54 /**
45 * The {@link ViewPager} that will host the section contents. 55 * The {@link ViewPager} that will host the section contents.
46 */ 56 */
@@ -56,10 +66,34 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -56,10 +66,34 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
56 @Override 66 @Override
57 protected void onCreate(Bundle savedInstanceState) { 67 protected void onCreate(Bundle savedInstanceState) {
58 super.onCreate(savedInstanceState); 68 super.onCreate(savedInstanceState);
  69 +
  70 + // config tabbed pan
  71 + Intent intent = this.getIntent();
  72 + Personne p = (Personne) intent.getSerializableExtra("user");
  73 + Toast.makeText(getApplicationContext(), p.getRole().getPermissions().get(0).getNom(), Toast.LENGTH_LONG).show();
  74 + if (p.getRole().getPermissions().get(0).getNom().equals("ROLE_ADMIN")){
  75 + nbPages = 5;
  76 + Action.CONSOMATION.setValue(2);
  77 + Action.EVENT.setValue(3);
  78 + Action.PERSONNE.setValue(4);
  79 + } else if (p.getRole().getPermissions().get(0).getNom().equals("ROLE_BDE")){
  80 + nbPages = 4;
  81 + Action.CONSOMATION.setValue(-1);
  82 + Action.EVENT.setValue(2);
  83 + Action.PERSONNE.setValue(3);
  84 + } else if (p.getRole().getPermissions().get(0).getNom().equals("ROLE_BAR")){
  85 + nbPages = 3;
  86 + Action.CONSOMATION.setValue(2);
  87 + Action.EVENT.setValue(-1);
  88 + Action.PERSONNE.setValue(-1);
  89 + } else {
  90 + nbPages = 2;
  91 + }
  92 +
  93 + // config other stuff
59 setContentView(R.layout.activity_main); 94 setContentView(R.layout.activity_main);
60 95
61 appBarLayout = (AppBarLayout) findViewById(R.id.appbar); 96 appBarLayout = (AppBarLayout) findViewById(R.id.appbar);
62 -  
63 toolbar = (Toolbar) findViewById(R.id.toolbar); 97 toolbar = (Toolbar) findViewById(R.id.toolbar);
64 setSupportActionBar(toolbar); 98 setSupportActionBar(toolbar);
65 99
@@ -154,6 +188,16 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -154,6 +188,16 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
154 188
155 } 189 }
156 190
  191 + @Override
  192 + public void onListFragmentInteraction(Personne personne) {
  193 +
  194 + }
  195 +
  196 + @Override
  197 + public void onListFragmentInteractionLong(Personne personne) {
  198 +
  199 + }
  200 +
157 /** 201 /**
158 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to 202 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
159 * one of the sections/tabs/pages. 203 * one of the sections/tabs/pages.
@@ -174,13 +218,15 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -174,13 +218,15 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
174 return FragmentConsommation.newInstance(); 218 return FragmentConsommation.newInstance();
175 else if (position == Action.EVENT.getValue()) 219 else if (position == Action.EVENT.getValue())
176 return EventFragment.newInstance(); 220 return EventFragment.newInstance();
  221 + else if (position == Action.PERSONNE.getValue())
  222 + return PersonneFragment.newInstance();
177 else 223 else
178 return null; 224 return null;
179 } 225 }
180 226
181 @Override 227 @Override
182 public int getCount() { 228 public int getCount() {
183 - return 4; 229 + return nbPages;
184 } 230 }
185 231
186 @Override 232 @Override
@@ -193,14 +239,16 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -193,14 +239,16 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
193 return "Consommation"; 239 return "Consommation";
194 else if(position == Action.EVENT.getValue()) 240 else if(position == Action.EVENT.getValue())
195 return getString(R.string.event); 241 return getString(R.string.event);
  242 + else if(position == Action.PERSONNE.getValue())
  243 + return getString(R.string.personne);
196 return null; 244 return null;
197 } 245 }
198 } 246 }
199 247
200 private enum Action { 248 private enum Action {
201 - DEBITER(0), CREDITER(1), CONSOMATION(2), EVENT(3); 249 + DEBITER(0), CREDITER(1), CONSOMATION(2), EVENT(3), PERSONNE(4);
202 250
203 - private final int value; 251 + private int value;
204 Action(int value) { 252 Action(int value) {
205 this.value = value; 253 this.value = value;
206 } 254 }
@@ -208,5 +256,9 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat @@ -208,5 +256,9 @@ public class MainActivity extends AppCompatActivity implements FragmentConsommat
208 public int getValue() { 256 public int getValue() {
209 return value; 257 return value;
210 } 258 }
  259 +
  260 + public void setValue(int value) {
  261 + this.value = value;
  262 + }
211 } 263 }
212 } 264 }
app/src/main/java/net/plil/clubinfo/etunicorn/app/Crediter.java renamed to app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java
1 -package net.plil.clubinfo.etunicorn.app; 1 +package net.plil.clubinfo.etunicorn.app.credit;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 -import android.net.Uri;  
5 import android.os.Bundle; 4 import android.os.Bundle;
6 -import android.support.v4.app.Fragment;  
7 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
8 import android.view.View; 6 import android.view.View;
9 import android.view.ViewGroup; 7 import android.view.ViewGroup;
10 import android.widget.EditText; 8 import android.widget.EditText;
11 import android.widget.ProgressBar; 9 import android.widget.ProgressBar;
12 -import android.widget.Toast;  
13 10
14 import com.android.volley.Request; 11 import com.android.volley.Request;
15 import com.android.volley.Response; 12 import com.android.volley.Response;
@@ -17,6 +14,7 @@ import com.android.volley.VolleyError; @@ -17,6 +14,7 @@ import com.android.volley.VolleyError;
17 import com.android.volley.toolbox.JsonObjectRequest; 14 import com.android.volley.toolbox.JsonObjectRequest;
18 15
19 import net.plil.clubinfo.etunicorn.R; 16 import net.plil.clubinfo.etunicorn.R;
  17 +import net.plil.clubinfo.etunicorn.app.FragmentNFC;
20 import net.plil.clubinfo.etunicorn.utils.VolleyUtils; 18 import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
21 19
22 import org.json.JSONException; 20 import org.json.JSONException;
app/src/main/java/net/plil/clubinfo/etunicorn/app/Debiter.java renamed to app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java
1 -package net.plil.clubinfo.etunicorn.app; 1 +package net.plil.clubinfo.etunicorn.app.debit;
2 2
3 import android.content.Context; 3 import android.content.Context;
4 -import android.content.Intent;  
5 -import android.net.Uri;  
6 import android.os.Bundle; 4 import android.os.Bundle;
7 -import android.support.v4.app.Fragment;  
8 import android.view.LayoutInflater; 5 import android.view.LayoutInflater;
9 import android.view.View; 6 import android.view.View;
10 import android.view.ViewGroup; 7 import android.view.ViewGroup;
11 import android.widget.EditText; 8 import android.widget.EditText;
12 import android.widget.ProgressBar; 9 import android.widget.ProgressBar;
13 -import android.widget.Toast;  
14 10
15 import com.android.volley.Request; 11 import com.android.volley.Request;
16 import com.android.volley.Response; 12 import com.android.volley.Response;
17 import com.android.volley.VolleyError; 13 import com.android.volley.VolleyError;
18 import com.android.volley.toolbox.JsonObjectRequest; 14 import com.android.volley.toolbox.JsonObjectRequest;
19 -import com.google.gson.Gson;  
20 -import com.google.gson.JsonElement;  
21 -import com.google.gson.JsonObject;  
22 15
23 import net.plil.clubinfo.etunicorn.R; 16 import net.plil.clubinfo.etunicorn.R;
24 -import net.plil.clubinfo.etunicorn.data.Personne; 17 +import net.plil.clubinfo.etunicorn.app.FragmentNFC;
25 import net.plil.clubinfo.etunicorn.utils.VolleyUtils; 18 import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
26 19
27 import org.json.JSONException; 20 import org.json.JSONException;
app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/MyPersonneRecyclerViewAdapter.java 0 โ†’ 100644
@@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
  1 +package net.plil.clubinfo.etunicorn.app.personne;
  2 +
  3 +import android.content.Context;
  4 +import android.support.v7.app.AppCompatActivity;
  5 +import android.support.v7.widget.PopupMenu;
  6 +import android.support.v7.widget.RecyclerView;
  7 +import android.view.LayoutInflater;
  8 +import android.view.MenuItem;
  9 +import android.view.View;
  10 +import android.view.ViewGroup;
  11 +import android.widget.TextView;
  12 +
  13 +import net.plil.clubinfo.etunicorn.R;
  14 +import net.plil.clubinfo.etunicorn.data.Personne;
  15 +
  16 +import java.util.List;
  17 +import java.util.Locale;
  18 +
  19 +public class MyPersonneRecyclerViewAdapter extends RecyclerView.Adapter<MyPersonneRecyclerViewAdapter.ViewHolder> {
  20 +
  21 + private final List<Personne> mValues;
  22 + private final PersonneFragment.OnListFragmentInteractionListener mListener;
  23 + private final Context context;
  24 +
  25 +
  26 + public MyPersonneRecyclerViewAdapter(List<Personne> items, PersonneFragment.OnListFragmentInteractionListener listener, Context context) {
  27 + mValues = items;
  28 + mListener = listener;
  29 + this.context = context;
  30 + }
  31 +
  32 + @Override
  33 + public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  34 + View view = LayoutInflater.from(parent.getContext())
  35 + .inflate(R.layout.fragment_personne, parent, false);
  36 + return new ViewHolder(view);
  37 + }
  38 +
  39 + @Override
  40 + public void onBindViewHolder(final ViewHolder holder, int position) {
  41 + holder.mItem = mValues.get(position);
  42 + holder.mLogin.setText(mValues.get(position).getLoginPoly());
  43 + holder.mCarte.setText(mValues.get(position).getIdCarte());
  44 + holder.mRole.setText(mValues.get(position).getRole().getName());
  45 + holder.mSolde.setText(String.format(Locale.FRANCE, "%.2f", mValues.get(position).getSolde()));
  46 +
  47 + holder.mView.setOnClickListener(new View.OnClickListener() {
  48 + @Override
  49 + public void onClick(View v) {
  50 + if (null != mListener) {
  51 + mListener.onListFragmentInteraction(holder.mItem);
  52 + }
  53 + }
  54 + });
  55 +
  56 + holder.mView.setOnLongClickListener(new View.OnLongClickListener() {
  57 + @Override
  58 + public boolean onLongClick(View v) {
  59 + mListener.onListFragmentInteractionLong(holder.mItem);
  60 + return true;
  61 + }
  62 + });
  63 +
  64 + holder.mButton.setOnClickListener(new View.OnClickListener() {
  65 + @Override
  66 + public void onClick(View v) {
  67 + final PopupMenu popup = new PopupMenu(v.getContext(), holder.mButton);
  68 + //inflating menu from xml resource
  69 + popup.inflate(R.menu.option_list);
  70 + //adding click listener
  71 + popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  72 + @Override
  73 + public boolean onMenuItemClick(MenuItem item) {
  74 + switch (item.getItemId()) {
  75 + case R.id.delete:
  76 + DeletePersonne deletePersonne = DeletePersonne.newInstance(holder.mItem);
  77 + deletePersonne.show(((AppCompatActivity) context).getSupportFragmentManager(), "deleteConsommation");
  78 + break;
  79 + case R.id.modify:
  80 + ModifyPersonne modifyPersonne = ModifyPersonne.newInstance(holder.mItem);
  81 + modifyPersonne.show(((AppCompatActivity) context).getSupportFragmentManager(), "modifyConsommation");
  82 + break;
  83 + }
  84 + return false;
  85 + }
  86 + });
  87 + //displaying the popup
  88 + popup.show();
  89 + }
  90 + });
  91 +
  92 + }
  93 +
  94 + @Override
  95 + public int getItemCount() {
  96 + return mValues.size();
  97 + }
  98 +
  99 + public class ViewHolder extends RecyclerView.ViewHolder {
  100 + public final View mView;
  101 + public final TextView mLogin;
  102 + public final TextView mCarte;
  103 + public final TextView mRole;
  104 + public final TextView mSolde;
  105 + public final TextView mButton;
  106 + public Personne mItem;
  107 +
  108 + public ViewHolder(View view) {
  109 + super(view);
  110 + mView = view;
  111 + mLogin = (TextView) view.findViewById(R.id.personne_login);
  112 + mCarte = (TextView) view.findViewById(R.id.personne_carte);
  113 + mRole = (TextView) view.findViewById(R.id.personne_role);
  114 + mSolde = (TextView) view.findViewById(R.id.personne_solde);
  115 + mButton = (TextView) view.findViewById(R.id.personne_options);
  116 +
  117 +
  118 + }
  119 + }
  120 +}
app/src/main/java/net/plil/clubinfo/etunicorn/app/personne/PersonneFragment.java 0 โ†’ 100644
@@ -0,0 +1,110 @@ @@ -0,0 +1,110 @@
  1 +package net.plil.clubinfo.etunicorn.app.personne;
  2 +
  3 +import android.content.Context;
  4 +import android.os.Bundle;
  5 +import android.support.v7.widget.LinearLayoutManager;
  6 +import android.support.v7.widget.ListPopupWindow;
  7 +import android.support.v7.widget.RecyclerView;
  8 +import android.view.LayoutInflater;
  9 +import android.view.View;
  10 +import android.view.ViewGroup;
  11 +
  12 +import net.plil.clubinfo.etunicorn.R;
  13 +import net.plil.clubinfo.etunicorn.app.FragmentNFC;
  14 +import net.plil.clubinfo.etunicorn.data.Personne;
  15 +
  16 +import java.sql.Date;
  17 +import java.util.ArrayList;
  18 +import java.util.Calendar;
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * A fragment representing a list of Items.
  23 + * <p/>
  24 + * Activities containing this fragment MUST implement the {@link OnListFragmentInteractionListener}
  25 + * interface.
  26 + */
  27 +public class PersonneFragment extends FragmentNFC {
  28 +
  29 + private OnListFragmentInteractionListener mListener;
  30 +
  31 + /**
  32 + * Mandatory empty constructor for the fragment manager to instantiate the
  33 + * fragment (e.g. upon screen orientation changes).
  34 + */
  35 + public PersonneFragment() {
  36 + }
  37 +
  38 + public static PersonneFragment newInstance() {
  39 + return new PersonneFragment();
  40 + }
  41 +
  42 + @Override
  43 + public void onCreate(Bundle savedInstanceState) {
  44 + super.onCreate(savedInstanceState);
  45 + }
  46 +
  47 + @Override
  48 + public View onCreateView(LayoutInflater inflater, ViewGroup container,
  49 + Bundle savedInstanceState) {
  50 + View view = inflater.inflate(R.layout.fragment_personne_list, container, false);
  51 +
  52 + // Set the adapter
  53 + Context context = view.getContext();
  54 + RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.personne_list);
  55 + recyclerView.setLayoutManager(new LinearLayoutManager(context));
  56 +
  57 + List<Personne> personneList = new ArrayList<>();
  58 + for (int i = 0;i<150;++i){
  59 + Personne p = new Personne();
  60 + p.setIdCarte("15245698547856");
  61 + p.setLoginPoly("bverhaeg");
  62 + p.setNaissance(new Date(System.currentTimeMillis()));
  63 + p.setSolde(45);
  64 +
  65 + personneList.add(p);
  66 +
  67 + recyclerView.setAdapter(new MyPersonneRecyclerViewAdapter(personneList, mListener, getActivity()));
  68 + }
  69 + return view;
  70 + }
  71 +
  72 +
  73 + @Override
  74 + public void onAttach(Context context) {
  75 + super.onAttach(context);
  76 + if (context instanceof OnListFragmentInteractionListener) {
  77 + mListener = (OnListFragmentInteractionListener) context;
  78 + } else {
  79 + throw new RuntimeException(context.toString()
  80 + + " must implement OnListFragmentInteractionListener");
  81 + }
  82 + }
  83 +
  84 + @Override
  85 + public void onDetach() {
  86 + super.onDetach();
  87 + mListener = null;
  88 + }
  89 +
  90 + @Override
  91 + public void processNFC(String idCardUser) {
  92 +
  93 + }
  94 +
  95 + /**
  96 + * This interface must be implemented by activities that contain this
  97 + * fragment to allow an interaction in this fragment to be communicated
  98 + * to the activity and potentially other fragments contained in that
  99 + * activity.
  100 + * <p/>
  101 + * See the Android Training lesson <a href=
  102 + * "http://developer.android.com/training/basics/fragments/communicating.html"
  103 + * >Communicating with Other Fragments</a> for more information.
  104 + */
  105 + public interface OnListFragmentInteractionListener {
  106 + // TODO: Update argument type and name
  107 + void onListFragmentInteraction(Personne personne);
  108 + void onListFragmentInteractionLong(Personne personne);
  109 + }
  110 +}
app/src/main/java/net/plil/clubinfo/etunicorn/data/Permission.java 0 โ†’ 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +package net.plil.clubinfo.etunicorn.data;
  2 +
  3 +import java.io.Serializable;
  4 +
  5 +/**
  6 + * Created by badetitou on 04/02/2017.
  7 + */
  8 +public class Permission implements Serializable {
  9 + private String nom;
  10 +
  11 + public Permission() {
  12 + }
  13 +
  14 + public String getNom() {
  15 + return nom;
  16 + }
  17 +
  18 + public void setNom(String nom) {
  19 + this.nom = nom;
  20 + }
  21 +}
app/src/main/java/net/plil/clubinfo/etunicorn/data/Role.java 0 โ†’ 100644
@@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
  1 +package net.plil.clubinfo.etunicorn.data;
  2 +
  3 +import java.io.Serializable;
  4 +import java.util.ArrayList;
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by badetitou on 04/02/2017.
  9 + */
  10 +public class Role implements Serializable{
  11 + private List<Permission> permissions = new ArrayList<>();
  12 + private String name;
  13 +
  14 + public Role() {
  15 + }
  16 +
  17 + public String getName() {
  18 + return name;
  19 + }
  20 +
  21 + public void setName(String name) {
  22 + this.name = name;
  23 + }
  24 +
  25 + public List<Permission> getPermissions() {
  26 + return permissions;
  27 + }
  28 +
  29 + public void setPermissions(List<Permission> permissions) {
  30 + this.permissions = permissions;
  31 + }
  32 +}
app/src/main/java/net/plil/clubinfo/etunicorn/utils/VolleyUtils.java
@@ -12,7 +12,7 @@ import com.android.volley.toolbox.Volley; @@ -12,7 +12,7 @@ import com.android.volley.toolbox.Volley;
12 12
13 public class VolleyUtils { 13 public class VolleyUtils {
14 14
15 - private static final String uri = "http://192.168.0.21:8080/"; 15 + private static final String uri = "http://blablapatate";
16 private static final String version = "v1"; 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 ;
app/src/main/res/layout/fragment_consomation_item.xml
@@ -35,6 +35,7 @@ @@ -35,6 +35,7 @@
35 android:id="@+id/consomation_options" 35 android:id="@+id/consomation_options"
36 android:layout_width="wrap_content" 36 android:layout_width="wrap_content"
37 android:layout_height="match_parent" 37 android:layout_height="match_parent"
  38 + android:paddingRight="@dimen/activity_horizontal_margin"
38 android:layout_alignParentRight="true" 39 android:layout_alignParentRight="true"
39 android:layout_alignParentTop="true" 40 android:layout_alignParentTop="true"
40 android:paddingLeft="@dimen/activity_horizontal_margin" 41 android:paddingLeft="@dimen/activity_horizontal_margin"
app/src/main/res/layout/fragment_crediter.xml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 - tools:context="net.plil.clubinfo.etunicorn.app.Crediter"> 5 + tools:context="net.plil.clubinfo.etunicorn.app.credit.Crediter">
6 6
7 <EditText 7 <EditText
8 android:inputType="numberSigned|numberDecimal" 8 android:inputType="numberSigned|numberDecimal"
app/src/main/res/layout/fragment_debiter.xml
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 xmlns:tools="http://schemas.android.com/tools" 2 xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="match_parent" 3 android:layout_width="match_parent"
4 android:layout_height="match_parent" 4 android:layout_height="match_parent"
5 - tools:context="net.plil.clubinfo.etunicorn.app.Debiter"> 5 + tools:context="net.plil.clubinfo.etunicorn.app.debit.Debiter">
6 6
7 7
8 <EditText 8 <EditText
app/src/main/res/layout/fragment_event.xml
@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
26 android:layout_width="wrap_content" 26 android:layout_width="wrap_content"
27 android:layout_height="match_parent" 27 android:layout_height="match_parent"
28 android:layout_alignParentRight="true" 28 android:layout_alignParentRight="true"
  29 + android:paddingRight="@dimen/activity_horizontal_margin"
29 android:layout_alignParentTop="true" 30 android:layout_alignParentTop="true"
30 android:paddingLeft="@dimen/activity_horizontal_margin" 31 android:paddingLeft="@dimen/activity_horizontal_margin"
31 android:text="&#8942;" 32 android:text="&#8942;"
app/src/main/res/layout/fragment_event_list.xml
@@ -8,7 +8,7 @@ android:layout_height=&quot;match_parent&quot;&gt; @@ -8,7 +8,7 @@ android:layout_height=&quot;match_parent&quot;&gt;
8 8
9 <android.support.v7.widget.RecyclerView 9 <android.support.v7.widget.RecyclerView
10 android:id="@+id/event_list" 10 android:id="@+id/event_list"
11 - android:name="net.plil.clubinfo.etunicorn.app.Event.EventFragment" 11 + android:name="net.plil.clubinfo.etunicorn.app.event.EventFragment"
12 android:layout_width="match_parent" 12 android:layout_width="match_parent"
13 android:layout_height="match_parent" 13 android:layout_height="match_parent"
14 android:layout_marginLeft="16dp" 14 android:layout_marginLeft="16dp"