android: Add option to reload CA certificates to TrustedCertificatesActivity
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2014 Tobias Brunner
|
||||
Hochschule fuer Technik Rapperswil
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_reload_certs"
|
||||
android:title="@string/reload_trusted_certs"
|
||||
android:showAsAction="withText" />
|
||||
|
||||
</menu>
|
||||
@@ -20,7 +20,6 @@
|
||||
<!-- Application -->
|
||||
<string name="app_name">strongSwan VPN Client</string>
|
||||
<string name="main_activity_name">strongSwan</string>
|
||||
<string name="reload_trusted_certs">CA-Zertifikate neu laden</string>
|
||||
<string name="show_log">Log anzeigen</string>
|
||||
<string name="search">Suchen</string>
|
||||
<string name="vpn_not_supported_title">VPN nicht unterstützt</string>
|
||||
@@ -76,6 +75,7 @@
|
||||
<!-- Trusted certificate selection -->
|
||||
<string name="trusted_certs_title">CA-Zertifikate</string>
|
||||
<string name="no_certificates">Keine Zertifikate</string>
|
||||
<string name="reload_trusted_certs">CA-Zertifikate neu laden</string>
|
||||
<string name="system_tab">System</string>
|
||||
<string name="user_tab">Benutzer</string>
|
||||
<string name="local_tab">Importiert</string>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<!-- Application -->
|
||||
<string name="app_name">strongSwan klient VPN</string>
|
||||
<string name="main_activity_name">strongSwan</string>
|
||||
<string name="reload_trusted_certs">Przeładuj certyfikaty CA</string>
|
||||
<string name="show_log">Pokaż log</string>
|
||||
<string name="search">Szukaj</string>
|
||||
<string name="vpn_not_supported_title">Nie obsługiwany VPN</string>
|
||||
@@ -76,6 +75,7 @@
|
||||
<!-- Trusted certificate selection -->
|
||||
<string name="trusted_certs_title">Certyfikaty CA</string>
|
||||
<string name="no_certificates">Brak certyfikatów</string>
|
||||
<string name="reload_trusted_certs">Przeładuj certyfikaty CA</string>
|
||||
<string name="system_tab">System</string>
|
||||
<string name="user_tab">Użytkownik</string>
|
||||
<string name="local_tab">Imported</string>
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<!-- Application -->
|
||||
<string name="app_name">Клиент strongSwan VPN</string>
|
||||
<string name="main_activity_name">strongSwan</string>
|
||||
<string name="reload_trusted_certs">Обновить сертификат CA</string>
|
||||
<string name="show_log">Журнал</string>
|
||||
<string name="search">Поиск</string>
|
||||
<string name="vpn_not_supported_title">VPN не поддерживается</string>
|
||||
@@ -73,6 +72,7 @@
|
||||
<!-- Trusted certificate selection -->
|
||||
<string name="trusted_certs_title">Сертификаты CA</string>
|
||||
<string name="no_certificates">Нет доступных сертификатов</string>
|
||||
<string name="reload_trusted_certs">Обновить сертификат CA</string>
|
||||
<string name="system_tab">Система</string>
|
||||
<string name="user_tab">Пользователь</string>
|
||||
<string name="local_tab">Imported</string>
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<!-- Application -->
|
||||
<string name="app_name">strongSwan VPN клієнт</string>
|
||||
<string name="main_activity_name">strongSwan</string>
|
||||
<string name="reload_trusted_certs">Перезавантажити CA сертифікати</string>
|
||||
<string name="show_log">Перегляд журналу</string>
|
||||
<string name="search">Пошук</string>
|
||||
<string name="vpn_not_supported_title">VPN не підтримуеться</string>
|
||||
@@ -74,6 +73,7 @@
|
||||
<!-- Trusted certificate selection -->
|
||||
<string name="trusted_certs_title">Сертифікати CA</string>
|
||||
<string name="no_certificates">Немає сертифікатів</string>
|
||||
<string name="reload_trusted_certs">Перезавантажити CA сертифікати</string>
|
||||
<string name="system_tab">Система</string>
|
||||
<string name="user_tab">Користувач</string>
|
||||
<string name="local_tab">Imported</string>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<!-- Application -->
|
||||
<string name="app_name">strongSwan VPN Client</string>
|
||||
<string name="main_activity_name">strongSwan</string>
|
||||
<string name="reload_trusted_certs">Reload CA certificates</string>
|
||||
<string name="show_log">View log</string>
|
||||
<string name="search">Search</string>
|
||||
<string name="vpn_not_supported_title">VPN not supported</string>
|
||||
@@ -76,6 +75,7 @@
|
||||
<!-- Trusted certificate selection -->
|
||||
<string name="trusted_certs_title">CA certificates</string>
|
||||
<string name="no_certificates">No certificates</string>
|
||||
<string name="reload_trusted_certs">Reload CA certificates</string>
|
||||
<string name="system_tab">System</string>
|
||||
<string name="user_tab">User</string>
|
||||
<string name="local_tab">Imported</string>
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.strongswan.android.ui;
|
||||
|
||||
import org.strongswan.android.R;
|
||||
import org.strongswan.android.data.VpnProfileDataSource;
|
||||
import org.strongswan.android.logic.TrustedCertificateManager;
|
||||
import org.strongswan.android.logic.TrustedCertificateManager.TrustedCertificateSource;
|
||||
import org.strongswan.android.security.TrustedCertificateEntry;
|
||||
|
||||
@@ -26,8 +27,11 @@ import android.app.Activity;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Window;
|
||||
|
||||
public class TrustedCertificatesActivity extends Activity implements TrustedCertificateListFragment.OnTrustedCertificateSelectedListener
|
||||
{
|
||||
@@ -38,6 +42,7 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
|
||||
setContentView(R.layout.trusted_certificates_activity);
|
||||
|
||||
ActionBar actionBar = getActionBar();
|
||||
@@ -71,6 +76,13 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
|
||||
outState.putInt("tab", getActionBar().getSelectedNavigationIndex());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
getMenuInflater().inflate(R.menu.certificates, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
@@ -79,6 +91,9 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
|
||||
case android.R.id.home:
|
||||
finish();
|
||||
return true;
|
||||
case R.id.menu_reload_certs:
|
||||
new ReloadCertificatesTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
return true;
|
||||
}
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
@@ -150,4 +165,26 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
|
||||
/* nothing to be done */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class that reloads the cached CA certificates.
|
||||
*/
|
||||
private class ReloadCertificatesTask extends AsyncTask<Void, Void, TrustedCertificateManager>
|
||||
{
|
||||
@Override
|
||||
protected void onPreExecute()
|
||||
{
|
||||
setProgressBarIndeterminateVisibility(true);
|
||||
}
|
||||
@Override
|
||||
protected TrustedCertificateManager doInBackground(Void... params)
|
||||
{
|
||||
return TrustedCertificateManager.getInstance().reload();
|
||||
}
|
||||
@Override
|
||||
protected void onPostExecute(TrustedCertificateManager result)
|
||||
{
|
||||
setProgressBarIndeterminateVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user