From 20fdb2d42b50bb0b49f24933edec166ea94d9c56 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 4 Mar 2019 17:34:12 +0100 Subject: [PATCH 01/10] android: Update Gradle plugin --- src/frontends/android/build.gradle | 2 +- .../android/gradle/wrapper/gradle-wrapper.properties | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontends/android/build.gradle b/src/frontends/android/build.gradle index db0b8a292f..970bc062c6 100644 --- a/src/frontends/android/build.gradle +++ b/src/frontends/android/build.gradle @@ -4,7 +4,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.1.4' + classpath 'com.android.tools.build:gradle:3.3.2' } } diff --git a/src/frontends/android/gradle/wrapper/gradle-wrapper.properties b/src/frontends/android/gradle/wrapper/gradle-wrapper.properties index 8a32ae179a..a0a4bbe2bb 100644 --- a/src/frontends/android/gradle/wrapper/gradle-wrapper.properties +++ b/src/frontends/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Jun 04 11:56:43 CEST 2018 +#Mon Mar 04 17:15:25 CET 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip From da4e08909e33b2af545f88ba65002d77e6e052ea Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Mon, 4 Mar 2019 17:34:30 +0100 Subject: [PATCH 02/10] android: Remove buildToolsVersion Finally a default is configured and we don't have to update this constantly. --- src/frontends/android/app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/src/frontends/android/app/build.gradle b/src/frontends/android/app/build.gradle index f5b13a8fd6..399de1faa5 100644 --- a/src/frontends/android/app/build.gradle +++ b/src/frontends/android/app/build.gradle @@ -2,7 +2,6 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 - buildToolsVersion '27.0.3' defaultConfig { applicationId "org.strongswan.android" From 94cb3b4ddd7a035be7fbe38bc0aa8ddb7d156c67 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Tue, 5 Mar 2019 16:40:20 +0100 Subject: [PATCH 03/10] android: Add menu option to copy a profile Some users requests something like that to use different server IPs. Interestingly, it's actually also possible to configure multiple hostnames/IPs, separated by commas, as server address in the profile, which are then tried one after another. It's also useful when testing stuff to quickly compare the behavior with some setting changed between two otherwise identical profiles. --- .../android/ui/VpnProfileListFragment.java | 24 ++++++++++++++++++- .../main/res/menu/profile_list_context.xml | 5 +++- .../app/src/main/res/values-de/strings.xml | 2 ++ .../app/src/main/res/values-pl/strings.xml | 2 ++ .../app/src/main/res/values-ru/strings.xml | 2 ++ .../app/src/main/res/values-ua/strings.xml | 2 ++ .../src/main/res/values-zh-rCN/strings.xml | 2 ++ .../src/main/res/values-zh-rTW/strings.xml | 2 ++ .../app/src/main/res/values/strings.xml | 2 ++ 9 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileListFragment.java b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileListFragment.java index 4a3ed9f194..904b4341c1 100644 --- a/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileListFragment.java +++ b/src/frontends/android/app/src/main/java/org/strongswan/android/ui/VpnProfileListFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2018 Tobias Brunner + * Copyright (C) 2012-2019 Tobias Brunner * Copyright (C) 2012 Giuliano Grassi * Copyright (C) 2012 Ralf Sager * HSR Hochschule fuer Technik Rapperswil @@ -49,6 +49,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; +import java.util.UUID; public class VpnProfileListFragment extends Fragment { @@ -230,11 +231,13 @@ public class VpnProfileListFragment extends Fragment private final MultiChoiceModeListener mVpnProfileSelected = new MultiChoiceModeListener() { private MenuItem mEditProfile; + private MenuItem mCopyProfile; @Override public boolean onPrepareActionMode(ActionMode mode, Menu menu) { mEditProfile.setEnabled(mSelected.size() == 1); + mCopyProfile.setEnabled(mEditProfile.isEnabled()); return true; } @@ -250,6 +253,7 @@ public class VpnProfileListFragment extends Fragment MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.profile_list_context, menu); mEditProfile = menu.findItem(R.id.edit_profile); + mCopyProfile = menu.findItem(R.id.copy_profile); mode.setTitle(R.string.select_profiles); return true; } @@ -268,6 +272,24 @@ public class VpnProfileListFragment extends Fragment startActivityForResult(connectionIntent, EDIT_REQUEST); break; } + case R.id.copy_profile: + { + int position = mSelected.iterator().next(); + VpnProfile profile = (VpnProfile)mListView.getItemAtPosition(position); + profile = profile.clone(); + profile.setUUID(UUID.randomUUID()); + profile.setName(String.format(getString(R.string.copied_name), profile.getName())); + mDataSource.insertProfile(profile); + + Intent intent = new Intent(Constants.VPN_PROFILES_CHANGED); + intent.putExtra(Constants.VPN_PROFILES_SINGLE, profile.getId()); + LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent); + + Intent connectionIntent = new Intent(getActivity(), VpnProfileDetailActivity.class); + connectionIntent.putExtra(VpnProfileDataSource.KEY_ID, profile.getId()); + startActivityForResult(connectionIntent, EDIT_REQUEST); + break; + } case R.id.delete_profile: { ArrayList profiles = new ArrayList<>(); diff --git a/src/frontends/android/app/src/main/res/menu/profile_list_context.xml b/src/frontends/android/app/src/main/res/menu/profile_list_context.xml index 8957c74134..0018988426 100644 --- a/src/frontends/android/app/src/main/res/menu/profile_list_context.xml +++ b/src/frontends/android/app/src/main/res/menu/profile_list_context.xml @@ -1,6 +1,6 @@