summaryrefslogtreecommitdiff
path: root/src/se/leap/bitmaskclient/ProviderDetailFragment.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2014-01-14 19:44:10 +0100
committerParménides GV <parmegv@sdf.org>2014-01-14 19:54:58 +0100
commit1fe78d00244f52f903435c970c0ebf0071a08f36 (patch)
tree5e4f600dba76a39ab5fa23e13f638e6ce58b29fa /src/se/leap/bitmaskclient/ProviderDetailFragment.java
parentdbf1265f736c00aa31289e75818b1ec56311d31c (diff)
No sharedprefs methods in ConfigHelper.
This means we obtain the SharedPreferences object each time we want to use it. This yields to longer code lines while reading and writing to them.
Diffstat (limited to 'src/se/leap/bitmaskclient/ProviderDetailFragment.java')
-rw-r--r--src/se/leap/bitmaskclient/ProviderDetailFragment.java11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/se/leap/bitmaskclient/ProviderDetailFragment.java b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
index fd8b29d9..3ed04184 100644
--- a/src/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -11,6 +11,7 @@ import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
+import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@@ -28,7 +29,7 @@ public class ProviderDetailFragment extends DialogFragment {
LayoutInflater inflater = getActivity().getLayoutInflater();
View provider_detail_view = inflater.inflate(R.layout.provider_detail_fragment, null);
- JSONObject provider_json = ConfigHelper.getJsonFromSharedPref(Provider.KEY);
+ JSONObject provider_json = new JSONObject(getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, getActivity().MODE_PRIVATE).getString(Provider.KEY, ""));
final TextView domain = (TextView)provider_detail_view.findViewById(R.id.provider_detail_domain);
domain.setText(provider_json.getString(Provider.DOMAIN));
@@ -82,11 +83,9 @@ public class ProviderDetailFragment extends DialogFragment {
@Override
public void onCancel(DialogInterface dialog) {
- super.onCancel(dialog);
- ConfigHelper.removeFromSharedPref(Provider.KEY);
- ConfigHelper.removeFromSharedPref(ProviderItem.DANGER_ON);
- ConfigHelper.removeFromSharedPref(EIP.ALLOWED_ANON);
- ConfigHelper.removeFromSharedPref(EIP.KEY);
+ super.onCancel(dialog);
+ SharedPreferences.Editor editor = getActivity().getSharedPreferences(Dashboard.SHARED_PREFERENCES, Activity.MODE_PRIVATE).edit();
+ editor.remove(Provider.KEY).remove(ProviderItem.DANGER_ON).remove(EIP.ALLOWED_ANON).remove(EIP.KEY).commit();
interface_with_configuration_wizard.showAllProviders();
}