Commit 1e1094f2 authored by djamel's avatar djamel

affiche à l'écran si le billet est valide ou non

parent f10377a5
...@@ -8,7 +8,6 @@ import android.content.Intent; ...@@ -8,7 +8,6 @@ import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
...@@ -179,9 +178,21 @@ public class Read_QR_Code extends ActionBarActivity implements View.OnClickListe ...@@ -179,9 +178,21 @@ public class Read_QR_Code extends ActionBarActivity implements View.OnClickListe
client.post(this, server + "/validate", entity, "application/json", client.post(this, server + "/validate", entity, "application/json",
new JsonHttpResponseHandler() { new JsonHttpResponseHandler() {
@Override @Override
public void onSuccess(int statusCode, Header[] headers, JSONArray response) { public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
Log.i("debug", "toto "); try {
Log.i("debug", response.toString()); if (response.getBoolean("valid")) {
display(getString(R.string.ebillet_true + response.getInt
("avaliable")), true);
}
else if (response.getInt("avaliable") < 0) {
display(getString(R.string.ebillet_sizeOff), false);
}
else {
display(getString(R.string.ebillet_false), false);
}
} catch (JSONException e) {
e.printStackTrace();
}
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment