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 | 128 | |
129 | 129 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 1)){ |
130 | 130 | mState = STATE_CREATION_COMPTE; |
131 | + champMontant.setText(""); | |
132 | + | |
131 | 133 | Intent intent = new Intent(this, CarteActivite.class); |
132 | 134 | intent.putExtra("token", mToken); |
133 | 135 | intent.putExtra("state", mState); |
... | ... | @@ -164,6 +166,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr |
164 | 166 | |
165 | 167 | if ((montant > 0.0f) && (montant < 200.0f) && (quantite > 0) && (mDroit >= 1)) { |
166 | 168 | mState = STATE_COMMANDE; |
169 | + champMontant.setText(""); | |
170 | + champQuantite.setText(""); | |
171 | + | |
167 | 172 | Intent intent = new Intent(this, CarteActivite.class); |
168 | 173 | intent.putExtra("token", mToken); |
169 | 174 | intent.putExtra("state", mState); |
... | ... | @@ -197,6 +202,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr |
197 | 202 | |
198 | 203 | if((montant > 0.0f) && (montant < 200.0f) && (mDroit >= 2)){ |
199 | 204 | mState = STATE_RECHARGEMENT; |
205 | + champMontant.setText(""); | |
206 | + | |
200 | 207 | Intent intent = new Intent(this, CarteActivite.class); |
201 | 208 | intent.putExtra("token", mToken); |
202 | 209 | intent.putExtra("state", mState); |
... | ... | @@ -225,6 +232,9 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr |
225 | 232 | if ((user != "") && (password != "")) { |
226 | 233 | mState = STATE_CONNEXION; |
227 | 234 | |
235 | + viewUser.setText(""); | |
236 | + viewPsw.setText(""); | |
237 | + | |
228 | 238 | try{ |
229 | 239 | URL url = new URL(CarteActivite.HOST + "api/utilisateur/connexion"); |
230 | 240 | HashMap<String, String> param = new HashMap<String, String>(); |
... | ... | @@ -268,6 +278,8 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr |
268 | 278 | protected void onActivityResult(int requestCode, int resultCode, Intent data){ |
269 | 279 | //TODO: faire des choses avec ca |
270 | 280 | |
281 | + mState = STATE_RIEN; | |
282 | + | |
271 | 283 | try{ |
272 | 284 | JSONObject json = new JSONObject(data.getStringExtra("json")); |
273 | 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 | 319 | mDroit = output.getInt("droit"); |
308 | 320 | mUser = output.get("login").toString(); |
309 | 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 | 322 | final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); |
313 | 323 | viewPager.setCurrentItem(1); |
314 | 324 | } |
... | ... | @@ -332,11 +342,4 @@ public class MainActivite extends Activity implements ASyncResponse, main_tab_fr |
332 | 342 | public long getTimeToken(){ |
333 | 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 | } | ... | ... |