Commit 814b5a6fc7ac8745f9688f1caea197119a7ac6cf
1 parent
d94e64ab
On vide les champs après opération #14
Showing
1 changed file
with
12 additions
and
9 deletions
Show diff stats
PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
@@ -128,6 +128,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -128,6 +128,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
128 | 128 | ||
129 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 1)){ | 129 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 1)){ |
130 | mState = STATE_CREATION_COMPTE; | 130 | mState = STATE_CREATION_COMPTE; |
131 | + champMontant.setText(""); | ||
132 | + | ||
131 | Intent intent = new Intent(this, CarteActivite.class); | 133 | Intent intent = new Intent(this, CarteActivite.class); |
132 | intent.putExtra("token", mToken); | 134 | intent.putExtra("token", mToken); |
133 | intent.putExtra("state", mState); | 135 | intent.putExtra("state", mState); |
@@ -164,6 +166,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -164,6 +166,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
164 | 166 | ||
165 | if ((montant > 0.0f) && (montant < 200.0f) && (quantite > 0) && (mDroit >= 1)) { | 167 | if ((montant > 0.0f) && (montant < 200.0f) && (quantite > 0) && (mDroit >= 1)) { |
166 | mState = STATE_COMMANDE; | 168 | mState = STATE_COMMANDE; |
169 | + champMontant.setText(""); | ||
170 | + champQuantite.setText(""); | ||
171 | + | ||
167 | Intent intent = new Intent(this, CarteActivite.class); | 172 | Intent intent = new Intent(this, CarteActivite.class); |
168 | intent.putExtra("token", mToken); | 173 | intent.putExtra("token", mToken); |
169 | intent.putExtra("state", mState); | 174 | intent.putExtra("state", mState); |
@@ -197,6 +202,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -197,6 +202,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
197 | 202 | ||
198 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 2)){ | 203 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 2)){ |
199 | mState = STATE_RECHARGEMENT; | 204 | mState = STATE_RECHARGEMENT; |
205 | + champMontant.setText(""); | ||
206 | + | ||
200 | Intent intent = new Intent(this, CarteActivite.class); | 207 | Intent intent = new Intent(this, CarteActivite.class); |
201 | intent.putExtra("token", mToken); | 208 | intent.putExtra("token", mToken); |
202 | intent.putExtra("state", mState); | 209 | intent.putExtra("state", mState); |
@@ -225,6 +232,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -225,6 +232,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
225 | if ((user != "") && (password != "")) { | 232 | if ((user != "") && (password != "")) { |
226 | mState = STATE_CONNEXION; | 233 | mState = STATE_CONNEXION; |
227 | 234 | ||
235 | + viewUser.setText(""); | ||
236 | + viewPsw.setText(""); | ||
237 | + | ||
228 | try{ | 238 | try{ |
229 | URL url = new URL(CarteActivite.HOST + "api/utilisateur/connexion"); | 239 | URL url = new URL(CarteActivite.HOST + "api/utilisateur/connexion"); |
230 | HashMap<String, String> param = new HashMap<String, String>(); | 240 | HashMap<String, String> param = new HashMap<String, String>(); |
@@ -268,6 +278,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -268,6 +278,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
268 | protected void onActivityResult(int requestCode, int resultCode, Intent data){ | 278 | protected void onActivityResult(int requestCode, int resultCode, Intent data){ |
269 | //TODO: faire des choses avec ca | 279 | //TODO: faire des choses avec ca |
270 | 280 | ||
281 | + mState = STATE_RIEN; | ||
282 | + | ||
271 | try{ | 283 | try{ |
272 | JSONObject json = new JSONObject(data.getStringExtra("json")); | 284 | JSONObject json = new JSONObject(data.getStringExtra("json")); |
273 | Toast.makeText(this, "Status: " + json.getString("status"), Toast.LENGTH_SHORT).show(); | 285 | Toast.makeText(this, "Status: " + json.getString("status"), Toast.LENGTH_SHORT).show(); |
@@ -307,8 +319,6 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -307,8 +319,6 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
307 | mDroit = output.getInt("droit"); | 319 | mDroit = output.getInt("droit"); |
308 | mUser = output.get("login").toString(); | 320 | mUser = output.get("login").toString(); |
309 | Toast.makeText(this, "Bonjour " + mUser + " vous êtes bien connecté pour " + EXPIRATION / (1000 * 60) + " minutes.", Toast.LENGTH_LONG).show(); | 321 | Toast.makeText(this, "Bonjour " + mUser + " vous êtes bien connecté pour " + EXPIRATION / (1000 * 60) + " minutes.", Toast.LENGTH_LONG).show(); |
310 | - EditText coUser = (EditText) findViewById(R.id.connection_password); | ||
311 | - coUser.setText(""); | ||
312 | final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | 322 | final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); |
313 | viewPager.setCurrentItem(1); | 323 | viewPager.setCurrentItem(1); |
314 | } | 324 | } |
@@ -332,11 +342,4 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | @@ -332,11 +342,4 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr | ||
332 | public long getTimeToken(){ | 342 | public long getTimeToken(){ |
333 | return mTimeToken; | 343 | return mTimeToken; |
334 | } | 344 | } |
335 | - | ||
336 | - public void settingsPopup(View v) { | ||
337 | - PopupMenu popup = new PopupMenu(this, v); | ||
338 | - MenuInflater inflater = popup.getMenuInflater(); | ||
339 | - inflater.inflate(R.menu.popup_settings, popup.getMenu()); | ||
340 | - popup.show(); | ||
341 | - } | ||
342 | } | 345 | } |