Commit 8d573e63b814f74e9d3e641d0ea536f2185b2ede
1 parent
23083dd2
Mise en place de la vidange OK
Showing
2 changed files
with
24 additions
and
1 deletions
Show diff stats
PremiereActivite/app/src/main/java/com/example/app_10p5/CarteActivite.java
... | ... | @@ -51,7 +51,7 @@ public class CarteActivite extends Activity implements ASyncResponse { |
51 | 51 | mAPI = "api/client/recharger"; |
52 | 52 | break; |
53 | 53 | case MainActivite.STATE_VIDANGE: |
54 | - //pas de paramètre | |
54 | + mParam.put("jeton", getIntent().getStringExtra("token")); | |
55 | 55 | mAPI = "api/client/vidange"; |
56 | 56 | break; |
57 | 57 | case MainActivite.STATE_CONNEXION: //Impossible c'est pas géré ici | ... | ... |
PremiereActivite/app/src/main/java/com/example/app_10p5/MainActivite.java
1 | 1 | package com.example.app_10p5; |
2 | 2 | |
3 | 3 | import android.content.Intent; |
4 | +import android.opengl.ETC1; | |
4 | 5 | import android.os.Bundle; |
5 | 6 | import android.support.design.widget.TabLayout; |
6 | 7 | import android.support.v4.app.FragmentActivity; |
7 | 8 | import android.support.v4.view.ViewPager; |
9 | +import android.text.InputFilter; | |
8 | 10 | import android.view.View; |
9 | 11 | import android.widget.EditText; |
10 | 12 | import android.widget.Toast; |
... | ... | @@ -232,6 +234,27 @@ public class MainActivite extends FragmentActivity implements ASyncResponse { |
232 | 234 | } |
233 | 235 | } |
234 | 236 | |
237 | + public void valideVidange(View v){ | |
238 | + if((mToken != "") && ((System.currentTimeMillis() - mTimeToken) < EXPIRATION)) { | |
239 | + | |
240 | + if((mDroit >= 2)){ | |
241 | + mState = STATE_VIDANGE; | |
242 | + Intent intent = new Intent(this, CarteActivite.class); | |
243 | + intent.putExtra("token", mToken); | |
244 | + intent.putExtra("state", mState); | |
245 | + startActivityForResult(intent, mState); | |
246 | + } | |
247 | + else{ | |
248 | + Toast.makeText(this, "Droit insuffisant.", Toast.LENGTH_LONG).show(); | |
249 | + } | |
250 | + } | |
251 | + else{ | |
252 | + Toast.makeText(this, "Veuillez vous reconnecter.", Toast.LENGTH_LONG).show(); | |
253 | + final ViewPager viewPager = (ViewPager) findViewById(R.id.pager); | |
254 | + viewPager.setCurrentItem(0); | |
255 | + } | |
256 | + } | |
257 | + | |
235 | 258 | @Override |
236 | 259 | protected void onActivityResult(int requestCode, int resultCode, Intent data){ |
237 | 260 | //TODO: faire des choses avec ca | ... | ... |