Commit 0ecfc67f90205e32498dae73ab1d9908f28f3ba0

Authored by badetitou
1 parent 0730f2b3

Modify Consommation

app/src/main/java/net/plil/clubinfo/etunicorn/app/Crediter.java
@@ -22,19 +22,8 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; @@ -22,19 +22,8 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
22 import org.json.JSONException; 22 import org.json.JSONException;
23 import org.json.JSONObject; 23 import org.json.JSONObject;
24 24
25 -/**  
26 - * A simple {@link Fragment} subclass.  
27 - * Activities that contain this fragment must implement the  
28 - * {@link Crediter.OnFragmentInteractionListener} interface  
29 - * to handle interaction events.  
30 - * Use the {@link Crediter#newInstance} factory method to  
31 - * create an instance of this fragment.  
32 - */  
33 public class Crediter extends FragmentNFC { 25 public class Crediter extends FragmentNFC {
34 26
35 -  
36 - private OnFragmentInteractionListener mListener;  
37 -  
38 private EditText mMoneyEditText; 27 private EditText mMoneyEditText;
39 private ProgressBar mProgressBar; 28 private ProgressBar mProgressBar;
40 29
@@ -66,18 +55,11 @@ public class Crediter extends FragmentNFC { @@ -66,18 +55,11 @@ public class Crediter extends FragmentNFC {
66 @Override 55 @Override
67 public void onAttach(Context context) { 56 public void onAttach(Context context) {
68 super.onAttach(context); 57 super.onAttach(context);
69 - if (context instanceof OnFragmentInteractionListener) {  
70 - mListener = (OnFragmentInteractionListener) context;  
71 - } else {  
72 - throw new RuntimeException(context.toString()  
73 - + " must implement OnFragmentInteractionListener");  
74 - }  
75 } 58 }
76 59
77 @Override 60 @Override
78 public void onDetach() { 61 public void onDetach() {
79 super.onDetach(); 62 super.onDetach();
80 - mListener = null;  
81 } 63 }
82 64
83 @Override 65 @Override
@@ -106,19 +88,4 @@ public class Crediter extends FragmentNFC { @@ -106,19 +88,4 @@ public class Crediter extends FragmentNFC {
106 88
107 VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); 89 VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
108 } 90 }
109 -  
110 -  
111 - /**  
112 - * This interface must be implemented by activities that contain this  
113 - * fragment to allow an interaction in this fragment to be communicated  
114 - * to the activity and potentially other fragments contained in that  
115 - * activity.  
116 - * <p>  
117 - * See the Android Training lesson <a href=  
118 - * "http://developer.android.com/training/basics/fragments/communicating.html"  
119 - * >Communicating with Other Fragments</a> for more information.  
120 - */  
121 - public interface OnFragmentInteractionListener {  
122 - void onFragmentInteraction(Uri uri);  
123 - }  
124 } 91 }
app/src/main/java/net/plil/clubinfo/etunicorn/app/Debiter.java
@@ -27,21 +27,12 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; @@ -27,21 +27,12 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils;
27 import org.json.JSONException; 27 import org.json.JSONException;
28 import org.json.JSONObject; 28 import org.json.JSONObject;
29 29
30 -/**  
31 - * A simple {@link Fragment} subclass.  
32 - * Activities that contain this fragment must implement the  
33 - * {@link Debiter.OnFragmentInteractionListener} interface  
34 - * to handle interaction events.  
35 - * Use the {@link Debiter#newInstance} factory method to  
36 - * create an instance of this fragment.  
37 - */  
38 public class Debiter extends FragmentNFC { 30 public class Debiter extends FragmentNFC {
39 31
40 32
41 private EditText mMoneyEditText; 33 private EditText mMoneyEditText;
42 private ProgressBar mProgressBar; 34 private ProgressBar mProgressBar;
43 35
44 - private OnFragmentInteractionListener mListener;  
45 36
46 public Debiter() { 37 public Debiter() {
47 // Required empty public constructor 38 // Required empty public constructor
@@ -71,18 +62,11 @@ public class Debiter extends FragmentNFC { @@ -71,18 +62,11 @@ public class Debiter extends FragmentNFC {
71 @Override 62 @Override
72 public void onAttach(Context context) { 63 public void onAttach(Context context) {
73 super.onAttach(context); 64 super.onAttach(context);
74 - if (context instanceof OnFragmentInteractionListener) {  
75 - mListener = (OnFragmentInteractionListener) context;  
76 - } else {  
77 - throw new RuntimeException(context.toString()  
78 - + " must implement OnFragmentInteractionListener");  
79 - }  
80 } 65 }
81 66
82 @Override 67 @Override
83 public void onDetach() { 68 public void onDetach() {
84 super.onDetach(); 69 super.onDetach();
85 - mListener = null;  
86 } 70 }
87 71
88 @Override 72 @Override
@@ -111,19 +95,4 @@ public class Debiter extends FragmentNFC { @@ -111,19 +95,4 @@ public class Debiter extends FragmentNFC {
111 95
112 VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); 96 VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
113 } 97 }
114 -  
115 - /**  
116 - * This interface must be implemented by activities that contain this  
117 - * fragment to allow an interaction in this fragment to be communicated  
118 - * to the activity and potentially other fragments contained in that  
119 - * activity.  
120 - * <p>  
121 - * See the Android Training lesson <a href=  
122 - * "http://developer.android.com/training/basics/fragments/communicating.html"  
123 - * >Communicating with Other Fragments</a> for more information.  
124 - */  
125 - public interface OnFragmentInteractionListener {  
126 - // TODO: Update argument type and name  
127 - void onFragmentInteraction(Uri uri);  
128 - }  
129 } 98 }
app/src/main/java/net/plil/clubinfo/etunicorn/app/MainActivity.java
@@ -5,6 +5,7 @@ import android.content.Intent; @@ -5,6 +5,7 @@ import android.content.Intent;
5 import android.net.Uri; 5 import android.net.Uri;
6 import android.nfc.NfcAdapter; 6 import android.nfc.NfcAdapter;
7 import android.os.Bundle; 7 import android.os.Bundle;
  8 +import android.support.design.widget.AppBarLayout;
8 import android.support.design.widget.TabLayout; 9 import android.support.design.widget.TabLayout;
9 import android.support.v4.app.Fragment; 10 import android.support.v4.app.Fragment;
10 import android.support.v4.app.FragmentManager; 11 import android.support.v4.app.FragmentManager;
@@ -14,14 +15,19 @@ import android.support.v7.app.AppCompatActivity; @@ -14,14 +15,19 @@ import android.support.v7.app.AppCompatActivity;
14 import android.support.v7.widget.Toolbar; 15 import android.support.v7.widget.Toolbar;
15 import android.view.Menu; 16 import android.view.Menu;
16 import android.view.MenuItem; 17 import android.view.MenuItem;
  18 +import android.view.Window;
  19 +import android.view.WindowManager;
17 20
18 import net.plil.clubinfo.etunicorn.R; 21 import net.plil.clubinfo.etunicorn.R;
19 import net.plil.clubinfo.etunicorn.app.consommation.FragmentConsommation; 22 import net.plil.clubinfo.etunicorn.app.consommation.FragmentConsommation;
20 import net.plil.clubinfo.etunicorn.app.consommation.PaiementConsommation; 23 import net.plil.clubinfo.etunicorn.app.consommation.PaiementConsommation;
21 import net.plil.clubinfo.etunicorn.data.Consommation; 24 import net.plil.clubinfo.etunicorn.data.Consommation;
22 25
  26 +import java.util.ArrayList;
  27 +import java.util.List;
23 28
24 -public class MainActivity extends AppCompatActivity implements Crediter.OnFragmentInteractionListener, Debiter.OnFragmentInteractionListener, FragmentConsommation.OnListFragmentInteractionListener{ 29 +
  30 +public class MainActivity extends AppCompatActivity implements FragmentConsommation.OnListFragmentInteractionListener{
25 31
26 /** 32 /**
27 * The {@link android.support.v4.view.PagerAdapter} that will provide 33 * The {@link android.support.v4.view.PagerAdapter} that will provide
@@ -37,7 +43,10 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme @@ -37,7 +43,10 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme
37 * The {@link ViewPager} that will host the section contents. 43 * The {@link ViewPager} that will host the section contents.
38 */ 44 */
39 private ViewPager mViewPager; 45 private ViewPager mViewPager;
  46 + private Toolbar toolbar;
  47 + private AppBarLayout appBarLayout;
40 48
  49 + private List<Consommation> consommationsToModify = new ArrayList<>();
41 50
42 NfcAdapter mAdapter; 51 NfcAdapter mAdapter;
43 PendingIntent mPendingIntent; 52 PendingIntent mPendingIntent;
@@ -47,8 +56,11 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme @@ -47,8 +56,11 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme
47 super.onCreate(savedInstanceState); 56 super.onCreate(savedInstanceState);
48 setContentView(R.layout.activity_main); 57 setContentView(R.layout.activity_main);
49 58
50 - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 59 + appBarLayout = (AppBarLayout) findViewById(R.id.appbar);
  60 +
  61 + toolbar = (Toolbar) findViewById(R.id.toolbar);
51 setSupportActionBar(toolbar); 62 setSupportActionBar(toolbar);
  63 +
52 // Create the adapter that will return a fragment for each of the three 64 // Create the adapter that will return a fragment for each of the three
53 // primary sections of the activity. 65 // primary sections of the activity.
54 mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); 66 mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
@@ -116,11 +128,6 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme @@ -116,11 +128,6 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme
116 } 128 }
117 } 129 }
118 130
119 - @Override  
120 - public void onFragmentInteraction(Uri uri) {  
121 -  
122 - }  
123 -  
124 131
125 @Override 132 @Override
126 public void onListFragmentInteraction(Consommation item) { 133 public void onListFragmentInteraction(Consommation item) {
@@ -128,6 +135,11 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme @@ -128,6 +135,11 @@ public class MainActivity extends AppCompatActivity implements Crediter.OnFragme
128 paiementConsommation.show(getSupportFragmentManager(), "paiementConsommation"); 135 paiementConsommation.show(getSupportFragmentManager(), "paiementConsommation");
129 } 136 }
130 137
  138 + @Override
  139 + public void onListFragmentInteractionLong(Consommation item) {
  140 +
  141 + }
  142 +
131 /** 143 /**
132 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to 144 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
133 * one of the sections/tabs/pages. 145 * one of the sections/tabs/pages.
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/ConsommationRecyclerViewAdapter.java
1 package net.plil.clubinfo.etunicorn.app.consommation; 1 package net.plil.clubinfo.etunicorn.app.consommation;
2 2
  3 +import android.app.Activity;
  4 +import android.content.Context;
  5 +import android.support.v7.app.AppCompatActivity;
  6 +import android.support.v7.widget.PopupMenu;
3 import android.support.v7.widget.RecyclerView; 7 import android.support.v7.widget.RecyclerView;
  8 +import android.view.ContextMenu;
4 import android.view.LayoutInflater; 9 import android.view.LayoutInflater;
  10 +import android.view.MenuItem;
5 import android.view.View; 11 import android.view.View;
6 import android.view.ViewGroup; 12 import android.view.ViewGroup;
7 import android.widget.TextView; 13 import android.widget.TextView;
@@ -17,10 +23,12 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom @@ -17,10 +23,12 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom
17 23
18 private final List<Consommation> mValues; 24 private final List<Consommation> mValues;
19 private final FragmentConsommation.OnListFragmentInteractionListener mListener; 25 private final FragmentConsommation.OnListFragmentInteractionListener mListener;
  26 + private final Context context;
20 27
21 - public ConsommationRecyclerViewAdapter(List<Consommation> items, FragmentConsommation.OnListFragmentInteractionListener listener) { 28 + public ConsommationRecyclerViewAdapter(List<Consommation> items, FragmentConsommation.OnListFragmentInteractionListener listener, Context context) {
22 mValues = items; 29 mValues = items;
23 mListener = listener; 30 mListener = listener;
  31 + this.context = context;
24 } 32 }
25 33
26 @Override 34 @Override
@@ -50,10 +58,37 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom @@ -50,10 +58,37 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom
50 holder.mView.setOnLongClickListener(new View.OnLongClickListener() { 58 holder.mView.setOnLongClickListener(new View.OnLongClickListener() {
51 @Override 59 @Override
52 public boolean onLongClick(View v) { 60 public boolean onLongClick(View v) {
53 - holder.mView.setSelected(!holder.mView.isSelected()); 61 + mListener.onListFragmentInteractionLong(holder.mItem);
54 return true; 62 return true;
55 } 63 }
56 }); 64 });
  65 +
  66 + holder.mButtonMenu.setOnClickListener(new View.OnClickListener() {
  67 + @Override
  68 + public void onClick(View v) {
  69 + final PopupMenu popup = new PopupMenu(v.getContext(), holder.mButtonMenu);
  70 + //inflating menu from xml resource
  71 + popup.inflate(R.menu.option_list);
  72 + //adding click listener
  73 + popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
  74 + @Override
  75 + public boolean onMenuItemClick(MenuItem item) {
  76 + switch (item.getItemId()) {
  77 + case R.id.delete:
  78 + DeleteConsommation paiementConsommation = DeleteConsommation.newInstance(holder.mItem);
  79 + paiementConsommation.show(((AppCompatActivity) context).getSupportFragmentManager(), "deleteConsommation");
  80 + break;
  81 + case R.id.modify:
  82 + //handle menu2 click
  83 + break;
  84 + }
  85 + return false;
  86 + }
  87 + });
  88 + //displaying the popup
  89 + popup.show();
  90 + }
  91 + });
57 } 92 }
58 93
59 @Override 94 @Override
@@ -66,6 +101,7 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom @@ -66,6 +101,7 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom
66 public final TextView mIdView; 101 public final TextView mIdView;
67 public final TextView mContentView; 102 public final TextView mContentView;
68 public final TextView mPriceView; 103 public final TextView mPriceView;
  104 + public final TextView mButtonMenu;
69 public Consommation mItem; 105 public Consommation mItem;
70 106
71 public ViewHolder(View view) { 107 public ViewHolder(View view) {
@@ -74,6 +110,7 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom @@ -74,6 +110,7 @@ public class ConsommationRecyclerViewAdapter extends RecyclerView.Adapter&lt;Consom
74 mIdView = (TextView) view.findViewById(R.id.consomation_id); 110 mIdView = (TextView) view.findViewById(R.id.consomation_id);
75 mContentView = (TextView) view.findViewById(R.id.consomation_name); 111 mContentView = (TextView) view.findViewById(R.id.consomation_name);
76 mPriceView = (TextView) view.findViewById(R.id.consomation_price); 112 mPriceView = (TextView) view.findViewById(R.id.consomation_price);
  113 + mButtonMenu = (TextView) view.findViewById(R.id.consomation_options);
77 } 114 }
78 115
79 @Override 116 @Override
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/DeleteConsommation.java 0 → 100644
@@ -0,0 +1,99 @@ @@ -0,0 +1,99 @@
  1 +package net.plil.clubinfo.etunicorn.app.consommation;
  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.TextView;
  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.Consommation;
  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 DeleteConsommation extends DialogFragment {
  30 +
  31 + ProgressBar mProgressBar;
  32 +
  33 + public DeleteConsommation(){}
  34 +
  35 + /**
  36 + * Create a new instance of MyDialogFragment, providing "num"
  37 + * as an argument.
  38 + */
  39 + public static DeleteConsommation newInstance(Consommation consommation) {
  40 + DeleteConsommation f = new DeleteConsommation();
  41 +
  42 + // Supply num input as an argument.
  43 + Bundle args = new Bundle();
  44 + args.putSerializable("consommation", consommation);
  45 + f.setArguments(args);
  46 +
  47 + return f;
  48 + }
  49 +
  50 +
  51 + @Override
  52 + public Dialog onCreateDialog(Bundle savedInstanceState) {
  53 + // Use the Builder class for convenient dialog construction
  54 + LayoutInflater inflater = getActivity().getLayoutInflater();
  55 + View view = inflater.inflate(R.layout.fragment_delete_consomation, null);
  56 +
  57 + mProgressBar = (ProgressBar) view.findViewById(R.id.delete_consommation_progress_bar);
  58 + final Consommation consommation = (Consommation) getArguments().getSerializable("consommation");
  59 +
  60 +
  61 + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
  62 + builder
  63 + .setTitle(R.string.verif_delete_consomation)
  64 + .setView(view)
  65 + .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {
  66 + @Override
  67 + public void onClick(DialogInterface dialog, int which) {
  68 + mProgressBar.setVisibility(View.VISIBLE);
  69 +
  70 + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation(), null, new Response.Listener<JSONObject>() {
  71 + @Override
  72 + public void onResponse(JSONObject response) {
  73 + mProgressBar.setVisibility(View.GONE);
  74 + Toast.makeText(getContext(), R.string.delete_done, Toast.LENGTH_LONG).show();
  75 + dismiss();
  76 + }
  77 + }, new Response.ErrorListener() {
  78 + @Override
  79 + public void onErrorResponse(VolleyError error) {
  80 + mProgressBar.setVisibility(View.GONE);
  81 + Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show();
  82 + dismiss();
  83 + }
  84 + }
  85 + );
  86 +
  87 + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest);
  88 + }
  89 + })
  90 + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
  91 + public void onClick(DialogInterface dialog, int id) {
  92 +
  93 + }
  94 + });
  95 + return builder.create();
  96 + }
  97 +
  98 +
  99 +}
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/FragmentConsommation.java
@@ -10,18 +10,9 @@ import android.view.View; @@ -10,18 +10,9 @@ import android.view.View;
10 import android.view.ViewGroup; 10 import android.view.ViewGroup;
11 import android.widget.Toast; 11 import android.widget.Toast;
12 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; 13 import net.plil.clubinfo.etunicorn.R;
19 import net.plil.clubinfo.etunicorn.app.FragmentNFC; 14 import net.plil.clubinfo.etunicorn.app.FragmentNFC;
20 import net.plil.clubinfo.etunicorn.data.Consommation; 15 import net.plil.clubinfo.etunicorn.data.Consommation;
21 -import net.plil.clubinfo.etunicorn.utils.VolleyUtils;  
22 -  
23 -import org.json.JSONException;  
24 -import org.json.JSONObject;  
25 16
26 import java.util.ArrayList; 17 import java.util.ArrayList;
27 import java.util.List; 18 import java.util.List;
@@ -75,7 +66,7 @@ public class FragmentConsommation extends FragmentNFC { @@ -75,7 +66,7 @@ public class FragmentConsommation extends FragmentNFC {
75 c1.setPrix(42.407); 66 c1.setPrix(42.407);
76 consommationList.add(c1); 67 consommationList.add(c1);
77 } 68 }
78 - recyclerView.setAdapter(new ConsommationRecyclerViewAdapter(consommationList, mListener)); 69 + recyclerView.setAdapter(new ConsommationRecyclerViewAdapter(consommationList, mListener, this.getActivity()));
79 70
80 FloatingActionButton fAB = (FloatingActionButton) view.findViewById(R.id.consomation_add); 71 FloatingActionButton fAB = (FloatingActionButton) view.findViewById(R.id.consomation_add);
81 fAB.setOnClickListener(new View.OnClickListener() { 72 fAB.setOnClickListener(new View.OnClickListener() {
@@ -112,7 +103,7 @@ public class FragmentConsommation extends FragmentNFC { @@ -112,7 +103,7 @@ public class FragmentConsommation extends FragmentNFC {
112 103
113 PaiementConsommation paiementConsommation = (PaiementConsommation) getFragmentManager().findFragmentByTag("paiementConsommation"); 104 PaiementConsommation paiementConsommation = (PaiementConsommation) getFragmentManager().findFragmentByTag("paiementConsommation");
114 if (paiementConsommation == null){ 105 if (paiementConsommation == null){
115 - Toast.makeText(getContext(), R.string.payment_consomation_alert_no_selection, Toast.LENGTH_LONG).show(); 106 + Toast.makeText(getContext(), R.string.payment_consumable_alert_no_selection, Toast.LENGTH_LONG).show();
116 } 107 }
117 else { 108 else {
118 paiementConsommation.processNFC(); 109 paiementConsommation.processNFC();
@@ -131,5 +122,6 @@ public class FragmentConsommation extends FragmentNFC { @@ -131,5 +122,6 @@ public class FragmentConsommation extends FragmentNFC {
131 */ 122 */
132 public interface OnListFragmentInteractionListener { 123 public interface OnListFragmentInteractionListener {
133 void onListFragmentInteraction(Consommation item); 124 void onListFragmentInteraction(Consommation item);
  125 + void onListFragmentInteractionLong(Consommation item);
134 } 126 }
135 } 127 }
app/src/main/res/drawable/selected_row.xml deleted
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>  
2 -<selector xmlns:android="http://schemas.android.com/apk/res/android" >  
3 - <item android:state_selected="true">  
4 - <color android:color="#EEEEEE"/>  
5 - </item>  
6 - <item android:state_selected="false">  
7 - <color android:color="#FFFFFF"/>  
8 - </item>  
9 -</selector>  
10 \ No newline at end of file 0 \ No newline at end of file
app/src/main/res/layout/activity_main.xml
@@ -21,6 +21,7 @@ @@ -21,6 +21,7 @@
21 android:background="?attr/colorPrimary" 21 android:background="?attr/colorPrimary"
22 app:layout_scrollFlags="enterAlways" 22 app:layout_scrollFlags="enterAlways"
23 app:popupTheme="@style/AppTheme.PopupOverlay" 23 app:popupTheme="@style/AppTheme.PopupOverlay"
  24 + android:minHeight="?attr/actionBarSize"
24 android:layout_height="64dp"> 25 android:layout_height="64dp">
25 26
26 </android.support.v7.widget.Toolbar> 27 </android.support.v7.widget.Toolbar>
app/src/main/res/layout/fragment_consomation_item.xml
1 <?xml version="1.0" encoding="utf-8"?> 1 <?xml version="1.0" encoding="utf-8"?>
2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3 + xmlns:tools="http://schemas.android.com/tools"
3 android:layout_width="wrap_content" 4 android:layout_width="wrap_content"
4 android:layout_height="wrap_content" 5 android:layout_height="wrap_content"
5 android:orientation="horizontal" 6 android:orientation="horizontal"
6 - android:foreground="?attr/selectableItemBackground"  
7 - android:background="@drawable/selected_row"> 7 + android:foreground="?attr/selectableItemBackground">
8 8
9 <TextView 9 <TextView
10 android:id="@+id/consomation_id" 10 android:id="@+id/consomation_id"
@@ -19,7 +19,8 @@ @@ -19,7 +19,8 @@
19 android:layout_height="wrap_content" 19 android:layout_height="wrap_content"
20 android:layout_margin="@dimen/text_margin" 20 android:layout_margin="@dimen/text_margin"
21 android:textAppearance="?attr/textAppearanceListItem" 21 android:textAppearance="?attr/textAppearanceListItem"
22 - android:layout_toRightOf="@id/consomation_id"/> 22 + android:layout_toRightOf="@id/consomation_id"
  23 + tools:ignore="RtlHardcoded" />
23 24
24 <TextView 25 <TextView
25 android:id="@+id/consomation_price" 26 android:id="@+id/consomation_price"
@@ -27,6 +28,20 @@ @@ -27,6 +28,20 @@
27 android:layout_height="wrap_content" 28 android:layout_height="wrap_content"
28 android:layout_margin="@dimen/text_margin" 29 android:layout_margin="@dimen/text_margin"
29 android:textAppearance="?attr/textAppearanceListItem" 30 android:textAppearance="?attr/textAppearanceListItem"
30 - android:layout_alignParentRight="true"/> 31 + android:layout_toRightOf="@id/consomation_name"
  32 + tools:ignore="RelativeOverlap,RtlHardcoded" />
  33 +
  34 + <TextView
  35 + android:id="@+id/consomation_options"
  36 + android:layout_width="wrap_content"
  37 + android:layout_height="match_parent"
  38 + android:layout_alignParentRight="true"
  39 + android:layout_alignParentTop="true"
  40 + android:paddingLeft="@dimen/activity_horizontal_margin"
  41 + android:text="&#8942;"
  42 + android:textAppearance="?android:textAppearanceLarge"
  43 + tools:ignore="RtlHardcoded,RtlSymmetry"
  44 + android:textStyle="normal|bold"
  45 + android:translationY="10dp" />
31 46
32 </RelativeLayout> 47 </RelativeLayout>
app/src/main/res/layout/fragment_delete_consomation.xml 0 → 100644
@@ -0,0 +1,17 @@ @@ -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_consommation_progress_bar"
  14 + android:visibility="gone"
  15 + android:layout_gravity="center" />
  16 +
  17 +</LinearLayout>
app/src/main/res/menu/menu_main.xml
@@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
2 xmlns:app="http://schemas.android.com/apk/res-auto" 2 xmlns:app="http://schemas.android.com/apk/res-auto"
3 xmlns:tools="http://schemas.android.com/tools" 3 xmlns:tools="http://schemas.android.com/tools"
4 tools:context="net.plil.clubinfo.etunicorn.app.MainActivity"> 4 tools:context="net.plil.clubinfo.etunicorn.app.MainActivity">
  5 +
  6 +
5 <item 7 <item
6 android:id="@+id/action_settings" 8 android:id="@+id/action_settings"
7 android:orderInCategory="100" 9 android:orderInCategory="100"
app/src/main/res/menu/option_list.xml 0 → 100644
@@ -0,0 +1,8 @@ @@ -0,0 +1,8 @@
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<menu xmlns:app="http://schemas.android.com/apk/res-auto"
  3 + xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <item android:title="@string/modify"
  5 + android:id="@+id/modify"/>
  6 + <item android:title="@string/delete"
  7 + android:id="@+id/delete"/>
  8 +</menu>
0 \ No newline at end of file 9 \ No newline at end of file
app/src/main/res/values-fr/strings.xml
@@ -16,4 +16,8 @@ @@ -16,4 +16,8 @@
16 <string name="valid">OK</string> 16 <string name="valid">OK</string>
17 <string name="title_activity_main">Etunicorn - Bonjour</string> 17 <string name="title_activity_main">Etunicorn - Bonjour</string>
18 <string name="payment_consumable">Paiement d\'un Consommable</string> 18 <string name="payment_consumable">Paiement d\'un Consommable</string>
  19 + <string name="payment_refused">Paiement accepté</string>
  20 + <string name="payment_done">Paiement refusé</string>
  21 + <string name="payment_consumable_alert_no_selection">Selectionné un produit avant de payer</string>
  22 + <string name="action_delete">Supprimer</string>
19 </resources> 23 </resources>
20 \ No newline at end of file 24 \ No newline at end of file
app/src/main/res/values/colors.xml
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 <color name="colorPrimary">#F44336</color> 3 <color name="colorPrimary">#F44336</color>
4 <color name="colorPrimaryDark">#C62828</color> 4 <color name="colorPrimaryDark">#C62828</color>
5 <color name="colorAccent">#2196F3</color> 5 <color name="colorAccent">#2196F3</color>
  6 + <color name="colorAccentDark">#1565C0</color>
6 7
7 <color name="pressed_color">#4d90fe</color> 8 <color name="pressed_color">#4d90fe</color>
8 <color name="default_color">#ffffff</color> 9 <color name="default_color">#ffffff</color>
app/src/main/res/values/strings.xml
@@ -18,7 +18,16 @@ @@ -18,7 +18,16 @@
18 <string name="create_consumable_price">Price</string> 18 <string name="create_consumable_price">Price</string>
19 <string name="title_activity_main">Etunicorn - Hello</string> 19 <string name="title_activity_main">Etunicorn - Hello</string>
20 <string name="payment_consumable">Consumable Payment</string> 20 <string name="payment_consumable">Consumable Payment</string>
21 - <string name="payment_consomation_alert_no_selection">Select a product before paying</string> 21 + <string name="payment_consumable_alert_no_selection">Select a product before paying</string>
22 <string name="payment_done">Payment done</string> 22 <string name="payment_done">Payment done</string>
23 <string name="payment_refused">Payment refused</string> 23 <string name="payment_refused">Payment refused</string>
  24 + <string name="action_delete">Delete</string>
  25 + <string name="modify">Modifier</string>
  26 + <string name="delete">Delete</string>
  27 +
  28 + <!-- TODO: Remove or change this placeholder text -->
  29 + <string name="hello_blank_fragment">Hello blank fragment</string>
  30 + <string name="verif_delete_consomation">Are you sure ?</string>
  31 + <string name="delete_done">Delete done</string>
  32 + <string name="delete_refused">Delete refused</string>
24 </resources> 33 </resources>