]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
android: Add simple activity for the selection of apps
authorTobias Brunner <tobias@strongswan.org>
Tue, 27 Jun 2017 13:13:30 +0000 (15:13 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 3 Jul 2017 08:27:54 +0000 (10:27 +0200)
src/frontends/android/app/src/main/AndroidManifest.xml
src/frontends/android/app/src/main/java/org/strongswan/android/ui/SelectedApplicationsActivity.java [new file with mode: 0644]
src/frontends/android/app/src/main/res/values-de/strings.xml
src/frontends/android/app/src/main/res/values-pl/strings.xml
src/frontends/android/app/src/main/res/values-ru/strings.xml
src/frontends/android/app/src/main/res/values-ua/strings.xml
src/frontends/android/app/src/main/res/values-zh-rCN/strings.xml
src/frontends/android/app/src/main/res/values-zh-rTW/strings.xml
src/frontends/android/app/src/main/res/values/strings.xml

index bc2de9af7a4b0280d01277d4b1bd05e95caaed8b..c7f745b70792adf753bf612c528ede4285231104 100644 (file)
             android:name=".ui.TrustedCertificatesActivity"
             android:label="@string/trusted_certs_title" >
         </activity>
+        <activity
+            android:name=".ui.SelectedApplicationsActivity"
+            android:label="@string/profile_select_apps" >
+        </activity>
         <activity
             android:name=".ui.LogActivity"
             android:label="@string/log_title" >
diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/SelectedApplicationsActivity.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/SelectedApplicationsActivity.java
new file mode 100644 (file)
index 0000000..db2e566
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2017 Tobias Brunner
+ * HSR 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.
+ */
+
+package org.strongswan.android.ui;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.annotation.Nullable;
+import android.support.v4.app.FragmentManager;
+import android.support.v7.app.ActionBar;
+import android.support.v7.app.AppCompatActivity;
+import android.view.MenuItem;
+
+import org.strongswan.android.data.VpnProfileDataSource;
+
+public class SelectedApplicationsActivity extends AppCompatActivity
+{
+       private static final String LIST_TAG = "ApplicationList";
+       private SelectedApplicationsListFragment mApps;
+
+       @Override
+       protected void onCreate(@Nullable Bundle savedInstanceState)
+       {
+               super.onCreate(savedInstanceState);
+
+               ActionBar actionBar = getSupportActionBar();
+               actionBar.setDisplayHomeAsUpEnabled(true);
+
+               FragmentManager fm = getSupportFragmentManager();
+               mApps = (SelectedApplicationsListFragment)fm.findFragmentByTag(LIST_TAG);
+               if (mApps == null)
+               {
+                       mApps = new SelectedApplicationsListFragment();
+                       fm.beginTransaction().add(android.R.id.content, mApps, LIST_TAG).commit();
+               }
+       }
+
+       @Override
+       public boolean onOptionsItemSelected(MenuItem item)
+       {
+               switch (item.getItemId())
+               {
+                       case android.R.id.home:
+                               prepareResult();
+                               finish();
+                               return true;
+               }
+               return super.onOptionsItemSelected(item);
+       }
+
+       @Override
+       public void onBackPressed()
+       {
+               prepareResult();
+               super.onBackPressed();
+       }
+
+       private void prepareResult()
+       {
+               Intent data = new Intent();
+               data.putExtra(VpnProfileDataSource.KEY_SELECTED_APPS_LIST, mApps.getSelectedApplications());
+               setResult(RESULT_OK, data);
+       }
+}
index b981375ff1ef7f2286a440e2146c5da4e2d21c75..ca22f78b53ebf13da04f651677162c3f03bf783d 100644 (file)
@@ -87,6 +87,7 @@
     <string name="profile_included_subnets_hint">Nur Verkehr in die spezifizierten Subnetze wird via VPN geleitet, der Rest wird behandelt, als ob kein VPN vorhanden wäre (mit Leerzeichen getrennt, z.B. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Ausgeschlossene Subnetze</string>
     <string name="profile_excluded_subnets_hint">Verkehr in diese Subnetze wird vom VPN ausgeschlossen und behandelt, als ob kein VPN vorhanden wäre (mit Leerzeichen getrennt, z.B. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Apps auswählen</string>
     <string name="profile_import">VPN Profile importieren</string>
     <string name="profile_import_failed">VPN Profil-Import fehlgeschlagen</string>
     <string name="profile_import_failed_detail">VPN Profil-Import fehlgeschlagen: %1$s</string>
index 6924aecabbd979592abf51d87675b391b3256283..1708f6edf97422d2bc14c5aff71b2b5073916a11 100644 (file)
@@ -87,6 +87,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">Import VPN profile</string>
     <string name="profile_import_failed">Failed to import VPN profile</string>
     <string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>
index 0d117b70b52a5ede05127cd44a309ed765260f79..0183e0306a97397ce91bbfb98f0e96cbd395c0ac 100644 (file)
@@ -84,6 +84,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">Import VPN profile</string>
     <string name="profile_import_failed">Failed to import VPN profile</string>
     <string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>
index 22e8da227be7f513b635a387f2fa66048fe93f83..156300d3eb596c12d46fa4bf913b0cb4105f1d48 100644 (file)
@@ -85,6 +85,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">Import VPN profile</string>
     <string name="profile_import_failed">Failed to import VPN profile</string>
     <string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>
index 8df905b829b7660406e1be98e5f3c340291bc2cd..119d462cc7af245edcb5a3324883011bdb29e049 100644 (file)
@@ -84,6 +84,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">导入VPN配置</string>
     <string name="profile_import_failed">导入VPN配置失败</string>
     <string name="profile_import_failed_detail">导入VPN配置失败: %1$s</string>
index 1aa060587c3f0d57db4e9aa76203205a8cacecc0..2b0ce6b2bc534078502218e4f0377f336a29b470 100644 (file)
@@ -84,6 +84,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">匯入VPN設定檔</string>
     <string name="profile_import_failed">匯入VPN設定檔失敗</string>
     <string name="profile_import_failed_detail">匯入VPN設定檔失敗: %1$s</string>
index 3b35306da501d69dd92c74e1b4b4b9f5b2bdb8de..e9a62f03c3cf9f5a7415fff9f46e447e0d3edf41 100644 (file)
@@ -87,6 +87,7 @@
     <string name="profile_included_subnets_hint">Only route traffic to specific subnets via VPN, everything else is routed as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
     <string name="profile_excluded_subnets_label">Excluded subnets</string>
     <string name="profile_excluded_subnets_hint">Traffic to these subnets will not be routed via VPN, but as if there was no VPN (separated by spaces, e.g. \"192.168.1.0/24 2001:db8::/64\")</string>
+    <string name="profile_select_apps">Select applications</string>
     <string name="profile_import">Import VPN profile</string>
     <string name="profile_import_failed">Failed to import VPN profile</string>
     <string name="profile_import_failed_detail">Failed to import VPN profile: %1$s</string>