android: Replace option to reload CA certificates with CA certificate view
authorTobias Brunner <tobias@strongswan.org>
Fri, 30 May 2014 15:46:15 +0000 (17:46 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 22 Jul 2014 08:41:50 +0000 (10:41 +0200)
The reload option will be added there.

src/frontends/android/res/menu/main.xml
src/frontends/android/src/org/strongswan/android/ui/MainActivity.java

index 4063110..3dde522 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-    Copyright (C) 2012 Tobias Brunner
+    Copyright (C) 2012-2014 Tobias Brunner
     Hochschule fuer Technik Rapperswil
 
     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" >
 
     <item
-        android:id="@+id/menu_reload_certs"
-        android:title="@string/reload_trusted_certs"
+        android:id="@+id/menu_manage_certs"
+        android:title="@string/trusted_certs_title"
         android:showAsAction="withText" />
 
     <item
index 3cf3950..a2ad80e 100644 (file)
@@ -101,7 +101,7 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
                bar.setDisplayShowTitleEnabled(false);
 
                /* load CA certificates in a background task */
-               new CertificateLoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, false);
+               new LoadCertificatesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
        }
 
        @Override
@@ -140,8 +140,9 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
        {
                switch (item.getItemId())
                {
-                       case R.id.menu_reload_certs:
-                               new CertificateLoadTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, true);
+                       case R.id.menu_manage_certs:
+                               Intent certIntent = new Intent(this, TrustedCertificatesActivity.class);
+                               startActivity(certIntent);
                                return true;
                        case R.id.menu_show_log:
                                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
                protected void onPreExecute()
@@ -290,12 +291,8 @@ public class MainActivity extends Activity implements OnVpnProfileSelectedListen
                        setProgressBarIndeterminateVisibility(true);
                }
                @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();
                }
                @Override