Commit 54e5cc85 authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Merge branch 'feature/connectionWithBadge' into develop

parents 967fc2d4 3a84c9e4
......@@ -151,21 +151,28 @@ public class MainActivity extends NFCActivity {
dialog.dismiss();
final ProgressDialog ringProgressDialog = ProgressDialog.show(MainActivity.this, "Connexion ...", "A faire ...", true);
ringProgressDialog.setCancelable(false);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (Exception e) {
if (registered) {
final ProgressDialog ringProgressDialog = ProgressDialog.show(MainActivity.this, "Connexion ...", "A faire ...", true);
ringProgressDialog.setCancelable(false);
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(2000);
} catch (Exception e) {
}
ringProgressDialog.dismiss();
}
ringProgressDialog.dismiss();
}
}).start();
}).start();
}
}
protected void badgeDialog(final String idBadge) {
if (!registered) {
dialog.errorDialog(getResources().getString(R.string.badge_connection), getResources().getString(R.string.badge_app_not_registered));
return;
}
final View pinView = getLayoutInflater().inflate(R.layout.dialog_badge, null);
final EditText pinInput = pinView.findViewById(R.id.input_pin);
......@@ -212,6 +219,9 @@ public class MainActivity extends NFCActivity {
.setPositiveButton(R.string.connexion, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
if (usernameInput.getText().toString().equals("") || passwordInput.getText().toString().equals("")) {
if (!usernameInput.getText().toString().equals(""))
casConnexion.setUsername(usernameInput.getText().toString());
Toast.makeText(MainActivity.this, R.string.username_and_password_required, Toast.LENGTH_SHORT).show();
dialog.cancel();
connectDialog();
......@@ -230,13 +240,6 @@ public class MainActivity extends NFCActivity {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
if (!usernameInput.getText().toString().equals(""))
casConnexion.setUsername(usernameInput.getText().toString());
}
});
dialog.createDialog(alertDialogBuilder, usernameInput.getText().toString().isEmpty() ? usernameInput : passwordInput);
......
......@@ -23,8 +23,8 @@ public class HTTPRequest {
public HttpURLConnection request;
public String response;
static Map<String, String> args;
static Map<String, String> cookies;
public Map<String, String> args;
public static Map<String, String> cookies;
public HTTPRequest(final String url) {
this.url = url;
......
......@@ -31,4 +31,6 @@
<string name="cas_error_connection">Login et/ou mot de passe non reconnu par le CAS</string>
<string name="cas_error_service_adding">Une erreur a été détectée lors de l\'ajout du service</string>
<string name="cas_error_service_connection">Erreur lors de la connexion au service depuis le CAS</string>
<string name="badge_connection">Connexion via badge</string>
<string name="badge_app_not_registered">Il est nécessaire que l\'application soit enregistrée pour permettre la connexion via badge</string>
</resources>
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