--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2012 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>
\ No newline at end of file
package org.strongswan.android.ui;
+import org.strongswan.android.R;
import org.strongswan.android.logic.TrustedCertificateManager;
import android.app.ActionBar;
import android.content.Intent;
import android.net.VpnService;
import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
import android.view.Window;
public class MainActivity extends Activity
}).start();
}
- private void startVpnService()
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu)
+ {
+ MenuInflater inflater = getMenuInflater();
+ inflater.inflate(R.menu.main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
+ switch (item.getItemId())
+ {
+ case R.id.menu_reload_certs:
+ setProgressBarIndeterminateVisibility(true);
+ new Thread(new Runnable() {
+ @Override
+ public void run()
+ {
+ TrustedCertificateManager.getInstance().reload();
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run()
+ {
+ setProgressBarIndeterminateVisibility(false);
+ }
+ });
+ }
+ }).start();
+ return true;
+ default:
+ return super.onOptionsItemSelected(item);
+ }
+ }
+
+ protected void prepareVpnService()
{
Intent intent = VpnService.prepare(this);
if (intent != null)