summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-08-15 11:30:14 +0200
committercyBerta <richy@cyborgsociety.org>2013-11-15 23:21:40 +0100
commit5fb26d4c18cad06190e99879eaceef15a1aa58e0 (patch)
tree52f194722078201848c0db4f8118d7d55e764c5f /src
parent2013db973559e0b816b8dc8e45310b4acc8ff196 (diff)
Login and Logout progressbars advance correctly.
Next step: prettify.
Diffstat (limited to 'src')
-rw-r--r--src/se/leap/bitmaskclient/Dashboard.java26
-rw-r--r--src/se/leap/bitmaskclient/ProviderAPI.java2
2 files changed, 15 insertions, 13 deletions
diff --git a/src/se/leap/bitmaskclient/Dashboard.java b/src/se/leap/bitmaskclient/Dashboard.java
index 30fa512c..0e8eb0a3 100644
--- a/src/se/leap/bitmaskclient/Dashboard.java
+++ b/src/se/leap/bitmaskclient/Dashboard.java
@@ -267,6 +267,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
//if(mProgressDialog != null) mProgressDialog.dismiss();
mProgressBar.setVisibility(ProgressBar.VISIBLE);
+ mProgressBar.setMax(4);
//mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.authenticating_title), getResources().getString(R.string.authenticating_message), true);
startService(provider_API_command);
}
@@ -294,8 +295,10 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters);
provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver);
- if(mProgressDialog != null) mProgressDialog.dismiss();
- mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.logout_title), getResources().getString(R.string.logout_message), true);
+ //if(mProgressDialog != null) mProgressDialog.dismiss();
+ //mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.logout_title), getResources().getString(R.string.logout_message), true);
+ mProgressBar.setVisibility(ProgressBar.VISIBLE);
+ mProgressBar.setMax(1);
startService(provider_API_command);
}
@@ -348,11 +351,7 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
setResult(RESULT_OK);
authed_eip = true;
-<<<<<<< HEAD:src/se/leap/bitmaskclient/Dashboard.java
ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip);
-=======
- ConfigHelper.saveSharedPref(EIP.AUTHED, authed_eip);
->>>>>>> 53c2704... Authenticated status remembered after exit.:src/se/leap/leapclient/Dashboard.java
invalidateOptionsMenu();
mProgressBar.setVisibility(ProgressBar.GONE);
@@ -364,25 +363,26 @@ public class Dashboard extends Activity implements LogInDialog.LogInDialogInterf
mProgressBar.setVisibility(ProgressBar.GONE);
} else if(resultCode == ProviderAPI.LOGOUT_SUCCESSFUL) {
authed_eip = false;
-<<<<<<< HEAD:src/se/leap/bitmaskclient/Dashboard.java
ConfigHelper.saveSharedPref(EIP.AUTHED_EIP, authed_eip);
-=======
- ConfigHelper.saveSharedPref(EIP.AUTHED, authed_eip);
->>>>>>> 53c2704... Authenticated status remembered after exit.:src/se/leap/leapclient/Dashboard.java
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ mProgressBar.setProgress(0);
invalidateOptionsMenu();
setResult(RESULT_OK);
mProgressDialog.dismiss();
} else if(resultCode == ProviderAPI.LOGOUT_FAILED) {
setResult(RESULT_CANCELED);
- mProgressDialog.dismiss();
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ mProgressBar.setProgress(0);
Toast.makeText(getApplicationContext(), R.string.log_out_failed_message, Toast.LENGTH_LONG).show();
} else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
setResult(RESULT_OK);
- mProgressDialog.dismiss();
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ mProgressBar.setProgress(0);
Toast.makeText(getApplicationContext(), R.string.successful_authed_cert_downloaded_message, Toast.LENGTH_LONG).show();
} else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
setResult(RESULT_CANCELED);
- mProgressDialog.dismiss();
+ mProgressBar.setVisibility(ProgressBar.GONE);
+ mProgressBar.setProgress(0);
Toast.makeText(getApplicationContext(), R.string.authed_cert_download_failed_message, Toast.LENGTH_LONG).show();
}
}
diff --git a/src/se/leap/bitmaskclient/ProviderAPI.java b/src/se/leap/bitmaskclient/ProviderAPI.java
index cb2db6bf..a553851b 100644
--- a/src/se/leap/bitmaskclient/ProviderAPI.java
+++ b/src/se/leap/bitmaskclient/ProviderAPI.java
@@ -739,12 +739,14 @@ public class ProviderAPI extends IntentService {
private boolean logOut(Bundle task) {
try {
String delete_url = task.getString(Provider.API_URL) + "/logout";
+ int progress = 0;
HttpsURLConnection urlConnection = (HttpsURLConnection)new URL(delete_url).openConnection();
urlConnection.setRequestMethod("DELETE");
urlConnection.setSSLSocketFactory(getProviderSSLSocketFactory());
int responseCode = urlConnection.getResponseCode();
+ broadcast_progress(progress++);
Log.d("logout", Integer.toString(responseCode));
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block