Commit 6e48e148d9c78ce46691219abdeb9c2899e075e8
1 parent
835e9886
Consomation handle stop dialog
Showing
7 changed files
with
140 additions
and
71 deletions
Show diff stats
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/CreateConsommation.java
@@ -49,7 +49,12 @@ public class CreateConsommation extends DialogFragment { | @@ -49,7 +49,12 @@ public class CreateConsommation extends DialogFragment { | ||
49 | .setTitle(R.string.create_consumable) | 49 | .setTitle(R.string.create_consumable) |
50 | .setView(view) | 50 | .setView(view) |
51 | .setPositiveButton(R.string.valid, null) | 51 | .setPositiveButton(R.string.valid, null) |
52 | - .setNegativeButton(R.string.cancel, null) | 52 | + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { |
53 | + @Override | ||
54 | + public void onClick(DialogInterface dialog, int which) { | ||
55 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(CreateConsommation.class); | ||
56 | + } | ||
57 | + }) | ||
53 | .create(); | 58 | .create(); |
54 | dialog.setOnShowListener(new DialogInterface.OnShowListener() { | 59 | dialog.setOnShowListener(new DialogInterface.OnShowListener() { |
55 | @Override | 60 | @Override |
@@ -79,7 +84,7 @@ public class CreateConsommation extends DialogFragment { | @@ -79,7 +84,7 @@ public class CreateConsommation extends DialogFragment { | ||
79 | mNomInput.setVisibility(View.GONE); | 84 | mNomInput.setVisibility(View.GONE); |
80 | JSONObject jsonObject = new JSONObject(); | 85 | JSONObject jsonObject = new JSONObject(); |
81 | try { | 86 | try { |
82 | - jsonObject.put("nomConsomation", mNomConsomation.getText().toString()); | 87 | + jsonObject.put("nom", mNomConsomation.getText().toString()); |
83 | jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString())); | 88 | jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString())); |
84 | } catch (JSONException e) { | 89 | } catch (JSONException e) { |
85 | e.printStackTrace(); | 90 | e.printStackTrace(); |
@@ -98,14 +103,24 @@ public class CreateConsommation extends DialogFragment { | @@ -98,14 +103,24 @@ public class CreateConsommation extends DialogFragment { | ||
98 | } | 103 | } |
99 | } | 104 | } |
100 | ); | 105 | ); |
106 | + jsonObjectRequest.setTag(CreateConsommation.class); | ||
101 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | 107 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
102 | } | 108 | } |
103 | } | 109 | } |
104 | }); | 110 | }); |
105 | } | 111 | } |
106 | }); | 112 | }); |
113 | + dialog.setCanceledOnTouchOutside(false); | ||
107 | return dialog; | 114 | return dialog; |
108 | } | 115 | } |
109 | 116 | ||
110 | 117 | ||
118 | + @Override | ||
119 | + public void onStop() { | ||
120 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(CreateConsommation.class); | ||
121 | + dismissAllowingStateLoss(); | ||
122 | + super.onStop(); | ||
123 | + } | ||
124 | + | ||
125 | + | ||
111 | } | 126 | } |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/DeleteConsommation.java
@@ -7,6 +7,7 @@ import android.support.v4.app.DialogFragment; | @@ -7,6 +7,7 @@ import android.support.v4.app.DialogFragment; | ||
7 | import android.support.v7.app.AlertDialog; | 7 | import android.support.v7.app.AlertDialog; |
8 | import android.view.LayoutInflater; | 8 | import android.view.LayoutInflater; |
9 | import android.view.View; | 9 | import android.view.View; |
10 | +import android.widget.Button; | ||
10 | import android.widget.ProgressBar; | 11 | import android.widget.ProgressBar; |
11 | import android.widget.TextView; | 12 | import android.widget.TextView; |
12 | import android.widget.Toast; | 13 | import android.widget.Toast; |
@@ -58,15 +59,23 @@ public class DeleteConsommation extends DialogFragment { | @@ -58,15 +59,23 @@ public class DeleteConsommation extends DialogFragment { | ||
58 | final Consommation consommation = (Consommation) getArguments().getSerializable("consommation"); | 59 | final Consommation consommation = (Consommation) getArguments().getSerializable("consommation"); |
59 | 60 | ||
60 | 61 | ||
61 | - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||
62 | - builder | 62 | + AlertDialog dialog = new AlertDialog.Builder(getActivity()) |
63 | .setTitle(R.string.verif_delete_consomation) | 63 | .setTitle(R.string.verif_delete_consomation) |
64 | .setView(view) | 64 | .setView(view) |
65 | - .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { | 65 | + .setPositiveButton(R.string.delete, null) |
66 | + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { | ||
67 | + public void onClick(DialogInterface dialog, int id) { | ||
68 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(DeleteConsommation.class); | ||
69 | + } | ||
70 | + }).create(); | ||
71 | + dialog.setOnShowListener(new DialogInterface.OnShowListener() { | ||
72 | + @Override | ||
73 | + public void onShow(DialogInterface dialog) { | ||
74 | + Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); | ||
75 | + button.setOnClickListener(new View.OnClickListener() { | ||
66 | @Override | 76 | @Override |
67 | - public void onClick(DialogInterface dialog, int which) { | 77 | + public void onClick(View v) { |
68 | mProgressBar.setVisibility(View.VISIBLE); | 78 | mProgressBar.setVisibility(View.VISIBLE); |
69 | - | ||
70 | JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation(), null, new Response.Listener<JSONObject>() { | 79 | JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.DELETE, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation(), null, new Response.Listener<JSONObject>() { |
71 | @Override | 80 | @Override |
72 | public void onResponse(JSONObject response) { | 81 | public void onResponse(JSONObject response) { |
@@ -79,20 +88,24 @@ public class DeleteConsommation extends DialogFragment { | @@ -79,20 +88,24 @@ public class DeleteConsommation extends DialogFragment { | ||
79 | public void onErrorResponse(VolleyError error) { | 88 | public void onErrorResponse(VolleyError error) { |
80 | mProgressBar.setVisibility(View.GONE); | 89 | mProgressBar.setVisibility(View.GONE); |
81 | Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show(); | 90 | Toast.makeText(getContext(), R.string.delete_refused, Toast.LENGTH_LONG).show(); |
82 | - dismiss(); | ||
83 | } | 91 | } |
84 | } | 92 | } |
85 | ); | 93 | ); |
86 | - | 94 | + jsonObjectRequest.setTag(DeleteConsommation.class); |
87 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | 95 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
88 | } | 96 | } |
89 | - }) | ||
90 | - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { | ||
91 | - public void onClick(DialogInterface dialog, int id) { | ||
92 | - | ||
93 | - } | ||
94 | }); | 97 | }); |
95 | - return builder.create(); | 98 | + } |
99 | + }); | ||
100 | + dialog.setCanceledOnTouchOutside(false); | ||
101 | + return dialog; | ||
102 | + } | ||
103 | + | ||
104 | + @Override | ||
105 | + public void onStop() { | ||
106 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(DeleteConsommation.class); | ||
107 | + dismissAllowingStateLoss(); | ||
108 | + super.onStop(); | ||
96 | } | 109 | } |
97 | 110 | ||
98 | 111 |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/FragmentConsommation.java
@@ -105,7 +105,7 @@ public class FragmentConsommation extends FragmentNFC { | @@ -105,7 +105,7 @@ public class FragmentConsommation extends FragmentNFC { | ||
105 | Toast.makeText(getContext(), R.string.payment_consumable_alert_no_selection, Toast.LENGTH_LONG).show(); | 105 | Toast.makeText(getContext(), R.string.payment_consumable_alert_no_selection, Toast.LENGTH_LONG).show(); |
106 | } | 106 | } |
107 | else { | 107 | else { |
108 | - paiementConsommation.processNFC(); | 108 | + paiementConsommation.processNFC(idCardUser); |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/ModifyConsommation.java
@@ -3,10 +3,12 @@ package net.plil.clubinfo.etunicorn.app.consommation; | @@ -3,10 +3,12 @@ package net.plil.clubinfo.etunicorn.app.consommation; | ||
3 | import android.app.Dialog; | 3 | import android.app.Dialog; |
4 | import android.content.DialogInterface; | 4 | import android.content.DialogInterface; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | +import android.support.design.widget.TextInputLayout; | ||
6 | import android.support.v4.app.DialogFragment; | 7 | import android.support.v4.app.DialogFragment; |
7 | import android.support.v7.app.AlertDialog; | 8 | import android.support.v7.app.AlertDialog; |
8 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
9 | import android.view.View; | 10 | import android.view.View; |
11 | +import android.widget.Button; | ||
10 | import android.widget.EditText; | 12 | import android.widget.EditText; |
11 | import android.widget.ProgressBar; | 13 | import android.widget.ProgressBar; |
12 | import android.widget.Toast; | 14 | import android.widget.Toast; |
@@ -30,6 +32,8 @@ public class ModifyConsommation extends DialogFragment { | @@ -30,6 +32,8 @@ public class ModifyConsommation extends DialogFragment { | ||
30 | 32 | ||
31 | EditText mNomConsomation; | 33 | EditText mNomConsomation; |
32 | EditText mPrice; | 34 | EditText mPrice; |
35 | + TextInputLayout mPriceInput; | ||
36 | + TextInputLayout mNomInput; | ||
33 | ProgressBar mProgressBar; | 37 | ProgressBar mProgressBar; |
34 | 38 | ||
35 | public static ModifyConsommation newInstance(Consommation consommation) { | 39 | public static ModifyConsommation newInstance(Consommation consommation) { |
@@ -47,62 +51,92 @@ public class ModifyConsommation extends DialogFragment { | @@ -47,62 +51,92 @@ public class ModifyConsommation extends DialogFragment { | ||
47 | @Override | 51 | @Override |
48 | public Dialog onCreateDialog(Bundle savedInstanceState) { | 52 | public Dialog onCreateDialog(Bundle savedInstanceState) { |
49 | // Use the Builder class for convenient dialog construction | 53 | // Use the Builder class for convenient dialog construction |
50 | - LayoutInflater inflater = getActivity().getLayoutInflater(); | 54 | + final LayoutInflater inflater = getActivity().getLayoutInflater(); |
51 | View view = inflater.inflate(R.layout.fragment_modify_consommation, null); | 55 | View view = inflater.inflate(R.layout.fragment_modify_consommation, null); |
52 | mNomConsomation = (EditText) view.findViewById(R.id.modify_consommation_name); | 56 | mNomConsomation = (EditText) view.findViewById(R.id.modify_consommation_name); |
53 | mPrice = (EditText) view.findViewById(R.id.modify_consommation_price); | 57 | mPrice = (EditText) view.findViewById(R.id.modify_consommation_price); |
54 | mProgressBar = (ProgressBar) view.findViewById(R.id.modify_consommation_progress_bar); | 58 | mProgressBar = (ProgressBar) view.findViewById(R.id.modify_consommation_progress_bar); |
59 | + mNomInput = (TextInputLayout) view.findViewById(R.id.modify_consommation_input_name); | ||
60 | + mPriceInput = (TextInputLayout) view.findViewById(R.id.modify_consommation_input_price); | ||
55 | 61 | ||
56 | final Consommation consommation = (Consommation) getArguments().getSerializable("consommation"); | 62 | final Consommation consommation = (Consommation) getArguments().getSerializable("consommation"); |
57 | 63 | ||
58 | mNomConsomation.setText(consommation.getNomConsomation()); | 64 | mNomConsomation.setText(consommation.getNomConsomation()); |
59 | - mPrice.setText(String.format(Locale.FRANCE,"%.2f", consommation.getPrix())); | 65 | + mPrice.setText(String.format(Locale.US,"%.2f", consommation.getPrix())); |
60 | 66 | ||
61 | - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); | ||
62 | - builder | 67 | + AlertDialog dialog = new AlertDialog.Builder(getActivity()) |
63 | .setTitle(R.string.modify) | 68 | .setTitle(R.string.modify) |
64 | .setView(view) | 69 | .setView(view) |
65 | - .setPositiveButton(R.string.modify, new DialogInterface.OnClickListener() { | 70 | + .setPositiveButton(R.string.modify, null) |
71 | + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { | ||
66 | public void onClick(DialogInterface dialog, int id) { | 72 | public void onClick(DialogInterface dialog, int id) { |
73 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(ModifyConsommation.class); | ||
74 | + } | ||
75 | + }).create(); | ||
76 | + // Create the AlertDialog object and return it | ||
67 | 77 | ||
68 | - mProgressBar.setVisibility(View.VISIBLE); | ||
69 | - mPrice.setVisibility(View.GONE); | ||
70 | - mNomConsomation.setVisibility(View.GONE); | ||
71 | - JSONObject jsonObject = new JSONObject(); | ||
72 | - try { | ||
73 | - jsonObject.put("nomConsomation", mNomConsomation.getText().toString()); | ||
74 | - jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString())); | ||
75 | - } catch (JSONException e){ | ||
76 | - e.printStackTrace(); | 78 | + dialog.setOnShowListener(new DialogInterface.OnShowListener() { |
79 | + @Override | ||
80 | + public void onShow(DialogInterface dialog) { | ||
81 | + Button button = ((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE); | ||
82 | + button.setOnClickListener(new View.OnClickListener() { | ||
83 | + @Override | ||
84 | + public void onClick(View v) { | ||
85 | + boolean inputOk = true; | ||
86 | + if (mPrice.getText().toString().isEmpty()){ | ||
87 | + inputOk = false; | ||
88 | + mPriceInput.setError(getString(R.string.error_modify_consommation_input_price)); | ||
89 | + } else { | ||
90 | + mPriceInput.setError(null); | ||
77 | } | 91 | } |
78 | - JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation() ,jsonObject , new Response.Listener<JSONObject>() { | ||
79 | - @Override | ||
80 | - public void onResponse(JSONObject response) { | ||
81 | - mProgressBar.setVisibility(View.GONE); | ||
82 | - Toast.makeText(getContext(), R.string.modify_done, Toast.LENGTH_LONG).show(); | ||
83 | - | 92 | + if (mNomConsomation.getText().toString().isEmpty()){ |
93 | + inputOk = false; | ||
94 | + mNomInput.setError(getString(R.string.error_modify_consommation_input_nom)); | ||
95 | + } else { | ||
96 | + mNomInput.setError(null); | ||
97 | + } | ||
98 | + if (inputOk) { | ||
99 | + mProgressBar.setVisibility(View.VISIBLE); | ||
100 | + mPriceInput.setVisibility(View.GONE); | ||
101 | + mNomInput.setVisibility(View.GONE); | ||
102 | + JSONObject jsonObject = new JSONObject(); | ||
103 | + try { | ||
104 | + jsonObject.put("nom", mNomConsomation.getText().toString()); | ||
105 | + jsonObject.put("prix", Double.parseDouble(mPrice.getText().toString())); | ||
106 | + } catch (JSONException e) { | ||
107 | + e.printStackTrace(); | ||
84 | } | 108 | } |
85 | - }, new Response.ErrorListener() { | ||
86 | - @Override | ||
87 | - public void onErrorResponse(VolleyError error) { | ||
88 | - mProgressBar.setVisibility(View.GONE); | ||
89 | - Toast.makeText(getContext(), R.string.modify_refused, Toast.LENGTH_LONG).show(); | ||
90 | - | 109 | + JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.PUT, VolleyUtils.baseUri + "/consomation/" + consommation.getIdConsomation(), jsonObject, new Response.Listener<JSONObject>() { |
110 | + @Override | ||
111 | + public void onResponse(JSONObject response) { | ||
112 | + mProgressBar.setVisibility(View.GONE); | ||
113 | + Toast.makeText(getContext(), R.string.modify_done, Toast.LENGTH_LONG).show(); | ||
114 | + dismiss(); | ||
115 | + | ||
116 | + } | ||
117 | + }, new Response.ErrorListener() { | ||
118 | + @Override | ||
119 | + public void onErrorResponse(VolleyError error) { | ||
120 | + mProgressBar.setVisibility(View.GONE); | ||
121 | + Toast.makeText(getContext(), R.string.modify_refused, Toast.LENGTH_LONG).show(); | ||
122 | + } | ||
91 | } | 123 | } |
124 | + ); | ||
125 | + jsonObjectRequest.setTag(ModifyConsommation.class); | ||
126 | + VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | ||
92 | } | 127 | } |
93 | - ); | ||
94 | - | ||
95 | - VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | ||
96 | - } | ||
97 | - }) | ||
98 | - .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { | ||
99 | - public void onClick(DialogInterface dialog, int id) { | ||
100 | - // User cancelled the dialog | ||
101 | } | 128 | } |
102 | }); | 129 | }); |
103 | - // Create the AlertDialog object and return it | ||
104 | - return builder.create(); | 130 | + }}); |
131 | + dialog.setCanceledOnTouchOutside(false); | ||
132 | + return dialog; | ||
105 | } | 133 | } |
106 | 134 | ||
135 | + @Override | ||
136 | + public void onStop() { | ||
137 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(ModifyConsommation.class); | ||
138 | + dismissAllowingStateLoss(); | ||
139 | + super.onStop(); | ||
140 | + } | ||
107 | 141 | ||
108 | } | 142 | } |
app/src/main/java/net/plil/clubinfo/etunicorn/app/consommation/PaiementConsommation.java
@@ -5,6 +5,7 @@ import android.content.DialogInterface; | @@ -5,6 +5,7 @@ import android.content.DialogInterface; | ||
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | import android.support.v4.app.DialogFragment; | 6 | import android.support.v4.app.DialogFragment; |
7 | import android.support.v7.app.AlertDialog; | 7 | import android.support.v7.app.AlertDialog; |
8 | +import android.view.KeyEvent; | ||
8 | import android.view.LayoutInflater; | 9 | import android.view.LayoutInflater; |
9 | import android.view.View; | 10 | import android.view.View; |
10 | import android.widget.ProgressBar; | 11 | import android.widget.ProgressBar; |
@@ -72,9 +73,9 @@ public class PaiementConsommation extends DialogFragment { | @@ -72,9 +73,9 @@ public class PaiementConsommation extends DialogFragment { | ||
72 | .setView(view) | 73 | .setView(view) |
73 | .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { | 74 | .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { |
74 | public void onClick(DialogInterface dialog, int id) { | 75 | public void onClick(DialogInterface dialog, int id) { |
76 | + VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(PaiementConsommation.class); | ||
75 | } | 77 | } |
76 | }); | 78 | }); |
77 | - // Create the AlertDialog object and return it | ||
78 | 79 | ||
79 | Dialog dialog = builder.create(); | 80 | Dialog dialog = builder.create(); |
80 | dialog.setCanceledOnTouchOutside(false); | 81 | dialog.setCanceledOnTouchOutside(false); |
@@ -82,12 +83,12 @@ public class PaiementConsommation extends DialogFragment { | @@ -82,12 +83,12 @@ public class PaiementConsommation extends DialogFragment { | ||
82 | } | 83 | } |
83 | 84 | ||
84 | 85 | ||
85 | - public void processNFC() { | 86 | + public void processNFC(String idCardUser) { |
87 | + Toast.makeText(getContext(), "Hello " + idCardUser, Toast.LENGTH_LONG).show(); | ||
86 | mProgressBar.setVisibility(View.VISIBLE); | 88 | mProgressBar.setVisibility(View.VISIBLE); |
87 | JSONObject jsonObject = new JSONObject(); | 89 | JSONObject jsonObject = new JSONObject(); |
88 | try { | 90 | try { |
89 | - jsonObject.put("participant", 1); | ||
90 | - jsonObject.put("acteur", 2); | 91 | + jsonObject.put("participant", idCardUser); |
91 | jsonObject.put("id", consommationId); | 92 | jsonObject.put("id", consommationId); |
92 | } catch (JSONException e) { | 93 | } catch (JSONException e) { |
93 | e.printStackTrace(); | 94 | e.printStackTrace(); |
@@ -104,7 +105,6 @@ public class PaiementConsommation extends DialogFragment { | @@ -104,7 +105,6 @@ public class PaiementConsommation extends DialogFragment { | ||
104 | public void onErrorResponse(VolleyError error) { | 105 | public void onErrorResponse(VolleyError error) { |
105 | mProgressBar.setVisibility(View.GONE); | 106 | mProgressBar.setVisibility(View.GONE); |
106 | Toast.makeText(getContext(), R.string.payment_refused, Toast.LENGTH_LONG).show(); | 107 | Toast.makeText(getContext(), R.string.payment_refused, Toast.LENGTH_LONG).show(); |
107 | - dismiss(); | ||
108 | } | 108 | } |
109 | } | 109 | } |
110 | ); | 110 | ); |
@@ -112,21 +112,12 @@ public class PaiementConsommation extends DialogFragment { | @@ -112,21 +112,12 @@ public class PaiementConsommation extends DialogFragment { | ||
112 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); | 112 | VolleyUtils.getInstance(getContext()).addToRequestQueue(jsonObjectRequest); |
113 | } | 113 | } |
114 | 114 | ||
115 | - @Override | ||
116 | - public void onCancel(DialogInterface dialog) { | ||
117 | - VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(PaiementConsommation.class); | ||
118 | - super.onCancel(dialog); | ||
119 | - } | ||
120 | 115 | ||
121 | @Override | 116 | @Override |
122 | public void onStop() { | 117 | public void onStop() { |
123 | VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(PaiementConsommation.class); | 118 | VolleyUtils.getInstance(getContext()).getRequestQueue().cancelAll(PaiementConsommation.class); |
119 | + dismissAllowingStateLoss(); | ||
124 | super.onStop(); | 120 | super.onStop(); |
125 | } | 121 | } |
126 | 122 | ||
127 | - @Override | ||
128 | - public void onPause() { | ||
129 | - super.onPause(); | ||
130 | - dismiss(); | ||
131 | - } | ||
132 | } | 123 | } |
app/src/main/res/layout/fragment_modify_consommation.xml
@@ -5,15 +5,27 @@ | @@ -5,15 +5,27 @@ | ||
5 | tools:context="net.plil.clubinfo.etunicorn.app.consommation.ModifyConsommation" | 5 | tools:context="net.plil.clubinfo.etunicorn.app.consommation.ModifyConsommation" |
6 | android:orientation="vertical"> | 6 | android:orientation="vertical"> |
7 | 7 | ||
8 | - <EditText | 8 | + <android.support.design.widget.TextInputLayout |
9 | android:layout_width="match_parent" | 9 | android:layout_width="match_parent" |
10 | android:layout_height="wrap_content" | 10 | android:layout_height="wrap_content" |
11 | - android:id="@+id/modify_consommation_name" /> | 11 | + android:id="@+id/modify_consommation_input_name"> |
12 | + <android.support.design.widget.TextInputEditText | ||
13 | + android:layout_width="match_parent" | ||
14 | + android:layout_height="wrap_content" | ||
15 | + android:id="@+id/modify_consommation_name" | ||
16 | + android:hint="@string/modify_consomation_hint_name"/> | ||
17 | + </android.support.design.widget.TextInputLayout> | ||
12 | 18 | ||
13 | - <EditText | 19 | + <android.support.design.widget.TextInputLayout |
14 | android:layout_width="match_parent" | 20 | android:layout_width="match_parent" |
15 | android:layout_height="wrap_content" | 21 | android:layout_height="wrap_content" |
16 | - android:id="@+id/modify_consommation_price"/> | 22 | + android:id="@+id/modify_consommation_input_price"> |
23 | + <android.support.design.widget.TextInputEditText | ||
24 | + android:layout_width="match_parent" | ||
25 | + android:layout_height="wrap_content" | ||
26 | + android:id="@+id/modify_consommation_price" | ||
27 | + android:hint="@string/modify_consomation_hint_price"/> | ||
28 | + </android.support.design.widget.TextInputLayout> | ||
17 | 29 | ||
18 | <ProgressBar | 30 | <ProgressBar |
19 | style="?android:attr/progressBarStyle" | 31 | style="?android:attr/progressBarStyle" |
app/src/main/res/values/strings.xml
@@ -44,4 +44,8 @@ | @@ -44,4 +44,8 @@ | ||
44 | <string name="error_enter_debit">Please enter a value before using your NFC card</string> | 44 | <string name="error_enter_debit">Please enter a value before using your NFC card</string> |
45 | <string name="error_create_consomation_input_price">Enter the price</string> | 45 | <string name="error_create_consomation_input_price">Enter the price</string> |
46 | <string name="error_create_consomation_input_nom">Enter the name</string> | 46 | <string name="error_create_consomation_input_nom">Enter the name</string> |
47 | + <string name="error_modify_consommation_input_price">Enter the new price</string> | ||
48 | + <string name="error_modify_consommation_input_nom">Enter the new name</string> | ||
49 | + <string name="modify_consomation_hint_name">Name</string> | ||
50 | + <string name="modify_consomation_hint_price">Price</string> | ||
47 | </resources> | 51 | </resources> |