Commit 86ba2e512b78c9dc44554408335c7689e6a2967e
1 parent
05269735
XOR du cancer
Showing
1 changed file
with
9 additions
and
8 deletions
Show diff stats
PremiereActivite/app/src/main/java/com/example/app_10p5/NFCFragment.java
@@ -37,27 +37,27 @@ public class NFCFragment extends Fragment { | @@ -37,27 +37,27 @@ public class NFCFragment extends Fragment { | ||
37 | Bundle b = getArguments(); | 37 | Bundle b = getArguments(); |
38 | 38 | ||
39 | try { | 39 | try { |
40 | + mParam.put("jeton", URLEncoder.encode(b.getString("token"), "UTF-8")); | ||
40 | switch (b.getInt("state")) { | 41 | switch (b.getInt("state")) { |
41 | case MainActivite.STATE_COMMANDE: | 42 | case MainActivite.STATE_COMMANDE: |
42 | - //TODO: XOR du cancer | ||
43 | - //mParam.put("quantite", String.valueOf(getIntent().getIntExtra("quantite", -1))); | ||
44 | - mParam.put("montant", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); | ||
45 | - mParam.put("jeton", URLEncoder.encode(b.getString("token"), "UTF-8")); | 43 | + if(b.getInt("quantite") != 0){ |
44 | + mParam.put("quantite", URLEncoder.encode(String.valueOf(b.getInt("quantite")), "UTF-8")); | ||
45 | + } | ||
46 | + else{ | ||
47 | + mParam.put("montant", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); | ||
48 | + | ||
49 | + } | ||
46 | mAPI = "api/client/payer"; | 50 | mAPI = "api/client/payer"; |
47 | break; | 51 | break; |
48 | case MainActivite.STATE_CREATION_COMPTE: | 52 | case MainActivite.STATE_CREATION_COMPTE: |
49 | mParam.put("solde", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); | 53 | mParam.put("solde", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); |
50 | - mParam.put("jeton", URLEncoder.encode(b.getString("token"), "UTF-8")); | ||
51 | mAPI = "api/client/ajouter"; | 54 | mAPI = "api/client/ajouter"; |
52 | break; | 55 | break; |
53 | case MainActivite.STATE_RECHARGEMENT: | 56 | case MainActivite.STATE_RECHARGEMENT: |
54 | - System.out.println("bite"); | ||
55 | mParam.put("montant", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); | 57 | mParam.put("montant", URLEncoder.encode(String.valueOf(b.getFloat("montant")), "UTF-8")); |
56 | - mParam.put("jeton", URLEncoder.encode(b.getString("token"), "UTF-8")); | ||
57 | mAPI = "api/client/recharger"; | 58 | mAPI = "api/client/recharger"; |
58 | break; | 59 | break; |
59 | case MainActivite.STATE_VIDANGE: | 60 | case MainActivite.STATE_VIDANGE: |
60 | - mParam.put("jeton", URLEncoder.encode(b.getString("token"), "UTF-8")); | ||
61 | mAPI = "api/client/vidange"; | 61 | mAPI = "api/client/vidange"; |
62 | break; | 62 | break; |
63 | case MainActivite.STATE_CONNEXION: //Impossible c'est pas géré ici | 63 | case MainActivite.STATE_CONNEXION: //Impossible c'est pas géré ici |
@@ -68,6 +68,7 @@ public class NFCFragment extends Fragment { | @@ -68,6 +68,7 @@ public class NFCFragment extends Fragment { | ||
68 | } | 68 | } |
69 | catch (Throwable t){ | 69 | catch (Throwable t){ |
70 | System.out.println("Exception: " + t.toString()); | 70 | System.out.println("Exception: " + t.toString()); |
71 | + Snackbar.make(getActivity().findViewById(R.id.coordinator), "WTF, le cancer est dans l'application!! " + t.toString(), Snackbar.LENGTH_INDEFINITE).show(); | ||
71 | } | 72 | } |
72 | 73 | ||
73 | return ret; | 74 | return ret; |