Commit 2a02f23b authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Foundation management

Preparation
Optimization
parent 0173795e
......@@ -17,7 +17,7 @@ import fr.utc.simde.payutc.tools.NemopaySession;
*/
public abstract class BaseActivity extends NFCActivity {
private static final String LOG_TAG = "_LOG_TAG";
private static final String LOG_TAG = "_BaseActivity";
protected static Dialog dialog;
protected static NemopaySession nemopaySession;
protected static CASConnexion casConnexion;
......@@ -76,7 +76,9 @@ public abstract class BaseActivity extends NFCActivity {
throw new Exception("JSON unexpected");
if (foundationList.size() == 0) {
dialog.stopLoading();
fatal(activity, getString(R.string.information_collection), nemopaySession.getUsername() + " " + getString(R.string.user_no_rights));
return;
}
......@@ -85,6 +87,13 @@ public abstract class BaseActivity extends NFCActivity {
throw new Exception("Unexpected JSON");
}
if (foundationList.size() == 1) {
dialog.stopLoading();
nemopaySession.setFoundation(foundationList.get(0).get("fun_id").intValue());
Log.d(LOG_TAG, String.valueOf(foundationList.get(0).get("fun_id").intValue()));
return;
}
Intent intent = new Intent(activity, FoundationListActivity.class);
intent.putExtra("foundationList", response);
dialog.stopLoading();
......
......@@ -62,7 +62,7 @@ public class FoundationListActivity extends BaseActivity {
throw new Exception("Unexpected JSON");
foundationButton.setText(foundation.get("name").textValue());
foundationButton.setOnClickListener(new onClickFoundation(foundation.get("fun_id").asInt()));
foundationButton.setOnClickListener(new onClickFoundation(foundation.get("fun_id").intValue()));
linearLayout.addView(foundationButton);
}
......
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