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; ...@@ -17,7 +17,7 @@ import fr.utc.simde.payutc.tools.NemopaySession;
*/ */
public abstract class BaseActivity extends NFCActivity { 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 Dialog dialog;
protected static NemopaySession nemopaySession; protected static NemopaySession nemopaySession;
protected static CASConnexion casConnexion; protected static CASConnexion casConnexion;
...@@ -76,7 +76,9 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -76,7 +76,9 @@ public abstract class BaseActivity extends NFCActivity {
throw new Exception("JSON unexpected"); throw new Exception("JSON unexpected");
if (foundationList.size() == 0) { if (foundationList.size() == 0) {
dialog.stopLoading();
fatal(activity, getString(R.string.information_collection), nemopaySession.getUsername() + " " + getString(R.string.user_no_rights)); fatal(activity, getString(R.string.information_collection), nemopaySession.getUsername() + " " + getString(R.string.user_no_rights));
return; return;
} }
...@@ -85,6 +87,13 @@ public abstract class BaseActivity extends NFCActivity { ...@@ -85,6 +87,13 @@ public abstract class BaseActivity extends NFCActivity {
throw new Exception("Unexpected JSON"); 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 intent = new Intent(activity, FoundationListActivity.class);
intent.putExtra("foundationList", response); intent.putExtra("foundationList", response);
dialog.stopLoading(); dialog.stopLoading();
......
...@@ -62,7 +62,7 @@ public class FoundationListActivity extends BaseActivity { ...@@ -62,7 +62,7 @@ public class FoundationListActivity extends BaseActivity {
throw new Exception("Unexpected JSON"); throw new Exception("Unexpected JSON");
foundationButton.setText(foundation.get("name").textValue()); 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); linearLayout.addView(foundationButton);
} }
......
Supports Markdown
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