summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-06-03 09:52:21 +0200
committercyBerta <cyberta@riseup.net>2017-09-20 18:08:19 +0200
commit1628d55103410aeed67311ebb0ffc1719a41e79f (patch)
treee58d99ed563271a3a9c05bad87f6e22ed2e0561f /main
parentd6d3bba6f0c070d151835f33ec2ec71a40f8a209 (diff)
Remove ics-openvpn dependencies in files needed by Bitmask
Diffstat (limited to 'main')
m---------main/openvpn0
-rw-r--r--main/src/main/java/de/blinkt/openvpn/LaunchVPN.java125
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java5
-rw-r--r--main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java9
-rw-r--r--main/src/main/res/menu/logmenu.xml8
-rw-r--r--main/src/main/res/values-v21/refs.xml10
-rw-r--r--main/src/main/res/values/refs.xml10
7 files changed, 49 insertions, 118 deletions
diff --git a/main/openvpn b/main/openvpn
-Subproject 9fa0b9a7e1240170f964bbca6a3d4f608b6325b
+Subproject da9d62d4d329d3fc7b012bc8b9d213d9a4685a8
diff --git a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java
index 44e355ff..8ffbbfd0 100644
--- a/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java
+++ b/main/src/main/java/de/blinkt/openvpn/LaunchVPN.java
@@ -5,6 +5,8 @@
package de.blinkt.openvpn;
+import se.leap.bitmaskclient.R;
+
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
@@ -74,6 +76,7 @@ public class LaunchVPN extends Activity {
public static final String EXTRA_NAME = "de.blinkt.openvpn.shortcutProfileName";
public static final String EXTRA_HIDELOG = "de.blinkt.openvpn.showNoLogWindow";
public static final String CLEARLOG = "clearlogconnect";
+ public static final String EXTRA_TEMP_VPN_PROFILE = "se.leap.bitmask.tempVpnProfile";
private static final int START_VPN_PROFILE = 70;
@@ -89,7 +92,7 @@ public class LaunchVPN extends Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- setContentView(R.layout.launchvpn);
+ // setContentView(R.layout.launchvpn);
startVpnFromIntent();
}
@@ -137,8 +140,10 @@ public class LaunchVPN extends Activity {
String shortcutUUID = intent.getStringExtra(EXTRA_KEY);
String shortcutName = intent.getStringExtra(EXTRA_NAME);
mhideLog = intent.getBooleanExtra(EXTRA_HIDELOG, false);
+ VpnProfile profileToConnect = (VpnProfile) intent.getExtras().getSerializable(EXTRA_TEMP_VPN_PROFILE);
+ if (profileToConnect == null)
+ profileToConnect = ProfileManager.get(this, shortcutUUID);
- VpnProfile profileToConnect = ProfileManager.get(this, shortcutUUID);
if (shortcutName != null && profileToConnect == null)
profileToConnect = ProfileManager.getInstance(this).getProfileByName(shortcutName);
@@ -154,108 +159,30 @@ public class LaunchVPN extends Activity {
}
}
- private void askForPW(final int type) {
-
- final EditText entry = new EditText(this);
-
- entry.setSingleLine();
- entry.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
- entry.setTransformationMethod(new PasswordTransformationMethod());
-
- AlertDialog.Builder dialog = new AlertDialog.Builder(this);
- dialog.setTitle(getString(R.string.pw_request_dialog_title, getString(type)));
- dialog.setMessage(getString(R.string.pw_request_dialog_prompt, mSelectedProfile.mName));
-
-
- @SuppressLint("InflateParams") final View userpwlayout = getLayoutInflater().inflate(R.layout.userpass, null, false);
-
- if (type == R.string.password) {
- ((EditText) userpwlayout.findViewById(R.id.username)).setText(mSelectedProfile.mUsername);
- ((EditText) userpwlayout.findViewById(R.id.password)).setText(mSelectedProfile.mPassword);
- ((CheckBox) userpwlayout.findViewById(R.id.save_password)).setChecked(!TextUtils.isEmpty(mSelectedProfile.mPassword));
- ((CheckBox) userpwlayout.findViewById(R.id.show_password)).setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
- @Override
- public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
- if (isChecked)
- ((EditText) userpwlayout.findViewById(R.id.password)).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
- else
- ((EditText) userpwlayout.findViewById(R.id.password)).setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
- }
- });
-
- dialog.setView(userpwlayout);
- } else {
- dialog.setView(entry);
- }
+ @Override
+ protected void onActivityResult (int requestCode, int resultCode, Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
- AlertDialog.Builder builder = dialog.setPositiveButton(android.R.string.ok,
- new OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
-
- if (type == R.string.password) {
- mSelectedProfile.mUsername = ((EditText) userpwlayout.findViewById(R.id.username)).getText().toString();
-
- String pw = ((EditText) userpwlayout.findViewById(R.id.password)).getText().toString();
- if (((CheckBox) userpwlayout.findViewById(R.id.save_password)).isChecked()) {
- mSelectedProfile.mPassword = pw;
- } else {
- mSelectedProfile.mPassword = null;
- mTransientAuthPW = pw;
- }
- } else {
- mTransientCertOrPCKS12PW = entry.getText().toString();
- }
- Intent intent = new Intent(LaunchVPN.this, OpenVPNStatusService.class);
- bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
- }
-
- });
- dialog.setNegativeButton(android.R.string.cancel,
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- VpnStatus.updateStateString("USER_VPN_PASSWORD_CANCELLED", "", R.string.state_user_vpn_password_cancelled,
- ConnectionStatus.LEVEL_NOTCONNECTED);
- finish();
- }
- });
-
- dialog.create().show();
+ if(requestCode==START_VPN_PROFILE) {
+ SharedPreferences prefs = Preferences.getDefaultSharedPreferences(this);
+ boolean showLogWindow = prefs.getBoolean("showlogwindow", true);
- }
+ if(!mhideLog && showLogWindow)
+ showLogWindow();
+ //TODO: check line below!
+ ProfileManager.updateLRU(this, mSelectedProfile);
+ VPNLaunchHelper.startOpenVpn(mSelectedProfile, getBaseContext());
+ finish();
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
+ } else if (resultCode == Activity.RESULT_CANCELED) {
+ // User does not want us to start, so we just vanish
+ VpnStatus.updateStateString("USER_VPN_PERMISSION_CANCELLED", "", R.string.state_user_vpn_permission_cancelled,
+ ConnectionStatus.LEVEL_NOTCONNECTED);
- if (requestCode == START_VPN_PROFILE) {
- if (resultCode == Activity.RESULT_OK) {
- int needpw = mSelectedProfile.needUserPWInput(mTransientCertOrPCKS12PW, mTransientAuthPW);
- if (needpw != 0) {
- VpnStatus.updateStateString("USER_VPN_PASSWORD", "", R.string.state_user_vpn_password,
- ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT);
- askForPW(needpw);
- } else {
- SharedPreferences prefs = Preferences.getDefaultSharedPreferences(this);
- boolean showLogWindow = prefs.getBoolean("showlogwindow", true);
-
- if (!mhideLog && showLogWindow)
- showLogWindow();
- ProfileManager.updateLRU(this, mSelectedProfile);
- VPNLaunchHelper.startOpenVpn(mSelectedProfile, getBaseContext());
- finish();
- }
- } else if (resultCode == Activity.RESULT_CANCELED) {
- // User does not want us to start, so we just vanish
- VpnStatus.updateStateString("USER_VPN_PERMISSION_CANCELLED", "", R.string.state_user_vpn_permission_cancelled,
- ConnectionStatus.LEVEL_NOTCONNECTED);
-
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
- VpnStatus.logError(R.string.nought_alwayson_warning);
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
+ VpnStatus.logError(R.string.nought_alwayson_warning);
- finish();
- }
+ finish();
}
}
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
index a4b7b480..542089be 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNService.java
@@ -52,7 +52,6 @@ import de.blinkt.openvpn.LaunchVPN;
import de.blinkt.openvpn.R;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.activities.DisconnectVPN;
-import de.blinkt.openvpn.activities.MainActivity;
import de.blinkt.openvpn.core.VpnStatus.ByteCountListener;
import de.blinkt.openvpn.core.VpnStatus.StateListener;
@@ -60,6 +59,8 @@ import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_CONNECTED;
import static de.blinkt.openvpn.core.ConnectionStatus.LEVEL_WAITING_FOR_USER_INPUT;
import static de.blinkt.openvpn.core.NetworkSpace.ipAddress;
+import se.leap.bitmaskclient.Dashboard;
+
public class OpenVPNService extends VpnService implements StateListener, Callback, ByteCountListener, IOpenVPNServiceInternal {
public static final String START_SERVICE = "de.blinkt.openvpn.START_SERVICE";
public static final String START_SERVICE_STICKY = "de.blinkt.openvpn.START_SERVICE_STICKY";
@@ -374,7 +375,7 @@ public class OpenVPNService extends VpnService implements StateListener, Callbac
PendingIntent getGraphPendingIntent() {
// Let the configure Button show the Log
- Class activityClass = MainActivity.class;
+ Class activityClass = Dashboard.class;
if (mNotificationActivityClass != null) {
activityClass = mNotificationActivityClass;
}
diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java b/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java
index e64ce2cd..e8aa0b51 100644
--- a/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java
+++ b/main/src/main/java/de/blinkt/openvpn/fragments/LogFragment.java
@@ -23,6 +23,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.Message;
+import android.preference.Preference;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable;
import android.text.SpannableString;
@@ -56,8 +57,6 @@ import de.blinkt.openvpn.LaunchVPN;
import de.blinkt.openvpn.R;
import de.blinkt.openvpn.VpnProfile;
import de.blinkt.openvpn.activities.DisconnectVPN;
-import de.blinkt.openvpn.activities.MainActivity;
-import de.blinkt.openvpn.activities.VPNPreferences;
import de.blinkt.openvpn.core.ConnectionStatus;
import de.blinkt.openvpn.core.OpenVPNManagement;
import de.blinkt.openvpn.core.OpenVPNService;
@@ -70,6 +69,8 @@ import de.blinkt.openvpn.core.VpnStatus.StateListener;
import static de.blinkt.openvpn.core.OpenVPNService.humanReadableByteCount;
+import se.leap.bitmaskclient.Dashboard;
+
public class LogFragment extends ListFragment implements StateListener, SeekBar.OnSeekBarChangeListener, RadioGroup.OnCheckedChangeListener, VpnStatus.ByteCountListener {
private static final String LOGTIMEFORMAT = "logtimeformat";
private static final int START_VPN_CONFIG = 0;
@@ -437,7 +438,7 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
VpnProfile lastConnectedprofile = ProfileManager.get(getActivity(), VpnStatus.getLastConnectedVPNProfile());
if (lastConnectedprofile != null) {
- Intent vprefintent = new Intent(getActivity(), VPNPreferences.class)
+ Intent vprefintent = new Intent(getActivity(), Dashboard.class)
.putExtra(VpnProfile.EXTRA_PROFILEUUID, lastConnectedprofile.getUUIDString());
startActivityForResult(vprefintent, START_VPN_CONFIG);
} else {
@@ -448,7 +449,7 @@ public class LogFragment extends ListFragment implements StateListener, SeekBar.
} else if (item.getItemId() == android.R.id.home) {
// This is called when the Home (Up) button is pressed
// in the Action Bar.
- Intent parentActivityIntent = new Intent(getActivity(), MainActivity.class);
+ Intent parentActivityIntent = new Intent(getActivity(), Dashboard.class);
parentActivityIntent.addFlags(
Intent.FLAG_ACTIVITY_CLEAR_TOP |
Intent.FLAG_ACTIVITY_NEW_TASK);
diff --git a/main/src/main/res/menu/logmenu.xml b/main/src/main/res/menu/logmenu.xml
index 90eba679..2709b723 100644
--- a/main/src/main/res/menu/logmenu.xml
+++ b/main/src/main/res/menu/logmenu.xml
@@ -37,6 +37,8 @@
android:id="@+id/edit_vpn"
android:alphabeticShortcut="e"
android:icon="@drawable/ic_menu_edit"
- android:showAsAction="ifRoom"
- android:title="@string/edit_vpn"/>
-</menu> \ No newline at end of file
+ android:showAsAction="withText|ifRoom"
+ android:title="@string/edit_vpn"
+ android:visible="false"/>
+
+</menu>
diff --git a/main/src/main/res/values-v21/refs.xml b/main/src/main/res/values-v21/refs.xml
index ae9be13f..1af5ba02 100644
--- a/main/src/main/res/values-v21/refs.xml
+++ b/main/src/main/res/values-v21/refs.xml
@@ -12,16 +12,16 @@
<drawable name="ic_menu_save">@drawable/ic_check_white_24dp</drawable>
<drawable name="ic_menu_view">@drawable/ic_filter_list_white_24dp</drawable>
<drawable name="ic_menu_delete">@drawable/ic_delete_white_24dp</drawable>
- <drawable name="ic_menu_copy">@drawable/ic_content_copy_white_24dp</drawable>
+<!-- <drawable name="ic_menu_copy">@drawable/ic_content_copy_white_24dp</drawable> -->
<drawable name="ic_menu_delete_grey">@drawable/ic_delete_grey600_24dp</drawable>
<drawable name="ic_menu_edit">@drawable/ic_edit_white_24dp</drawable>
- <drawable name="ic_menu_import">@drawable/ic_archive_white_24dp</drawable>
+<!-- <drawable name="ic_menu_import">@drawable/ic_archive_white_24dp</drawable> -->
<drawable name="vpn_item_edit">@drawable/ic_edit_grey600_24dp</drawable>
- <drawable name="ic_menu_add">@drawable/ic_add_circle_outline_white_24dp</drawable>
- <drawable name="ic_dialog_alert">@drawable/ic_warning_black_36dp</drawable>
+ <!--<drawable name="ic_menu_add">@drawable/ic_add_circle_outline_white_24dp</drawable>-->
+ <!-- <drawable name="ic_dialog_alert">@drawable/ic_warning_black_36dp</drawable>
<drawable name="ic_menu_add_grey">@drawable/ic_add_circle_outline_grey600_24dp</drawable>
<drawable name="ic_menu_import_grey">@drawable/ic_archive_grey600_24dp</drawable>
<drawable name="ic_receipt">@drawable/ic_receipt_white_24dp</drawable>
- <drawable name="ic_sort">@drawable/ic_sort_white_24dp</drawable>
+ <drawable name="ic_sort">@drawable/ic_sort_white_24dp</drawable> -->
</resources> \ No newline at end of file
diff --git a/main/src/main/res/values/refs.xml b/main/src/main/res/values/refs.xml
index c968b05c..2b00d5b5 100644
--- a/main/src/main/res/values/refs.xml
+++ b/main/src/main/res/values/refs.xml
@@ -13,15 +13,15 @@
<drawable name="ic_menu_view">@android:drawable/ic_menu_view</drawable>
<drawable name="ic_menu_delete">@android:drawable/ic_menu_delete</drawable>
<drawable name="ic_menu_edit">@android:drawable/ic_menu_edit</drawable>
- <drawable name="ic_menu_import">@drawable/ic_menu_archive</drawable>
- <drawable name="vpn_item_edit">@drawable/vpn_item_settings </drawable>
+ <!--<drawable name="ic_menu_import">@drawable/ic_menu_archive</drawable>-->
+ <!--<drawable name="vpn_item_edit">@drawable/vpn_item_settings </drawable>-->
<drawable name="ic_menu_add">@android:drawable/ic_menu_add</drawable>
<drawable name="ic_dialog_alert">@android:drawable/ic_dialog_alert</drawable>
<drawable name="ic_menu_add_grey">@android:drawable/ic_menu_add</drawable>
- <drawable name="ic_menu_import_grey">@drawable/ic_menu_archive</drawable>
+ <!--<drawable name="ic_menu_import_grey">@drawable/ic_menu_archive</drawable>-->
<drawable name="ic_menu_delete_grey">@android:drawable/ic_menu_delete</drawable>
- <drawable name="ic_menu_copy">@drawable/ic_menu_copy_holo_light</drawable>
- <drawable name="ic_receipt">@drawable/ic_menu_log</drawable>
+ <!--<drawable name="ic_menu_copy">@drawable/ic_menu_copy_holo_light</drawable>-->
+ <!--<drawable name="ic_receipt">@drawable/ic_menu_log</drawable> -->
<drawable name="ic_sort">@android:drawable/ic_menu_sort_by_size</drawable>
</resources> \ No newline at end of file