diff options
3 files changed, 9 insertions, 5 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java index 474e639e..0246174e 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/EIP.java @@ -295,7 +295,7 @@ public final class EIP extends JobIntentService implements Observer { * @return GatewaysManager */ private GatewaysManager gatewaysFromPreferences() { - GatewaysManager gatewaysManager = new GatewaysManager(preferences); + GatewaysManager gatewaysManager = new GatewaysManager(getApplicationContext(), preferences); gatewaysManager.configureFromPreferences(); return gatewaysManager; } diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java index c7d7f86f..5da40977 100644 --- a/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java +++ b/app/src/main/java/se/leap/bitmaskclient/eip/GatewaysManager.java @@ -52,8 +52,9 @@ public class GatewaysManager { private LinkedHashMap<String, Gateway> gateways = new LinkedHashMap<>(); private Type listType = new TypeToken<ArrayList<Gateway>>() {}.getType(); - GatewaysManager(SharedPreferences preferences) { + GatewaysManager(Context context, SharedPreferences preferences) { this.preferences = preferences; + this.context = context; } /** diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java b/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java index 066c9636..63b3908d 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/ExcludeAppsFragment.java @@ -103,16 +103,13 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC if (isChecked) { Log.d("openvpn", "adding to allowed apps" + packageName); - apps.add(packageName); } else { Log.d("openvpn", "removing from allowed apps" + packageName); - apps.remove(packageName); } - PreferenceHelper.setExcludedApps(this.getContext(), apps); } @@ -260,6 +257,12 @@ public class ExcludeAppsFragment extends Fragment implements AdapterView.OnItemC } @Override + public void onDestroy() { + PreferenceHelper.setExcludedApps(this.getActivity().getApplicationContext(), apps); + super.onDestroy(); + } + + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); |