From 08a0e4d242684d6ce5dcb05b8bcb1731c047c9d0 Mon Sep 17 00:00:00 2001 From: kwadronaut Date: Fri, 23 Feb 2018 09:49:36 +0100 Subject: Minor readme updates change issue tracker/merge requests to point to 0xacab typo closes #8870 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b38ac0bb..232cf35b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This repository contains the source code for the [Bitmask](https://bitmask.net/) Android client. Bitmask Android offers one-click free VPN service from trusted providers of the LEAP stack. -To lean about the stack, visit [leap.se](https://leap.se). +To learn about the stack, visit [leap.se](https://leap.se). Please see the [issues](https://0xacab.org/leap/bitmask_android/issues) section to report any bugs or feature requests, and to see the list of known issues. @@ -475,7 +475,7 @@ Please file bug tickets on our main [development platform](https://0xacab.org/le ## Contributing -Please fork this repository and contribute back using [pull requests](https://github.com/leapcode/leap_android/pulls). +Please fork this repository and contribute back using [pull requests](https://0xacab.org/leap/bitmask_android/merge_requests). Our preferred method for receiving translations is our [Transifex project](https://www.transifex.com/projects/p/bitmask-android). -- cgit v1.2.3 From 1694797396675d5965f4e48717053c76128264a6 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 25 Feb 2018 13:00:13 +0100 Subject: #8808 add a link to android's vpn settings for API >= 24 --- .../main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java | 1 + .../se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 10 ++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 12 insertions(+) diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java index 867f3d48..9b40d36f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java @@ -39,6 +39,7 @@ public class DrawerSettingsAdapter extends BaseAdapter { public static final int LOG = 1; public static final int ABOUT = 2; public static final int BATTERY_SAVER = 3; + public static final int ALWAYS_ON = 4; //view types public final static int VIEW_SIMPLE_TEXT = 0; diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 6e39e9ed..2a7d8def 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -62,6 +63,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.DrawerSettingsAdapter.ABOUT; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.ALWAYS_ON; import static se.leap.bitmaskclient.DrawerSettingsAdapter.BATTERY_SAVER; import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSimpleTextInstance; import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSwitchInstance; @@ -171,6 +173,9 @@ public class NavigationDrawerFragment extends Fragment { } })); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + settingsListAdapter.addItem(getSimpleTextInstance(getString(R.string.always_on_vpn), ALWAYS_ON)); + } settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER)); settingsListAdapter.addItem(getSimpleTextInstance(getString(log_fragment_title), LOG)); settingsListAdapter.addItem(getSimpleTextInstance(getString(about_fragment_title), ABOUT)); @@ -422,6 +427,11 @@ public class NavigationDrawerFragment extends Fragment { mTitle = getString(about_fragment_title); fragment = new AboutFragment(); break; + case ALWAYS_ON: + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + break; default: break; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a0ca00c9..6007d15b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -109,4 +109,5 @@ The VPN certificate is invalid. Please log in to download a new one. Save battery Background data connections will hibernate when your phone is inactive. This feature is still experimental. + Always-on VPN -- cgit v1.2.3 From d8a86d93e2d4aaad939d2c953ae0abb9a37cc254 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 25 Feb 2018 23:04:10 +0100 Subject: #8808 add dialog for always-on vpn infos --- .../java/se/leap/bitmaskclient/ConfigHelper.java | 22 ++++++- .../main/java/se/leap/bitmaskclient/Constants.java | 1 + .../drawer/NavigationDrawerFragment.java | 31 ++++++++-- .../bitmaskclient/fragments/AlwaysOnDialog.java | 67 ++++++++++++++++++++++ .../main/res/layout/checkbox_confirm_dialog.xml | 25 ++++++++ app/src/main/res/values/strings.xml | 2 + 6 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java create mode 100644 app/src/main/res/layout/checkbox_confirm_dialog.xml diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index 50d23106..ec9678d8 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -54,12 +54,14 @@ import java.util.Locale; import java.util.Map; import static android.R.attr.name; +import static se.leap.bitmaskclient.Constants.ALWAYS_ON_SHOW_DIALOG; import static se.leap.bitmaskclient.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; /** * Stores constants, and implements auxiliary methods used across all Bitmask Android classes. @@ -435,9 +437,27 @@ public class ConfigHelper { preferences.edit().putBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, isEnabled).apply(); } - public static boolean getSaveBattery(@NonNull Context context) { + public static boolean getSaveBattery(Context context) { + if (context == null) { + return false; + } SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, false); } + public static void saveShowAlwaysOnDialog(Context context, boolean showAlwaysOnDialog) { + if (context == null) { + return; + } + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + preferences.edit().putBoolean(ALWAYS_ON_SHOW_DIALOG, showAlwaysOnDialog).apply(); + } + + public static boolean getShowAlwaysOnDialog(Context context) { + if (context == null) { + return true; + } + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + return preferences.getBoolean(ALWAYS_ON_SHOW_DIALOG, true); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 58145015..d719e8d3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -8,6 +8,7 @@ public interface Constants { String SHARED_PREFERENCES = "LEAPPreferences"; String PREFERENCES_APP_VERSION = "bitmask version"; + String ALWAYS_ON_SHOW_DIALOG = "DIALOG.ALWAYS_ON_SHOW_DIALOG"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 2a7d8def..6102e7e5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -24,8 +24,10 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; @@ -49,6 +51,8 @@ import android.widget.Toast; import se.leap.bitmaskclient.ConfigHelper; import se.leap.bitmaskclient.DrawerSettingsAdapter; import se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem; +import se.leap.bitmaskclient.FragmentManagerEnhanced; +import se.leap.bitmaskclient.fragments.AlwaysOnDialog; import se.leap.bitmaskclient.EipFragment; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.ProviderListActivity; @@ -59,6 +63,7 @@ import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Context.MODE_PRIVATE; import static se.leap.bitmaskclient.BitmaskApp.getRefWatcher; import static se.leap.bitmaskclient.ConfigHelper.getSaveBattery; +import static se.leap.bitmaskclient.ConfigHelper.getShowAlwaysOnDialog; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; @@ -293,7 +298,8 @@ public class NavigationDrawerFragment extends Fragment { try { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); showEnableExperimentalFeature = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.save_battery)) + alertDialog = alertBuilder + .setTitle(activity.getString(R.string.save_battery)) .setMessage(activity.getString(R.string.save_battery_message)) .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { @Override @@ -323,6 +329,19 @@ public class NavigationDrawerFragment extends Fragment { } catch (IllegalStateException e) { e.printStackTrace(); } + } + + public void showAlwaysOnDialog() { + try { + + FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( + getActivity().getSupportFragmentManager()).removePreviousFragment( + AlwaysOnDialog.TAG); + DialogFragment newFragment = new AlwaysOnDialog(); + newFragment.show(fragmentTransaction, AlwaysOnDialog.TAG); + } catch (IllegalStateException | NullPointerException e) { + e.printStackTrace(); + } } @@ -428,9 +447,13 @@ public class NavigationDrawerFragment extends Fragment { fragment = new AboutFragment(); break; case ALWAYS_ON: - Intent intent = new Intent("android.net.vpn.SETTINGS"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); + if (getShowAlwaysOnDialog(getContext())) { + showAlwaysOnDialog(); + } else { + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } break; default: break; diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java new file mode 100644 index 00000000..80510b86 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -0,0 +1,67 @@ +package se.leap.bitmaskclient.fragments; + +import android.app.Dialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatDialogFragment; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CheckBox; + +import butterknife.ButterKnife; +import butterknife.InjectView; +import se.leap.bitmaskclient.R; + +import static se.leap.bitmaskclient.ConfigHelper.saveShowAlwaysOnDialog; + +/** + * Created by cyberta on 25.02.18. + */ + + + +public class AlwaysOnDialog extends AppCompatDialogFragment { + + public final static String TAG = AlwaysOnDialog.class.getName(); + + @InjectView(R.id.do_not_show_again) + CheckBox doNotShowAgainCheckBox; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.checkbox_confirm_dialog, null); + ButterKnife.inject(this, view); + + builder.setView(view) + .setMessage(R.string.always_on_vpn_user_message) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + if (doNotShowAgainCheckBox.isChecked()) { + saveShowAlwaysOnDialog(getContext(), false); + } + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + // Create the AlertDialog object and return it + return builder.create(); + } +} diff --git a/app/src/main/res/layout/checkbox_confirm_dialog.xml b/app/src/main/res/layout/checkbox_confirm_dialog.xml new file mode 100644 index 00000000..d8d4a19e --- /dev/null +++ b/app/src/main/res/layout/checkbox_confirm_dialog.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6007d15b..412be264 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -110,4 +110,6 @@ Save battery Background data connections will hibernate when your phone is inactive. This feature is still experimental. Always-on VPN + Do not show again. + To enable always-on VPN in Android VPN Settings click on the configure icon and turn the switch on." -- cgit v1.2.3 From 62e36ee804262be866946ca467f7abeb2746add4 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 25 Feb 2018 13:00:13 +0100 Subject: #8808 add a link to android's vpn settings for API >= 24 --- .../main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java | 1 + .../se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java | 10 ++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 12 insertions(+) diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java index 867f3d48..9b40d36f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java @@ -39,6 +39,7 @@ public class DrawerSettingsAdapter extends BaseAdapter { public static final int LOG = 1; public static final int ABOUT = 2; public static final int BATTERY_SAVER = 3; + public static final int ALWAYS_ON = 4; //view types public final static int VIEW_SIMPLE_TEXT = 0; diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 6e39e9ed..2a7d8def 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -22,6 +22,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.content.res.Configuration; +import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -62,6 +63,7 @@ import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.DrawerSettingsAdapter.ABOUT; +import static se.leap.bitmaskclient.DrawerSettingsAdapter.ALWAYS_ON; import static se.leap.bitmaskclient.DrawerSettingsAdapter.BATTERY_SAVER; import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSimpleTextInstance; import static se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem.getSwitchInstance; @@ -171,6 +173,9 @@ public class NavigationDrawerFragment extends Fragment { } })); } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + settingsListAdapter.addItem(getSimpleTextInstance(getString(R.string.always_on_vpn), ALWAYS_ON)); + } settingsListAdapter.addItem(getSimpleTextInstance(getString(switch_provider_menu_option), SWITCH_PROVIDER)); settingsListAdapter.addItem(getSimpleTextInstance(getString(log_fragment_title), LOG)); settingsListAdapter.addItem(getSimpleTextInstance(getString(about_fragment_title), ABOUT)); @@ -422,6 +427,11 @@ public class NavigationDrawerFragment extends Fragment { mTitle = getString(about_fragment_title); fragment = new AboutFragment(); break; + case ALWAYS_ON: + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + break; default: break; } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 71b6d437..03fd4584 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -110,4 +110,5 @@ The VPN certificate is invalid. Please log in to download a new one. Save battery Background data connections will hibernate when your phone is inactive. This feature is still experimental. + Always-on VPN -- cgit v1.2.3 From 30244cbf5b7eaf6152bcdc2cb5b6848f6e10798d Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 25 Feb 2018 23:04:10 +0100 Subject: #8808 add dialog for always-on vpn infos --- .../java/se/leap/bitmaskclient/ConfigHelper.java | 22 ++++++- .../main/java/se/leap/bitmaskclient/Constants.java | 1 + .../drawer/NavigationDrawerFragment.java | 31 ++++++++-- .../bitmaskclient/fragments/AlwaysOnDialog.java | 67 ++++++++++++++++++++++ .../main/res/layout/checkbox_confirm_dialog.xml | 25 ++++++++ app/src/main/res/values/strings.xml | 2 + 6 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java create mode 100644 app/src/main/res/layout/checkbox_confirm_dialog.xml diff --git a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java index f07a2a23..aaff9ebc 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java +++ b/app/src/main/java/se/leap/bitmaskclient/ConfigHelper.java @@ -58,12 +58,14 @@ import java.util.Map; import java.util.Set; import static android.R.attr.name; +import static se.leap.bitmaskclient.Constants.ALWAYS_ON_SHOW_DIALOG; import static se.leap.bitmaskclient.Constants.DEFAULT_SHARED_PREFS_BATTERY_SAVER; import static se.leap.bitmaskclient.Constants.PREFERENCES_APP_VERSION; import static se.leap.bitmaskclient.Constants.PROVIDER_CONFIGURED; import static se.leap.bitmaskclient.Constants.PROVIDER_EIP_DEFINITION; import static se.leap.bitmaskclient.Constants.PROVIDER_PRIVATE_KEY; import static se.leap.bitmaskclient.Constants.PROVIDER_VPN_CERTIFICATE; +import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; /** * Stores constants, and implements auxiliary methods used across all Bitmask Android classes. @@ -417,9 +419,27 @@ public class ConfigHelper { preferences.edit().putBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, isEnabled).apply(); } - public static boolean getSaveBattery(@NonNull Context context) { + public static boolean getSaveBattery(Context context) { + if (context == null) { + return false; + } SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); return preferences.getBoolean(DEFAULT_SHARED_PREFS_BATTERY_SAVER, false); } + public static void saveShowAlwaysOnDialog(Context context, boolean showAlwaysOnDialog) { + if (context == null) { + return; + } + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + preferences.edit().putBoolean(ALWAYS_ON_SHOW_DIALOG, showAlwaysOnDialog).apply(); + } + + public static boolean getShowAlwaysOnDialog(Context context) { + if (context == null) { + return true; + } + SharedPreferences preferences = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); + return preferences.getBoolean(ALWAYS_ON_SHOW_DIALOG, true); + } } diff --git a/app/src/main/java/se/leap/bitmaskclient/Constants.java b/app/src/main/java/se/leap/bitmaskclient/Constants.java index 58145015..d719e8d3 100644 --- a/app/src/main/java/se/leap/bitmaskclient/Constants.java +++ b/app/src/main/java/se/leap/bitmaskclient/Constants.java @@ -8,6 +8,7 @@ public interface Constants { String SHARED_PREFERENCES = "LEAPPreferences"; String PREFERENCES_APP_VERSION = "bitmask version"; + String ALWAYS_ON_SHOW_DIALOG = "DIALOG.ALWAYS_ON_SHOW_DIALOG"; ////////////////////////////////////////////// diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 2a7d8def..6102e7e5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -24,8 +24,10 @@ import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; +import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; +import android.support.v4.app.FragmentTransaction; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBar; @@ -49,6 +51,8 @@ import android.widget.Toast; import se.leap.bitmaskclient.ConfigHelper; import se.leap.bitmaskclient.DrawerSettingsAdapter; import se.leap.bitmaskclient.DrawerSettingsAdapter.DrawerSettingsItem; +import se.leap.bitmaskclient.FragmentManagerEnhanced; +import se.leap.bitmaskclient.fragments.AlwaysOnDialog; import se.leap.bitmaskclient.EipFragment; import se.leap.bitmaskclient.Provider; import se.leap.bitmaskclient.ProviderListActivity; @@ -59,6 +63,7 @@ import se.leap.bitmaskclient.fragments.LogFragment; import static android.content.Context.MODE_PRIVATE; import static se.leap.bitmaskclient.BitmaskApp.getRefWatcher; import static se.leap.bitmaskclient.ConfigHelper.getSaveBattery; +import static se.leap.bitmaskclient.ConfigHelper.getShowAlwaysOnDialog; import static se.leap.bitmaskclient.Constants.PROVIDER_KEY; import static se.leap.bitmaskclient.Constants.REQUEST_CODE_SWITCH_PROVIDER; import static se.leap.bitmaskclient.Constants.SHARED_PREFERENCES; @@ -293,7 +298,8 @@ public class NavigationDrawerFragment extends Fragment { try { AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); showEnableExperimentalFeature = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.save_battery)) + alertDialog = alertBuilder + .setTitle(activity.getString(R.string.save_battery)) .setMessage(activity.getString(R.string.save_battery_message)) .setPositiveButton((android.R.string.yes), new DialogInterface.OnClickListener() { @Override @@ -323,6 +329,19 @@ public class NavigationDrawerFragment extends Fragment { } catch (IllegalStateException e) { e.printStackTrace(); } + } + + public void showAlwaysOnDialog() { + try { + + FragmentTransaction fragmentTransaction = new FragmentManagerEnhanced( + getActivity().getSupportFragmentManager()).removePreviousFragment( + AlwaysOnDialog.TAG); + DialogFragment newFragment = new AlwaysOnDialog(); + newFragment.show(fragmentTransaction, AlwaysOnDialog.TAG); + } catch (IllegalStateException | NullPointerException e) { + e.printStackTrace(); + } } @@ -428,9 +447,13 @@ public class NavigationDrawerFragment extends Fragment { fragment = new AboutFragment(); break; case ALWAYS_ON: - Intent intent = new Intent("android.net.vpn.SETTINGS"); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(intent); + if (getShowAlwaysOnDialog(getContext())) { + showAlwaysOnDialog(); + } else { + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } break; default: break; diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java new file mode 100644 index 00000000..80510b86 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -0,0 +1,67 @@ +package se.leap.bitmaskclient.fragments; + +import android.app.Dialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.v7.app.AlertDialog; +import android.support.v7.app.AppCompatDialogFragment; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.CheckBox; + +import butterknife.ButterKnife; +import butterknife.InjectView; +import se.leap.bitmaskclient.R; + +import static se.leap.bitmaskclient.ConfigHelper.saveShowAlwaysOnDialog; + +/** + * Created by cyberta on 25.02.18. + */ + + + +public class AlwaysOnDialog extends AppCompatDialogFragment { + + public final static String TAG = AlwaysOnDialog.class.getName(); + + @InjectView(R.id.do_not_show_again) + CheckBox doNotShowAgainCheckBox; + + @Override + public void onCreate(@Nullable Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @NonNull + @Override + public Dialog onCreateDialog(Bundle savedInstanceState) { + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); + LayoutInflater inflater = getActivity().getLayoutInflater(); + View view = inflater.inflate(R.layout.checkbox_confirm_dialog, null); + ButterKnife.inject(this, view); + + builder.setView(view) + .setMessage(R.string.always_on_vpn_user_message) + .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + if (doNotShowAgainCheckBox.isChecked()) { + saveShowAlwaysOnDialog(getContext(), false); + } + Intent intent = new Intent("android.net.vpn.SETTINGS"); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivity(intent); + } + }) + .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }); + // Create the AlertDialog object and return it + return builder.create(); + } +} diff --git a/app/src/main/res/layout/checkbox_confirm_dialog.xml b/app/src/main/res/layout/checkbox_confirm_dialog.xml new file mode 100644 index 00000000..d8d4a19e --- /dev/null +++ b/app/src/main/res/layout/checkbox_confirm_dialog.xml @@ -0,0 +1,25 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 03fd4584..4d19758c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -111,4 +111,6 @@ Save battery Background data connections will hibernate when your phone is inactive. This feature is still experimental. Always-on VPN + Do not show again. + To enable always-on VPN in Android VPN Settings click on the configure icon and turn the switch on." -- cgit v1.2.3 From b14e4b9a7940adb4580c0f3c7a0edcb339c73ae8 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Fri, 2 Mar 2018 23:09:08 +0100 Subject: #8808 adds an optional dialog that shows instruction hints for always-on vpn --- .../bitmaskclient/fragments/AlwaysOnDialog.java | 8 +- .../se/leap/bitmaskclient/views/IconTextView.java | 96 +++++++++++++++++++++ app/src/main/res/drawable-hdpi/ic_settings.png | Bin 0 -> 826 bytes app/src/main/res/drawable-ldpi/ic_settings.png | Bin 0 -> 534 bytes app/src/main/res/drawable-mdpi/ic_settings.png | Bin 0 -> 657 bytes app/src/main/res/drawable-xhdpi/ic_settings.png | Bin 0 -> 1009 bytes .../main/res/layout/checkbox_confirm_dialog.xml | 9 +- app/src/main/res/values/strings.xml | 2 +- 8 files changed, 107 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java create mode 100644 app/src/main/res/drawable-hdpi/ic_settings.png create mode 100644 app/src/main/res/drawable-ldpi/ic_settings.png create mode 100644 app/src/main/res/drawable-mdpi/ic_settings.png create mode 100644 app/src/main/res/drawable-xhdpi/ic_settings.png diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java index 80510b86..4e8e3d79 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -15,6 +15,7 @@ import android.widget.CheckBox; import butterknife.ButterKnife; import butterknife.InjectView; import se.leap.bitmaskclient.R; +import se.leap.bitmaskclient.views.IconTextView; import static se.leap.bitmaskclient.ConfigHelper.saveShowAlwaysOnDialog; @@ -31,6 +32,9 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { @InjectView(R.id.do_not_show_again) CheckBox doNotShowAgainCheckBox; + @InjectView(R.id.user_message) + IconTextView userMessage; + @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -44,8 +48,9 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { View view = inflater.inflate(R.layout.checkbox_confirm_dialog, null); ButterKnife.inject(this, view); + userMessage.setIcon(R.drawable.ic_settings); + userMessage.setText(getString(R.string.always_on_vpn_user_message)); builder.setView(view) - .setMessage(R.string.always_on_vpn_user_message) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (doNotShowAgainCheckBox.isChecked()) { @@ -61,7 +66,6 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { dialog.cancel(); } }); - // Create the AlertDialog object and return it return builder.create(); } } diff --git a/app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java b/app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java new file mode 100644 index 00000000..0af33c68 --- /dev/null +++ b/app/src/main/java/se/leap/bitmaskclient/views/IconTextView.java @@ -0,0 +1,96 @@ +package se.leap.bitmaskclient.views; + + +import android.content.Context; +import android.graphics.PorterDuff; +import android.graphics.drawable.Drawable; +import android.support.v7.widget.AppCompatTextView; +import android.text.Spannable; +import android.text.style.ImageSpan; +import android.util.AttributeSet; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class IconTextView extends AppCompatTextView { + + private int imageResource = 0; + /** + * Regex pattern that looks for embedded images of the format: [img src=imageName/] + */ + public static final String PATTERN = "\\Q[img src]\\E"; + + public IconTextView(Context context, AttributeSet attrs, int defStyle) { + super(context, attrs, defStyle); + } + + public IconTextView(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public IconTextView(Context context) { + super(context); + } + + @Override + public void setText(CharSequence text, BufferType type) { + final Spannable spannable = getTextWithImages(getContext(), text, getLineHeight(), getCurrentTextColor()); + super.setText(spannable, BufferType.SPANNABLE); + } + + public void setIcon(int imageResource) { + this.imageResource = imageResource; + } + + private Spannable getTextWithImages(Context context, CharSequence text, int lineHeight, int colour) { + final Spannable spannable = Spannable.Factory.getInstance().newSpannable(text); + addImages(context, spannable, lineHeight, colour); + return spannable; + } + + private void addImages(Context context, Spannable spannable, int lineHeight, int colour) { + final Pattern refImg = Pattern.compile(PATTERN); + + final Matcher matcher = refImg.matcher(spannable); + while (matcher.find()) { + boolean set = true; + for (ImageSpan span : spannable.getSpans(matcher.start(), matcher.end(), ImageSpan.class)) { + if (spannable.getSpanStart(span) >= matcher.start() + && spannable.getSpanEnd(span) <= matcher.end()) { + spannable.removeSpan(span); + } else { + set = false; + break; + } + } + if (set && imageResource != 0) { + spannable.setSpan(makeImageSpan(context, imageResource, lineHeight, colour), + matcher.start(), + matcher.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE + ); + } + } + } + + /** + * Create an ImageSpan for the given icon drawable. This also sets the image size and colour. + * Works best with a white, square icon because of the colouring and resizing. + * + * @param context The Android Context. + * @param drawableResId A drawable resource Id. + * @param size The desired size (i.e. width and height) of the image icon in pixels. + * Use the lineHeight of the TextView to make the image inline with the + * surrounding text. + * @param colour The colour (careful: NOT a resource Id) to apply to the image. + * @return An ImageSpan, aligned with the bottom of the text. + */ + private ImageSpan makeImageSpan(Context context, int drawableResId, int size, int colour) { + final Drawable drawable = context.getResources().getDrawable(drawableResId); + drawable.mutate(); + drawable.setColorFilter(colour, PorterDuff.Mode.MULTIPLY); + drawable.setBounds(0, 0, size, size); + return new ImageSpan(drawable, ImageSpan.ALIGN_BOTTOM); + } + +} \ No newline at end of file diff --git a/app/src/main/res/drawable-hdpi/ic_settings.png b/app/src/main/res/drawable-hdpi/ic_settings.png new file mode 100644 index 00000000..d3322976 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-ldpi/ic_settings.png b/app/src/main/res/drawable-ldpi/ic_settings.png new file mode 100644 index 00000000..2fe03464 Binary files /dev/null and b/app/src/main/res/drawable-ldpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_settings.png b/app/src/main/res/drawable-mdpi/ic_settings.png new file mode 100644 index 00000000..b5988be9 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_settings.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_settings.png b/app/src/main/res/drawable-xhdpi/ic_settings.png new file mode 100644 index 00000000..d5959bd9 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_settings.png differ diff --git a/app/src/main/res/layout/checkbox_confirm_dialog.xml b/app/src/main/res/layout/checkbox_confirm_dialog.xml index d8d4a19e..6dd22417 100644 --- a/app/src/main/res/layout/checkbox_confirm_dialog.xml +++ b/app/src/main/res/layout/checkbox_confirm_dialog.xml @@ -2,16 +2,15 @@ - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d19758c..a308b5e7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,5 +112,5 @@ Background data connections will hibernate when your phone is inactive. This feature is still experimental. Always-on VPN Do not show again. - To enable always-on VPN in Android VPN Settings click on the configure icon and turn the switch on." + To enable always-on VPN in Android VPN Settings click on the configure icon [img src] and turn the switch on." -- cgit v1.2.3 From 372a922a8fbc2759d73a0de1e3bba172edc9b9d4 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Mon, 5 Mar 2018 16:24:56 +0100 Subject: 6117 - show cancel if no connection --- .../se/leap/bitmaskclient/VpnNotificationManager.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java index 459f337b..8a329085 100644 --- a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java @@ -111,8 +111,21 @@ public class VpnNotificationManager { * @param when */ public void buildOpenVpnNotification(String profileName, final String msg, String tickerText, ConnectionStatus status, long when, String notificationChannelNewstatusId) { + String cancelString; + switch (status) { + // show cancel if no connection + case LEVEL_START: + case LEVEL_NONETWORK: + case LEVEL_CONNECTING_SERVER_REPLIED: + case LEVEL_CONNECTING_NO_SERVER_REPLY_YET: + cancelString = context.getString(R.string.cancel); + break; + // show disconnect if connection exists + default: + cancelString = context.getString(R.string.cancel_connection); + } NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action. - Builder(R.drawable.ic_menu_close_clear_cancel, context.getString(R.string.cancel_connection), getDisconnectIntent()); + Builder(R.drawable.ic_menu_close_clear_cancel, cancelString, getDisconnectIntent()); String title; if (isEmpty(profileName)) { title = context.getString(R.string.app_name); -- cgit v1.2.3 From 54e95a61bc553d985f6c55823da20985b6103aa0 Mon Sep 17 00:00:00 2001 From: Fup Duck Date: Tue, 6 Mar 2018 12:24:22 +0100 Subject: cleanup - rename layout files --- app/build.gradle | 2 - .../AbstractProviderDetailActivity.java | 2 +- .../leap/bitmaskclient/DrawerSettingsAdapter.java | 4 +- .../java/se/leap/bitmaskclient/EipFragment.java | 3 +- .../java/se/leap/bitmaskclient/MainActivity.java | 2 +- .../bitmaskclient/ProviderListBaseActivity.java | 4 +- .../se/leap/bitmaskclient/ProviderRenderer.java | 2 +- .../leap/bitmaskclient/VpnNotificationManager.java | 2 +- .../drawer/NavigationDrawerFragment.java | 9 +- .../bitmaskclient/fragments/AboutFragment.java | 3 +- .../bitmaskclient/fragments/AlwaysOnDialog.java | 2 +- .../layout-sw600dp-port/a_provider_credentials.xml | 6 +- .../res/layout-sw600dp-port/a_provider_detail.xml | 4 +- .../res/layout-sw600dp-port/a_provider_list.xml | 83 ++++++++ app/src/main/res/layout-sw600dp-port/f_log.xml | 2 +- .../layout-sw600dp-port/provider_list_activity.xml | 83 -------- app/src/main/res/layout-sw600dp/f_log.xml | 2 +- .../res/layout-xlarge/a_provider_credentials.xml | 6 +- .../main/res/layout-xlarge/a_provider_detail.xml | 4 +- app/src/main/res/layout-xlarge/a_provider_list.xml | 83 ++++++++ app/src/main/res/layout-xlarge/about.xml | 209 --------------------- .../res/layout-xlarge/eip_service_fragment.xml | 128 ------------- app/src/main/res/layout-xlarge/f_about.xml | 209 +++++++++++++++++++++ app/src/main/res/layout-xlarge/f_eip.xml | 128 +++++++++++++ app/src/main/res/layout-xlarge/loading_screen.xml | 41 ---- app/src/main/res/layout-xlarge/provider_header.xml | 22 --- .../res/layout-xlarge/provider_list_activity.xml | 83 -------- .../main/res/layout-xlarge/provider_list_item.xml | 34 ---- app/src/main/res/layout-xlarge/session_dialog.xml | 39 ---- .../main/res/layout-xlarge/single_list_item.xml | 28 --- .../main/res/layout-xlarge/v_loading_screen.xml | 41 ++++ .../main/res/layout-xlarge/v_provider_header.xml | 22 +++ .../res/layout-xlarge/v_provider_list_item.xml | 34 ++++ .../main/res/layout-xlarge/v_single_list_item.xml | 28 +++ app/src/main/res/layout-xlarge/v_vpn_status.xml | 52 +++++ app/src/main/res/layout-xlarge/vpnstatus.xml | 52 ----- app/src/main/res/layout/a_main.xml | 42 +++++ app/src/main/res/layout/a_provider_credentials.xml | 6 +- app/src/main/res/layout/a_provider_detail.xml | 4 +- app/src/main/res/layout/a_provider_list.xml | 30 +++ app/src/main/res/layout/about.xml | 201 -------------------- app/src/main/res/layout/activity_main.xml | 42 ----- .../main/res/layout/checkbox_confirm_dialog.xml | 24 --- .../main/res/layout/custom_notification_layout.xml | 48 ----- app/src/main/res/layout/d_checkbox_confirm.xml | 24 +++ app/src/main/res/layout/drawer_main.xml | 69 ------- app/src/main/res/layout/eip_service_fragment.xml | 130 ------------- app/src/main/res/layout/f_about.xml | 201 ++++++++++++++++++++ app/src/main/res/layout/f_drawer_main.xml | 69 +++++++ app/src/main/res/layout/f_eip.xml | 130 +++++++++++++ app/src/main/res/layout/fragment_main.xml | 16 -- app/src/main/res/layout/loading_screen.xml | 41 ---- app/src/main/res/layout/provider_credentials.xml | 67 ------- app/src/main/res/layout/provider_header.xml | 22 --- app/src/main/res/layout/provider_list_activity.xml | 30 --- app/src/main/res/layout/provider_list_item.xml | 34 ---- app/src/main/res/layout/session_dialog.xml | 42 ----- app/src/main/res/layout/single_list_item.xml | 12 -- app/src/main/res/layout/switch_list_item.xml | 15 -- app/src/main/res/layout/v_custom_notification.xml | 48 +++++ app/src/main/res/layout/v_loading_screen.xml | 41 ++++ app/src/main/res/layout/v_provider_credentials.xml | 67 +++++++ app/src/main/res/layout/v_provider_header.xml | 22 +++ app/src/main/res/layout/v_provider_list_item.xml | 34 ++++ app/src/main/res/layout/v_single_list_item.xml | 12 ++ app/src/main/res/layout/v_switch_list_item.xml | 15 ++ app/src/main/res/layout/v_vpn_status.xml | 52 +++++ app/src/main/res/layout/vpnstatus.xml | 52 ----- app/src/main/res/menu/main.xml | 13 -- .../se/leap/bitmaskclient/NewProviderDialog.java | 2 +- .../res/layout-xlarge/d_new_provider.xml | 19 ++ .../res/layout-xlarge/new_provider_dialog.xml | 19 -- app/src/production/res/layout/d_new_provider.xml | 18 ++ .../production/res/layout/new_provider_dialog.xml | 18 -- 74 files changed, 1534 insertions(+), 1655 deletions(-) create mode 100644 app/src/main/res/layout-sw600dp-port/a_provider_list.xml delete mode 100644 app/src/main/res/layout-sw600dp-port/provider_list_activity.xml create mode 100644 app/src/main/res/layout-xlarge/a_provider_list.xml delete mode 100644 app/src/main/res/layout-xlarge/about.xml delete mode 100644 app/src/main/res/layout-xlarge/eip_service_fragment.xml create mode 100644 app/src/main/res/layout-xlarge/f_about.xml create mode 100644 app/src/main/res/layout-xlarge/f_eip.xml delete mode 100644 app/src/main/res/layout-xlarge/loading_screen.xml delete mode 100644 app/src/main/res/layout-xlarge/provider_header.xml delete mode 100644 app/src/main/res/layout-xlarge/provider_list_activity.xml delete mode 100644 app/src/main/res/layout-xlarge/provider_list_item.xml delete mode 100644 app/src/main/res/layout-xlarge/session_dialog.xml delete mode 100644 app/src/main/res/layout-xlarge/single_list_item.xml create mode 100644 app/src/main/res/layout-xlarge/v_loading_screen.xml create mode 100644 app/src/main/res/layout-xlarge/v_provider_header.xml create mode 100644 app/src/main/res/layout-xlarge/v_provider_list_item.xml create mode 100644 app/src/main/res/layout-xlarge/v_single_list_item.xml create mode 100644 app/src/main/res/layout-xlarge/v_vpn_status.xml delete mode 100644 app/src/main/res/layout-xlarge/vpnstatus.xml create mode 100644 app/src/main/res/layout/a_main.xml create mode 100644 app/src/main/res/layout/a_provider_list.xml delete mode 100644 app/src/main/res/layout/about.xml delete mode 100644 app/src/main/res/layout/activity_main.xml delete mode 100644 app/src/main/res/layout/checkbox_confirm_dialog.xml delete mode 100644 app/src/main/res/layout/custom_notification_layout.xml create mode 100644 app/src/main/res/layout/d_checkbox_confirm.xml delete mode 100644 app/src/main/res/layout/drawer_main.xml delete mode 100644 app/src/main/res/layout/eip_service_fragment.xml create mode 100644 app/src/main/res/layout/f_about.xml create mode 100644 app/src/main/res/layout/f_drawer_main.xml create mode 100644 app/src/main/res/layout/f_eip.xml delete mode 100644 app/src/main/res/layout/fragment_main.xml delete mode 100644 app/src/main/res/layout/loading_screen.xml delete mode 100644 app/src/main/res/layout/provider_credentials.xml delete mode 100644 app/src/main/res/layout/provider_header.xml delete mode 100644 app/src/main/res/layout/provider_list_activity.xml delete mode 100644 app/src/main/res/layout/provider_list_item.xml delete mode 100644 app/src/main/res/layout/session_dialog.xml delete mode 100644 app/src/main/res/layout/single_list_item.xml delete mode 100644 app/src/main/res/layout/switch_list_item.xml create mode 100644 app/src/main/res/layout/v_custom_notification.xml create mode 100644 app/src/main/res/layout/v_loading_screen.xml create mode 100644 app/src/main/res/layout/v_provider_credentials.xml create mode 100644 app/src/main/res/layout/v_provider_header.xml create mode 100644 app/src/main/res/layout/v_provider_list_item.xml create mode 100644 app/src/main/res/layout/v_single_list_item.xml create mode 100644 app/src/main/res/layout/v_switch_list_item.xml create mode 100644 app/src/main/res/layout/v_vpn_status.xml delete mode 100644 app/src/main/res/layout/vpnstatus.xml delete mode 100644 app/src/main/res/menu/main.xml create mode 100644 app/src/production/res/layout-xlarge/d_new_provider.xml delete mode 100644 app/src/production/res/layout-xlarge/new_provider_dialog.xml create mode 100644 app/src/production/res/layout/d_new_provider.xml delete mode 100644 app/src/production/res/layout/new_provider_dialog.xml diff --git a/app/build.gradle b/app/build.gradle index 5422b5e4..1ade8155 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -173,9 +173,7 @@ task copyIcsOpenVPNClasses( type: Copy ) { task copyIcsOpenVPNXml( type: Copy ) { println "copyIcsOpenVPNXml" from ('../ics-openvpn/main/') { - include '**/vpnstatus.xml' include '**/strings.xml' - include '**/vpnstatus.xml' include '**/refs.xml' include '**/white_rect.xml' include '**/plurals.xml' diff --git a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java b/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java index 6738a6bb..6349cb15 100644 --- a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java @@ -55,7 +55,7 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct options.setAdapter(new ArrayAdapter<>( this, - R.layout.single_list_item, + R.layout.v_single_list_item, android.R.id.text1, optionsList.toArray(new String[optionsList.size()]) )); diff --git a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java index 9b40d36f..8238df55 100644 --- a/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java +++ b/app/src/main/java/se/leap/bitmaskclient/DrawerSettingsAdapter.java @@ -176,14 +176,14 @@ public class DrawerSettingsAdapter extends BaseAdapter { @NonNull private View initSwitchBinding(ViewHolder holder) { - View convertView = mInflater.inflate(R.layout.switch_list_item, null); + View convertView = mInflater.inflate(R.layout.v_switch_list_item, null); holder.switchView = convertView.findViewById(android.R.id.text1); return convertView; } @NonNull private View initTextViewBinding(ViewHolder holder) { - View convertView = mInflater.inflate(R.layout.single_list_item, null); + View convertView = mInflater.inflate(R.layout.v_single_list_item, null); holder.textView = convertView.findViewById(android.R.id.text1); return convertView; } diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 34120859..9fcdcac9 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -38,7 +38,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; -import android.widget.TextView; import java.util.Observable; import java.util.Observer; @@ -145,7 +144,7 @@ public class EipFragment extends Fragment implements Observer { @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { eipStatus.addObserver(this); - View view = inflater.inflate(R.layout.eip_service_fragment, container, false); + View view = inflater.inflate(R.layout.f_eip, container, false); ButterKnife.inject(this, view); Bundle arguments = getArguments(); diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index 19294618..4d57b6bc 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -113,7 +113,7 @@ public class MainActivity extends AppCompatActivity implements Observer { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); + setContentView(R.layout.a_main); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); mainActivityBroadcastReceiver = new MainActivityBroadcastReceiver(); diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java index 75fffaf7..e0d6e27d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderListBaseActivity.java @@ -28,7 +28,6 @@ import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentTransaction; import android.support.v4.content.LocalBroadcastManager; import android.util.Log; -import android.view.Menu; import android.widget.ListView; import com.pedrogomez.renderers.Renderer; @@ -47,7 +46,6 @@ import butterknife.InjectView; import butterknife.OnItemClick; import se.leap.bitmaskclient.fragments.AboutFragment; -import static se.leap.bitmaskclient.Constants.APP_ACTION_QUIT; import static se.leap.bitmaskclient.Constants.BROADCAST_PROVIDER_API_EVENT; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_CODE; import static se.leap.bitmaskclient.Constants.BROADCAST_RESULT_KEY; @@ -167,7 +165,7 @@ public abstract class ProviderListBaseActivity extends ConfigWizardBaseActivity } private void setUpInitialUI() { - setContentView(R.layout.provider_list_activity); + setContentView(R.layout.a_provider_list); setProviderHeaderText(R.string.setup_provider); hideProgressBar(); } diff --git a/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java b/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java index 5b3e5728..795c8e82 100644 --- a/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java +++ b/app/src/main/java/se/leap/bitmaskclient/ProviderRenderer.java @@ -25,7 +25,7 @@ public class ProviderRenderer extends Renderer { @Override protected View inflate(LayoutInflater inflater, ViewGroup parent) { - View view = inflater.inflate(R.layout.provider_list_item, parent, false); + View view = inflater.inflate(R.layout.v_provider_list_item, parent, false); ButterKnife.inject(this, view); return view; } diff --git a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java index 459f337b..6b2d67cf 100644 --- a/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/VpnNotificationManager.java @@ -200,7 +200,7 @@ public class VpnNotificationManager { */ private RemoteViews getKitkatCustomRemoteView(ConnectionStatus status, String title, String message) { int iconResource = getIconByConnectionStatus(status); - RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.custom_notification_layout); + RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.v_custom_notification); remoteViews.setImageViewResource(R.id.image_icon, iconResource); remoteViews.setTextViewText(R.id.message, message); remoteViews.setTextViewText(R.id.title, title); diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 6102e7e5..9256c136 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -140,7 +140,7 @@ public class NavigationDrawerFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - mDrawerView = inflater.inflate(R.layout.drawer_main, container, false); + mDrawerView = inflater.inflate(R.layout.f_drawer_main, container, false); restoreFromSavedInstance(savedInstanceState); return mDrawerView; } @@ -196,7 +196,7 @@ public class NavigationDrawerFragment extends Fragment { }); accountListAdapter = new ArrayAdapter<>(actionBar.getThemedContext(), - R.layout.single_list_item, + R.layout.v_single_list_item, android.R.id.text1); createListAdapterData(); @@ -366,11 +366,6 @@ public class NavigationDrawerFragment extends Fragment { return true; } - if (item.getItemId() == R.id.action_example) { - Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show(); - return true; - } - return super.onOptionsItemSelected(item); } diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java index 113ce397..2f37f5b0 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AboutFragment.java @@ -3,7 +3,6 @@ package se.leap.bitmaskclient.fragments; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Bundle; -import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; @@ -24,7 +23,7 @@ public class AboutFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.about, container, false); + View view = inflater.inflate(R.layout.f_about, container, false); ButterKnife.inject(this, view); return view; } diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java index 4e8e3d79..3558f378 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/AlwaysOnDialog.java @@ -45,7 +45,7 @@ public class AlwaysOnDialog extends AppCompatDialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); - View view = inflater.inflate(R.layout.checkbox_confirm_dialog, null); + View view = inflater.inflate(R.layout.d_checkbox_confirm, null); ButterKnife.inject(this, view); userMessage.setIcon(R.drawable.ic_settings); diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml index 0cbb08f6..1d689db6 100644 --- a/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml +++ b/app/src/main/res/layout-sw600dp-port/a_provider_credentials.xml @@ -58,7 +58,7 @@ app:layout_constraintWidth_min="731dp" > - + @@ -83,7 +83,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml b/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml index bdafa45a..6d7c97ae 100644 --- a/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml +++ b/app/src/main/res/layout-sw600dp-port/a_provider_detail.xml @@ -58,7 +58,7 @@ app:layout_constraintTop_toTopOf="@+id/guideline_top" app:layout_constraintWidth_min="731dp"> - + diff --git a/app/src/main/res/layout-sw600dp-port/a_provider_list.xml b/app/src/main/res/layout-sw600dp-port/a_provider_list.xml new file mode 100644 index 00000000..818ce864 --- /dev/null +++ b/app/src/main/res/layout-sw600dp-port/a_provider_list.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-sw600dp-port/f_log.xml b/app/src/main/res/layout-sw600dp-port/f_log.xml index 78dc4c62..ebadeb74 100644 --- a/app/src/main/res/layout-sw600dp-port/f_log.xml +++ b/app/src/main/res/layout-sw600dp-port/f_log.xml @@ -22,7 +22,7 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-sw600dp/f_log.xml b/app/src/main/res/layout-sw600dp/f_log.xml index 34daf8be..b014ee9d 100644 --- a/app/src/main/res/layout-sw600dp/f_log.xml +++ b/app/src/main/res/layout-sw600dp/f_log.xml @@ -22,7 +22,7 @@ - + - + @@ -82,7 +82,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> diff --git a/app/src/main/res/layout-xlarge/a_provider_detail.xml b/app/src/main/res/layout-xlarge/a_provider_detail.xml index 18098079..c1eeb0e0 100644 --- a/app/src/main/res/layout-xlarge/a_provider_detail.xml +++ b/app/src/main/res/layout-xlarge/a_provider_detail.xml @@ -58,7 +58,7 @@ app:layout_constraintTop_toTopOf="@+id/guideline_top" app:layout_constraintWidth_min="731dp"> - + diff --git a/app/src/main/res/layout-xlarge/a_provider_list.xml b/app/src/main/res/layout-xlarge/a_provider_list.xml new file mode 100644 index 00000000..9150466a --- /dev/null +++ b/app/src/main/res/layout-xlarge/a_provider_list.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-xlarge/about.xml b/app/src/main/res/layout-xlarge/about.xml deleted file mode 100644 index c7896917..00000000 --- a/app/src/main/res/layout-xlarge/about.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge/eip_service_fragment.xml b/app/src/main/res/layout-xlarge/eip_service_fragment.xml deleted file mode 100644 index 2326ffe8..00000000 --- a/app/src/main/res/layout-xlarge/eip_service_fragment.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge/f_about.xml b/app/src/main/res/layout-xlarge/f_about.xml new file mode 100644 index 00000000..c7896917 --- /dev/null +++ b/app/src/main/res/layout-xlarge/f_about.xml @@ -0,0 +1,209 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml new file mode 100644 index 00000000..2326ffe8 --- /dev/null +++ b/app/src/main/res/layout-xlarge/f_eip.xml @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout-xlarge/loading_screen.xml b/app/src/main/res/layout-xlarge/loading_screen.xml deleted file mode 100644 index 2af6b411..00000000 --- a/app/src/main/res/layout-xlarge/loading_screen.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/provider_header.xml b/app/src/main/res/layout-xlarge/provider_header.xml deleted file mode 100644 index 45f8302b..00000000 --- a/app/src/main/res/layout-xlarge/provider_header.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/provider_list_activity.xml b/app/src/main/res/layout-xlarge/provider_list_activity.xml deleted file mode 100644 index cdffc24e..00000000 --- a/app/src/main/res/layout-xlarge/provider_list_activity.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge/provider_list_item.xml b/app/src/main/res/layout-xlarge/provider_list_item.xml deleted file mode 100644 index ec1e1242..00000000 --- a/app/src/main/res/layout-xlarge/provider_list_item.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/layout-xlarge/session_dialog.xml b/app/src/main/res/layout-xlarge/session_dialog.xml deleted file mode 100644 index 3a9eebb8..00000000 --- a/app/src/main/res/layout-xlarge/session_dialog.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/single_list_item.xml b/app/src/main/res/layout-xlarge/single_list_item.xml deleted file mode 100644 index ad3de093..00000000 --- a/app/src/main/res/layout-xlarge/single_list_item.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - diff --git a/app/src/main/res/layout-xlarge/v_loading_screen.xml b/app/src/main/res/layout-xlarge/v_loading_screen.xml new file mode 100644 index 00000000..2af6b411 --- /dev/null +++ b/app/src/main/res/layout-xlarge/v_loading_screen.xml @@ -0,0 +1,41 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/v_provider_header.xml b/app/src/main/res/layout-xlarge/v_provider_header.xml new file mode 100644 index 00000000..45f8302b --- /dev/null +++ b/app/src/main/res/layout-xlarge/v_provider_header.xml @@ -0,0 +1,22 @@ + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/v_provider_list_item.xml b/app/src/main/res/layout-xlarge/v_provider_list_item.xml new file mode 100644 index 00000000..ec1e1242 --- /dev/null +++ b/app/src/main/res/layout-xlarge/v_provider_list_item.xml @@ -0,0 +1,34 @@ + + + + + + + + + diff --git a/app/src/main/res/layout-xlarge/v_single_list_item.xml b/app/src/main/res/layout-xlarge/v_single_list_item.xml new file mode 100644 index 00000000..ad3de093 --- /dev/null +++ b/app/src/main/res/layout-xlarge/v_single_list_item.xml @@ -0,0 +1,28 @@ + + + + diff --git a/app/src/main/res/layout-xlarge/v_vpn_status.xml b/app/src/main/res/layout-xlarge/v_vpn_status.xml new file mode 100644 index 00000000..3b464b62 --- /dev/null +++ b/app/src/main/res/layout-xlarge/v_vpn_status.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout-xlarge/vpnstatus.xml b/app/src/main/res/layout-xlarge/vpnstatus.xml deleted file mode 100644 index 3b464b62..00000000 --- a/app/src/main/res/layout-xlarge/vpnstatus.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/a_main.xml b/app/src/main/res/layout/a_main.xml new file mode 100644 index 00000000..bed05d18 --- /dev/null +++ b/app/src/main/res/layout/a_main.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/a_provider_credentials.xml b/app/src/main/res/layout/a_provider_credentials.xml index 6667d905..5fefb2a3 100644 --- a/app/src/main/res/layout/a_provider_credentials.xml +++ b/app/src/main/res/layout/a_provider_credentials.xml @@ -7,7 +7,7 @@ android:padding="@dimen/stdpadding" style="@style/BitmaskActivity"> - + @@ -33,7 +33,7 @@ android:layout_height="wrap_content" android:orientation="vertical"> diff --git a/app/src/main/res/layout/a_provider_detail.xml b/app/src/main/res/layout/a_provider_detail.xml index 018d4ee8..56b38ada 100644 --- a/app/src/main/res/layout/a_provider_detail.xml +++ b/app/src/main/res/layout/a_provider_detail.xml @@ -7,7 +7,7 @@ android:orientation="vertical" style="@style/BitmaskActivity" > - + diff --git a/app/src/main/res/layout/a_provider_list.xml b/app/src/main/res/layout/a_provider_list.xml new file mode 100644 index 00000000..aa8cdfbb --- /dev/null +++ b/app/src/main/res/layout/a_provider_list.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/about.xml b/app/src/main/res/layout/about.xml deleted file mode 100644 index aba51141..00000000 --- a/app/src/main/res/layout/about.xml +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index de06efc7..00000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/checkbox_confirm_dialog.xml b/app/src/main/res/layout/checkbox_confirm_dialog.xml deleted file mode 100644 index 6dd22417..00000000 --- a/app/src/main/res/layout/checkbox_confirm_dialog.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/custom_notification_layout.xml b/app/src/main/res/layout/custom_notification_layout.xml deleted file mode 100644 index e97fcbe2..00000000 --- a/app/src/main/res/layout/custom_notification_layout.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/d_checkbox_confirm.xml b/app/src/main/res/layout/d_checkbox_confirm.xml new file mode 100644 index 00000000..6dd22417 --- /dev/null +++ b/app/src/main/res/layout/d_checkbox_confirm.xml @@ -0,0 +1,24 @@ + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/drawer_main.xml b/app/src/main/res/layout/drawer_main.xml deleted file mode 100644 index 54614f3f..00000000 --- a/app/src/main/res/layout/drawer_main.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/eip_service_fragment.xml b/app/src/main/res/layout/eip_service_fragment.xml deleted file mode 100644 index e220bf16..00000000 --- a/app/src/main/res/layout/eip_service_fragment.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/f_about.xml b/app/src/main/res/layout/f_about.xml new file mode 100644 index 00000000..aba51141 --- /dev/null +++ b/app/src/main/res/layout/f_about.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/f_drawer_main.xml b/app/src/main/res/layout/f_drawer_main.xml new file mode 100644 index 00000000..54614f3f --- /dev/null +++ b/app/src/main/res/layout/f_drawer_main.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml new file mode 100644 index 00000000..e220bf16 --- /dev/null +++ b/app/src/main/res/layout/f_eip.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml deleted file mode 100644 index 31dbd11e..00000000 --- a/app/src/main/res/layout/fragment_main.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/app/src/main/res/layout/loading_screen.xml b/app/src/main/res/layout/loading_screen.xml deleted file mode 100644 index f4c7eb95..00000000 --- a/app/src/main/res/layout/loading_screen.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/provider_credentials.xml b/app/src/main/res/layout/provider_credentials.xml deleted file mode 100644 index 0bfdcc47..00000000 --- a/app/src/main/res/layout/provider_credentials.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/provider_header.xml b/app/src/main/res/layout/provider_header.xml deleted file mode 100644 index 6b08976c..00000000 --- a/app/src/main/res/layout/provider_header.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - diff --git a/app/src/main/res/layout/provider_list_activity.xml b/app/src/main/res/layout/provider_list_activity.xml deleted file mode 100644 index 6c5281b8..00000000 --- a/app/src/main/res/layout/provider_list_activity.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - diff --git a/app/src/main/res/layout/provider_list_item.xml b/app/src/main/res/layout/provider_list_item.xml deleted file mode 100644 index 1f0e135b..00000000 --- a/app/src/main/res/layout/provider_list_item.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/layout/session_dialog.xml b/app/src/main/res/layout/session_dialog.xml deleted file mode 100644 index 62215ae8..00000000 --- a/app/src/main/res/layout/session_dialog.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/single_list_item.xml b/app/src/main/res/layout/single_list_item.xml deleted file mode 100644 index 652cb693..00000000 --- a/app/src/main/res/layout/single_list_item.xml +++ /dev/null @@ -1,12 +0,0 @@ - \ No newline at end of file diff --git a/app/src/main/res/layout/switch_list_item.xml b/app/src/main/res/layout/switch_list_item.xml deleted file mode 100644 index bdb9a74c..00000000 --- a/app/src/main/res/layout/switch_list_item.xml +++ /dev/null @@ -1,15 +0,0 @@ - \ No newline at end of file diff --git a/app/src/main/res/layout/v_custom_notification.xml b/app/src/main/res/layout/v_custom_notification.xml new file mode 100644 index 00000000..e97fcbe2 --- /dev/null +++ b/app/src/main/res/layout/v_custom_notification.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/v_loading_screen.xml b/app/src/main/res/layout/v_loading_screen.xml new file mode 100644 index 00000000..f4c7eb95 --- /dev/null +++ b/app/src/main/res/layout/v_loading_screen.xml @@ -0,0 +1,41 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/v_provider_credentials.xml b/app/src/main/res/layout/v_provider_credentials.xml new file mode 100644 index 00000000..0bfdcc47 --- /dev/null +++ b/app/src/main/res/layout/v_provider_credentials.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/v_provider_header.xml b/app/src/main/res/layout/v_provider_header.xml new file mode 100644 index 00000000..6b08976c --- /dev/null +++ b/app/src/main/res/layout/v_provider_header.xml @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/app/src/main/res/layout/v_provider_list_item.xml b/app/src/main/res/layout/v_provider_list_item.xml new file mode 100644 index 00000000..1f0e135b --- /dev/null +++ b/app/src/main/res/layout/v_provider_list_item.xml @@ -0,0 +1,34 @@ + + + + + + + + + diff --git a/app/src/main/res/layout/v_single_list_item.xml b/app/src/main/res/layout/v_single_list_item.xml new file mode 100644 index 00000000..652cb693 --- /dev/null +++ b/app/src/main/res/layout/v_single_list_item.xml @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/app/src/main/res/layout/v_switch_list_item.xml b/app/src/main/res/layout/v_switch_list_item.xml new file mode 100644 index 00000000..bdb9a74c --- /dev/null +++ b/app/src/main/res/layout/v_switch_list_item.xml @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/app/src/main/res/layout/v_vpn_status.xml b/app/src/main/res/layout/v_vpn_status.xml new file mode 100644 index 00000000..3b464b62 --- /dev/null +++ b/app/src/main/res/layout/v_vpn_status.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/vpnstatus.xml b/app/src/main/res/layout/vpnstatus.xml deleted file mode 100644 index 3b464b62..00000000 --- a/app/src/main/res/layout/vpnstatus.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/main.xml deleted file mode 100644 index 56f43959..00000000 --- a/app/src/main/res/menu/main.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java b/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java index 025d5263..cce49d9b 100644 --- a/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java +++ b/app/src/production/java/se/leap/bitmaskclient/NewProviderDialog.java @@ -65,7 +65,7 @@ public class NewProviderDialog extends DialogFragment { public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); - View view = inflater.inflate(R.layout.new_provider_dialog, null); + View view = inflater.inflate(R.layout.d_new_provider, null); ButterKnife.inject(this, view); Bundle arguments = getArguments(); if (arguments != null) { diff --git a/app/src/production/res/layout-xlarge/d_new_provider.xml b/app/src/production/res/layout-xlarge/d_new_provider.xml new file mode 100644 index 00000000..12616625 --- /dev/null +++ b/app/src/production/res/layout-xlarge/d_new_provider.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/app/src/production/res/layout-xlarge/new_provider_dialog.xml b/app/src/production/res/layout-xlarge/new_provider_dialog.xml deleted file mode 100644 index 12616625..00000000 --- a/app/src/production/res/layout-xlarge/new_provider_dialog.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/app/src/production/res/layout/d_new_provider.xml b/app/src/production/res/layout/d_new_provider.xml new file mode 100644 index 00000000..36eb0d6a --- /dev/null +++ b/app/src/production/res/layout/d_new_provider.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/app/src/production/res/layout/new_provider_dialog.xml b/app/src/production/res/layout/new_provider_dialog.xml deleted file mode 100644 index 36eb0d6a..00000000 --- a/app/src/production/res/layout/new_provider_dialog.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - -- cgit v1.2.3 From 580d46b51a2f349fee4e15b2c2eb8bc7269f1631 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 17 Mar 2018 22:33:07 +0100 Subject: #8878 fix back button behavior for about and log screen --- .../java/se/leap/bitmaskclient/MainActivity.java | 22 ++++++++++++++++++++-- .../drawer/NavigationDrawerFragment.java | 4 +++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java index 4d57b6bc..d9917799 100644 --- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java +++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java @@ -140,6 +140,22 @@ public class MainActivity extends AppCompatActivity implements Observer { bindOpenVpnService(); } + @Override + public void onBackPressed() { + FragmentManagerEnhanced fragmentManagerEnhanced = new FragmentManagerEnhanced(getSupportFragmentManager()); + if (fragmentManagerEnhanced.findFragmentByTag(EipFragment.TAG) == null) { + Fragment fragment = new EipFragment(); + Bundle bundle = new Bundle(); + bundle.putParcelable(PROVIDER_KEY, provider); + fragment.setArguments(bundle); + fragmentManagerEnhanced.beginTransaction() + .replace(R.id.container, fragment, EipFragment.TAG) + .commit(); + } else { + super.onBackPressed(); + } + } + @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); @@ -152,10 +168,12 @@ public class MainActivity extends AppCompatActivity implements Observer { return; } + String fragmentTag = null; Fragment fragment = null; switch (intent.getAction()) { case ACTION_SHOW_VPN_FRAGMENT: fragment = new EipFragment(); + fragmentTag = EipFragment.TAG; Bundle bundle = new Bundle(); if (intent.hasExtra(ASK_TO_CANCEL_VPN)) { bundle.putBoolean(ASK_TO_CANCEL_VPN, true); @@ -175,7 +193,7 @@ public class MainActivity extends AppCompatActivity implements Observer { if (fragment != null) { new FragmentManagerEnhanced(getSupportFragmentManager()).beginTransaction() - .replace(R.id.container, fragment) + .replace(R.id.container, fragment, fragmentTag) .commit(); } } @@ -214,7 +232,7 @@ public class MainActivity extends AppCompatActivity implements Observer { arguments.putParcelable(PROVIDER_KEY, provider); fragment.setArguments(arguments); new FragmentManagerEnhanced(getSupportFragmentManager()).beginTransaction() - .replace(R.id.container, fragment) + .replace(R.id.container, fragment, EipFragment.TAG) .commit(); } diff --git a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java index 9256c136..e7a5e460 100644 --- a/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/drawer/NavigationDrawerFragment.java @@ -418,10 +418,12 @@ public class NavigationDrawerFragment extends Fragment { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); Fragment fragment = null; + String fragmentTag = null; if (parent == mDrawerAccountsListView) { mTitle = getString(R.string.vpn_fragment_title); fragment = new EipFragment(); + fragmentTag = EipFragment.TAG; Bundle arguments = new Bundle(); Provider currentProvider = ConfigHelper.getSavedProviderFromSharedPreferences(preferences); arguments.putParcelable(PROVIDER_KEY, currentProvider); @@ -457,7 +459,7 @@ public class NavigationDrawerFragment extends Fragment { if (fragment != null) { fragmentManager.beginTransaction() - .replace(R.id.container, fragment) + .replace(R.id.container, fragment, fragmentTag) .commit(); } -- cgit v1.2.3