Commit b7f2b9a4fcfd8c70b0f77e058b409f558287973e
1 parent
d0df00ab
Authorization for all
Showing
10 changed files
with
115 additions
and
11 deletions
Show diff stats
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/CreateEvent.java
... | ... | @@ -18,12 +18,14 @@ import android.widget.ProgressBar; |
18 | 18 | import android.widget.Spinner; |
19 | 19 | import android.widget.Toast; |
20 | 20 | |
21 | +import com.android.volley.AuthFailureError; | |
21 | 22 | import com.android.volley.Request; |
22 | 23 | import com.android.volley.Response; |
23 | 24 | import com.android.volley.VolleyError; |
24 | 25 | import com.android.volley.toolbox.JsonObjectRequest; |
25 | 26 | |
26 | 27 | import net.plil.clubinfo.etunicorn.R; |
28 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
27 | 29 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
28 | 30 | |
29 | 31 | import org.json.JSONException; |
... | ... | @@ -31,7 +33,9 @@ import org.json.JSONObject; |
31 | 33 | |
32 | 34 | import java.text.SimpleDateFormat; |
33 | 35 | import java.util.Calendar; |
36 | +import java.util.HashMap; | |
34 | 37 | import java.util.Locale; |
38 | +import java.util.Map; | |
35 | 39 | |
36 | 40 | |
37 | 41 | public class CreateEvent extends DialogFragment { |
... | ... | @@ -145,7 +149,13 @@ public class CreateEvent extends DialogFragment { |
145 | 149 | Toast.makeText(getContext(), error.getMessage(), Toast.LENGTH_LONG).show(); |
146 | 150 | } |
147 | 151 | } |
148 | - ); | |
152 | + ){ | |
153 | + @Override | |
154 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
155 | + Map<String, String> headers = new HashMap<String, String>(); | |
156 | + headers.put("Authorization", MainActivity.session.getToken()); | |
157 | + return headers; | |
158 | + }}; | |
149 | 159 | jsonObjectRequest.setTag(CreateEvent.class); |
150 | 160 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
151 | 161 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/DeleteEvent.java
... | ... | @@ -11,18 +11,23 @@ import android.widget.Button; |
11 | 11 | import android.widget.ProgressBar; |
12 | 12 | import android.widget.Toast; |
13 | 13 | |
14 | +import com.android.volley.AuthFailureError; | |
14 | 15 | import com.android.volley.Request; |
15 | 16 | import com.android.volley.Response; |
16 | 17 | import com.android.volley.VolleyError; |
17 | 18 | import com.android.volley.toolbox.JsonObjectRequest; |
18 | 19 | |
19 | 20 | import net.plil.clubinfo.etunicorn.R; |
21 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
20 | 22 | import net.plil.clubinfo.etunicorn.data.Consommation; |
21 | 23 | import net.plil.clubinfo.etunicorn.data.Event; |
22 | 24 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
23 | 25 | |
24 | 26 | import org.json.JSONObject; |
25 | 27 | |
28 | +import java.util.HashMap; | |
29 | +import java.util.Map; | |
30 | + | |
26 | 31 | |
27 | 32 | public class DeleteEvent extends DialogFragment { |
28 | 33 | |
... | ... | @@ -89,7 +94,13 @@ public class DeleteEvent extends DialogFragment { |
89 | 94 | Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show(); |
90 | 95 | } |
91 | 96 | } |
92 | - ); | |
97 | + ){ | |
98 | + @Override | |
99 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
100 | + Map<String, String> headers = new HashMap<String, String>(); | |
101 | + headers.put("Authorization", MainActivity.session.getToken()); | |
102 | + return headers; | |
103 | + }}; | |
93 | 104 | jsonObjectRequest.setTag(DeleteEvent.class); |
94 | 105 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
95 | 106 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/ModifyEvent.java
... | ... | @@ -18,12 +18,14 @@ import android.widget.ProgressBar; |
18 | 18 | import android.widget.Spinner; |
19 | 19 | import android.widget.Toast; |
20 | 20 | |
21 | +import com.android.volley.AuthFailureError; | |
21 | 22 | import com.android.volley.Request; |
22 | 23 | import com.android.volley.Response; |
23 | 24 | import com.android.volley.VolleyError; |
24 | 25 | import com.android.volley.toolbox.JsonObjectRequest; |
25 | 26 | |
26 | 27 | import net.plil.clubinfo.etunicorn.R; |
28 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
27 | 29 | import net.plil.clubinfo.etunicorn.data.Event; |
28 | 30 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
29 | 31 | |
... | ... | @@ -32,7 +34,9 @@ import org.json.JSONObject; |
32 | 34 | |
33 | 35 | import java.text.SimpleDateFormat; |
34 | 36 | import java.util.Calendar; |
37 | +import java.util.HashMap; | |
35 | 38 | import java.util.Locale; |
39 | +import java.util.Map; | |
36 | 40 | |
37 | 41 | |
38 | 42 | public class ModifyEvent extends DialogFragment { |
... | ... | @@ -149,7 +153,13 @@ public class ModifyEvent extends DialogFragment { |
149 | 153 | |
150 | 154 | } |
151 | 155 | } |
152 | - ); | |
156 | + ){ | |
157 | + @Override | |
158 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
159 | + Map<String, String> headers = new HashMap<String, String>(); | |
160 | + headers.put("Authorization", MainActivity.session.getToken()); | |
161 | + return headers; | |
162 | + }}; | |
153 | 163 | jsonObjectRequest.setTag(ModifyEvent.class); |
154 | 164 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
155 | 165 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/Event/PaiementEvent.java
... | ... | @@ -11,12 +11,14 @@ import android.widget.ProgressBar; |
11 | 11 | import android.widget.TextView; |
12 | 12 | import android.widget.Toast; |
13 | 13 | |
14 | +import com.android.volley.AuthFailureError; | |
14 | 15 | import com.android.volley.Request; |
15 | 16 | import com.android.volley.Response; |
16 | 17 | import com.android.volley.VolleyError; |
17 | 18 | import com.android.volley.toolbox.JsonObjectRequest; |
18 | 19 | |
19 | 20 | import net.plil.clubinfo.etunicorn.R; |
21 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
20 | 22 | import net.plil.clubinfo.etunicorn.app.NFCSupport; |
21 | 23 | import net.plil.clubinfo.etunicorn.data.Event; |
22 | 24 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
... | ... | @@ -24,7 +26,9 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
24 | 26 | import org.json.JSONException; |
25 | 27 | import org.json.JSONObject; |
26 | 28 | |
29 | +import java.util.HashMap; | |
27 | 30 | import java.util.Locale; |
31 | +import java.util.Map; | |
28 | 32 | |
29 | 33 | |
30 | 34 | public class PaiementEvent extends DialogFragment implements NFCSupport { |
... | ... | @@ -99,7 +103,13 @@ public class PaiementEvent extends DialogFragment implements NFCSupport { |
99 | 103 | Toast.makeText(getContext(), R.string.payment_refused, Toast.LENGTH_LONG).show(); |
100 | 104 | } |
101 | 105 | } |
102 | - ); | |
106 | + ){ | |
107 | + @Override | |
108 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
109 | + Map<String, String> headers = new HashMap<String, String>(); | |
110 | + headers.put("Authorization", MainActivity.session.getToken()); | |
111 | + return headers; | |
112 | + }}; | |
103 | 113 | |
104 | 114 | jsonObjectRequest.setTag(PaiementEvent.class); |
105 | 115 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/CreateConsommation.java
... | ... | @@ -14,17 +14,22 @@ import android.widget.Button; |
14 | 14 | import android.widget.EditText; |
15 | 15 | import android.widget.ProgressBar; |
16 | 16 | |
17 | +import com.android.volley.AuthFailureError; | |
17 | 18 | import com.android.volley.Request; |
18 | 19 | import com.android.volley.Response; |
19 | 20 | import com.android.volley.VolleyError; |
20 | 21 | import com.android.volley.toolbox.JsonObjectRequest; |
21 | 22 | |
22 | 23 | import net.plil.clubinfo.etunicorn.R; |
24 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
23 | 25 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
24 | 26 | |
25 | 27 | import org.json.JSONException; |
26 | 28 | import org.json.JSONObject; |
27 | 29 | |
30 | +import java.util.HashMap; | |
31 | +import java.util.Map; | |
32 | + | |
28 | 33 | |
29 | 34 | public class CreateConsommation extends DialogFragment { |
30 | 35 | |
... | ... | @@ -102,7 +107,13 @@ public class CreateConsommation extends DialogFragment { |
102 | 107 | dismiss(); |
103 | 108 | } |
104 | 109 | } |
105 | - ); | |
110 | + ){ | |
111 | + @Override | |
112 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
113 | + Map<String, String> headers = new HashMap<String, String>(); | |
114 | + headers.put("Authorization", MainActivity.session.getToken()); | |
115 | + return headers; | |
116 | + }}; | |
106 | 117 | jsonObjectRequest.setTag(CreateConsommation.class); |
107 | 118 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
108 | 119 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/DeleteConsommation.java
... | ... | @@ -12,19 +12,23 @@ import android.widget.ProgressBar; |
12 | 12 | import android.widget.TextView; |
13 | 13 | import android.widget.Toast; |
14 | 14 | |
15 | +import com.android.volley.AuthFailureError; | |
15 | 16 | import com.android.volley.Request; |
16 | 17 | import com.android.volley.Response; |
17 | 18 | import com.android.volley.VolleyError; |
18 | 19 | import com.android.volley.toolbox.JsonObjectRequest; |
19 | 20 | |
20 | 21 | import net.plil.clubinfo.etunicorn.R; |
22 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
21 | 23 | import net.plil.clubinfo.etunicorn.data.Consommation; |
22 | 24 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
23 | 25 | |
24 | 26 | import org.json.JSONException; |
25 | 27 | import org.json.JSONObject; |
26 | 28 | |
29 | +import java.util.HashMap; | |
27 | 30 | import java.util.Locale; |
31 | +import java.util.Map; | |
28 | 32 | |
29 | 33 | |
30 | 34 | public class DeleteConsommation extends DialogFragment { |
... | ... | @@ -90,7 +94,13 @@ public class DeleteConsommation extends DialogFragment { |
90 | 94 | Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show(); |
91 | 95 | } |
92 | 96 | } |
93 | - ); | |
97 | + ){ | |
98 | + @Override | |
99 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
100 | + Map<String, String> headers = new HashMap<String, String>(); | |
101 | + headers.put("Authorization", MainActivity.session.getToken()); | |
102 | + return headers; | |
103 | + }}; | |
94 | 104 | jsonObjectRequest.setTag(DeleteConsommation.class); |
95 | 105 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
96 | 106 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/ModifyConsommation.java
... | ... | @@ -13,19 +13,23 @@ import android.widget.EditText; |
13 | 13 | import android.widget.ProgressBar; |
14 | 14 | import android.widget.Toast; |
15 | 15 | |
16 | +import com.android.volley.AuthFailureError; | |
16 | 17 | import com.android.volley.Request; |
17 | 18 | import com.android.volley.Response; |
18 | 19 | import com.android.volley.VolleyError; |
19 | 20 | import com.android.volley.toolbox.JsonObjectRequest; |
20 | 21 | |
21 | 22 | import net.plil.clubinfo.etunicorn.R; |
23 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
22 | 24 | import net.plil.clubinfo.etunicorn.data.Consommation; |
23 | 25 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
24 | 26 | |
25 | 27 | import org.json.JSONException; |
26 | 28 | import org.json.JSONObject; |
27 | 29 | |
30 | +import java.util.HashMap; | |
28 | 31 | import java.util.Locale; |
32 | +import java.util.Map; | |
29 | 33 | |
30 | 34 | |
31 | 35 | public class ModifyConsommation extends DialogFragment { |
... | ... | @@ -121,7 +125,13 @@ public class ModifyConsommation extends DialogFragment { |
121 | 125 | Toast.makeText(getContext(), R.string.modify_refused, Toast.LENGTH_LONG).show(); |
122 | 126 | } |
123 | 127 | } |
124 | - ); | |
128 | + ){ | |
129 | + @Override | |
130 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
131 | + Map<String, String> headers = new HashMap<String, String>(); | |
132 | + headers.put("Authorization", MainActivity.session.getToken()); | |
133 | + return headers; | |
134 | + }}; | |
125 | 135 | jsonObjectRequest.setTag(ModifyConsommation.class); |
126 | 136 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
127 | 137 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/PaiementConsommation.java
... | ... | @@ -12,12 +12,14 @@ import android.widget.ProgressBar; |
12 | 12 | import android.widget.TextView; |
13 | 13 | import android.widget.Toast; |
14 | 14 | |
15 | +import com.android.volley.AuthFailureError; | |
15 | 16 | import com.android.volley.Request; |
16 | 17 | import com.android.volley.Response; |
17 | 18 | import com.android.volley.VolleyError; |
18 | 19 | import com.android.volley.toolbox.JsonObjectRequest; |
19 | 20 | |
20 | 21 | import net.plil.clubinfo.etunicorn.R; |
22 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
21 | 23 | import net.plil.clubinfo.etunicorn.app.NFCSupport; |
22 | 24 | import net.plil.clubinfo.etunicorn.app.event.PaiementEvent; |
23 | 25 | import net.plil.clubinfo.etunicorn.data.Consommation; |
... | ... | @@ -26,7 +28,9 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
26 | 28 | import org.json.JSONException; |
27 | 29 | import org.json.JSONObject; |
28 | 30 | |
31 | +import java.util.HashMap; | |
29 | 32 | import java.util.Locale; |
33 | +import java.util.Map; | |
30 | 34 | |
31 | 35 | |
32 | 36 | public class PaiementConsommation extends DialogFragment implements NFCSupport { |
... | ... | @@ -108,7 +112,13 @@ public class PaiementConsommation extends DialogFragment implements NFCSupport { |
108 | 112 | Toast.makeText(getContext(), R.string.payment_refused, Toast.LENGTH_LONG).show(); |
109 | 113 | } |
110 | 114 | } |
111 | - ); | |
115 | + ){ | |
116 | + @Override | |
117 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
118 | + Map<String, String> headers = new HashMap<String, String>(); | |
119 | + headers.put("Authorization", MainActivity.session.getToken()); | |
120 | + return headers; | |
121 | + }}; | |
112 | 122 | jsonObjectRequest.setTag(PaiementConsommation.class); |
113 | 123 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
114 | 124 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/credit/Crediter.java
... | ... | @@ -11,12 +11,14 @@ import android.view.ViewGroup; |
11 | 11 | import android.widget.EditText; |
12 | 12 | import android.widget.ProgressBar; |
13 | 13 | |
14 | +import com.android.volley.AuthFailureError; | |
14 | 15 | import com.android.volley.Request; |
15 | 16 | import com.android.volley.Response; |
16 | 17 | import com.android.volley.VolleyError; |
17 | 18 | import com.android.volley.toolbox.JsonObjectRequest; |
18 | 19 | |
19 | 20 | import net.plil.clubinfo.etunicorn.R; |
21 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
20 | 22 | import net.plil.clubinfo.etunicorn.app.NFCSupport; |
21 | 23 | import net.plil.clubinfo.etunicorn.data.Personne; |
22 | 24 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
... | ... | @@ -24,6 +26,9 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
24 | 26 | import org.json.JSONException; |
25 | 27 | import org.json.JSONObject; |
26 | 28 | |
29 | +import java.util.HashMap; | |
30 | +import java.util.Map; | |
31 | + | |
27 | 32 | public class Crediter extends Fragment implements NFCSupport{ |
28 | 33 | |
29 | 34 | private EditText mMoneyEditText; |
... | ... | @@ -96,7 +101,13 @@ public class Crediter extends Fragment implements NFCSupport{ |
96 | 101 | Snackbar.make(coordinatorLayout, error.getMessage(), Snackbar.LENGTH_LONG).show(); |
97 | 102 | } |
98 | 103 | } |
99 | - ); | |
104 | + ){ | |
105 | + @Override | |
106 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
107 | + Map<String, String> headers = new HashMap<String, String>(); | |
108 | + headers.put("Authorization", MainActivity.session.getToken()); | |
109 | + return headers; | |
110 | + }}; | |
100 | 111 | jsonObjectRequest.setTag(Crediter.class); |
101 | 112 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
102 | 113 | } | ... | ... |
app/src/main/java/net/plil/clubinfo/etunicorn/app/debit/Debiter.java
... | ... | @@ -11,12 +11,14 @@ import android.view.View; |
11 | 11 | import android.view.ViewGroup; |
12 | 12 | import android.widget.ProgressBar; |
13 | 13 | |
14 | +import com.android.volley.AuthFailureError; | |
14 | 15 | import com.android.volley.Request; |
15 | 16 | import com.android.volley.Response; |
16 | 17 | import com.android.volley.VolleyError; |
17 | 18 | import com.android.volley.toolbox.JsonObjectRequest; |
18 | 19 | |
19 | 20 | import net.plil.clubinfo.etunicorn.R; |
21 | +import net.plil.clubinfo.etunicorn.app.MainActivity; | |
20 | 22 | import net.plil.clubinfo.etunicorn.app.NFCSupport; |
21 | 23 | import net.plil.clubinfo.etunicorn.data.Personne; |
22 | 24 | import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
... | ... | @@ -24,6 +26,9 @@ import net.plil.clubinfo.etunicorn.utils.VolleyUtils; |
24 | 26 | import org.json.JSONException; |
25 | 27 | import org.json.JSONObject; |
26 | 28 | |
29 | +import java.util.HashMap; | |
30 | +import java.util.Map; | |
31 | + | |
27 | 32 | public class Debiter extends Fragment implements NFCSupport { |
28 | 33 | |
29 | 34 | |
... | ... | @@ -103,8 +108,14 @@ public class Debiter extends Fragment implements NFCSupport { |
103 | 108 | Snackbar.make(coordinatorLayout, error.getMessage(), Snackbar.LENGTH_LONG).show(); |
104 | 109 | |
105 | 110 | } |
106 | - } | |
107 | - ); | |
111 | + }) | |
112 | + { | |
113 | + @Override | |
114 | + public Map<String, String> getHeaders() throws AuthFailureError { | |
115 | + Map<String, String> headers = new HashMap<String, String>(); | |
116 | + headers.put("Authorization", MainActivity.session.getToken()); | |
117 | + return headers; | |
118 | + }}; | |
108 | 119 | jsonObjectRequest.setTag(Debiter.class); |
109 | 120 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
110 | 121 | } | ... | ... |