android: Replace option to reload CA certificates with CA certificate view

The reload option will be added there.
This commit is contained in:
Tobias Brunner
2014-07-22 10:41:50 +02:00
parent 1353f08fbc
commit 2312985b2a
2 changed files with 10 additions and 13 deletions
+3 -3
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (C) 2012 Tobias Brunner Copyright (C) 2012-2014 Tobias Brunner
Hochschule fuer Technik Rapperswil Hochschule fuer Technik Rapperswil
This program is free software; you can redistribute it and/or modify it This program is free software; you can redistribute it and/or modify it
@@ -16,8 +16,8 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android" > <menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item <item
android:id="@+id/menu_reload_certs" android:id="@+id/menu_manage_certs"
android:title="@string/reload_trusted_certs" android:title="@string/trusted_certs_title"
android:showAsAction="withText" /> android:showAsAction="withText" />
<item <item
@@ -101,7 +101,7 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
bar.setDisplayShowTitleEnabled(false); bar.setDisplayShowTitleEnabled(false);
/* load CA certificates in a background task */ /* load CA certificates in a background task */
new CertificateLoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, false); new LoadCertificatesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@Override @Override
@@ -140,8 +140,9 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
{ {
switch (item.getItemId()) switch (item.getItemId())
{ {
case R.id.menu_reload_certs: case R.id.menu_manage_certs:
new CertificateLoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, true); Intent certIntent = new Intent(this, TrustedCertificatesActivity.class);
startActivity(certIntent);
return true; return true;
case R.id.menu_show_log: case R.id.menu_show_log:
Intent logIntent = new Intent(this, LogActivity.class); Intent logIntent = new Intent(this, LogActivity.class);
@@ -280,9 +281,9 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
} }
/** /**
* Class that loads or reloads the cached CA certificates. * Class that loads the cached CA certificates.
*/ */
private class CertificateLoadTask extends AsyncTask<Boolean, Void, TrustedCertificateManager> private class LoadCertificatesTask extends AsyncTask<Void, Void, TrustedCertificateManager>
{ {
@Override @Override
protected void onPreExecute() protected void onPreExecute()
@@ -290,12 +291,8 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
setProgressBarIndeterminateVisibility(true); setProgressBarIndeterminateVisibility(true);
} }
@Override @Override
protected TrustedCertificateManager doInBackground(Boolean... params) protected TrustedCertificateManager doInBackground(Void... params)
{ {
if (params.length > 0 && params[0])
{ /* force a reload of the certificates */
return TrustedCertificateManager.getInstance().reload();
}
return TrustedCertificateManager.getInstance().load(); return TrustedCertificateManager.getInstance().load();
} }
@Override @Override