summaryrefslogtreecommitdiff
path: root/src/se/leap/leapclient/ProviderDetailFragment.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-09-05 17:40:36 +0200
committerParménides GV <parmegv@sdf.org>2013-09-30 11:31:55 +0200
commitfdc8d5376c6d44c2a78ee023e89417cddabfbd44 (patch)
tree619e2790d2fc2f56cce51e97db6472b8832e34ed /src/se/leap/leapclient/ProviderDetailFragment.java
parent571b935f6ef8a3662fb506d3228efbfced6f24af (diff)
Moved all constants from ConfigHelper.
They have been relocated to the corresponding classes.
Diffstat (limited to 'src/se/leap/leapclient/ProviderDetailFragment.java')
-rw-r--r--src/se/leap/leapclient/ProviderDetailFragment.java29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/se/leap/leapclient/ProviderDetailFragment.java b/src/se/leap/leapclient/ProviderDetailFragment.java
index 600be58..e7af140 100644
--- a/src/se/leap/leapclient/ProviderDetailFragment.java
+++ b/src/se/leap/leapclient/ProviderDetailFragment.java
@@ -3,6 +3,8 @@ package se.leap.leapclient;
import org.json.JSONException;
import org.json.JSONObject;
+import se.leap.leapclient.ProviderListContent.ProviderItem;
+
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
@@ -14,6 +16,9 @@ import android.view.View;
import android.widget.TextView;
public class ProviderDetailFragment extends DialogFragment {
+
+ final public static String TAG = "providerDetailFragment";
+
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
@@ -22,14 +27,14 @@ 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(ConfigHelper.PROVIDER_KEY);
+ JSONObject provider_json = ConfigHelper.getJsonFromSharedPref(Provider.KEY);
final TextView domain = (TextView)provider_detail_view.findViewById(R.id.provider_detail_domain);
- domain.setText(provider_json.getString(ConfigHelper.DOMAIN));
+ domain.setText(provider_json.getString(Provider.DOMAIN));
final TextView name = (TextView)provider_detail_view.findViewById(R.id.provider_detail_name);
- name.setText(provider_json.getJSONObject(ConfigHelper.NAME).getString("en"));
+ name.setText(provider_json.getJSONObject(Provider.NAME).getString("en"));
final TextView description = (TextView)provider_detail_view.findViewById(R.id.provider_detail_description);
- description.setText(provider_json.getJSONObject(ConfigHelper.DESCRIPTION).getString("en"));
+ description.setText(provider_json.getJSONObject(Provider.DESCRIPTION).getString("en"));
builder.setView(provider_detail_view);
builder.setTitle(R.string.provider_details_fragment_title);
@@ -58,8 +63,8 @@ public class ProviderDetailFragment extends DialogFragment {
private boolean anon_allowed(JSONObject provider_json) {
try {
- JSONObject service_description = provider_json.getJSONObject(ConfigHelper.SERVICE_KEY);
- return service_description.has(ConfigHelper.ALLOWED_ANON) && service_description.getBoolean(ConfigHelper.ALLOWED_ANON);
+ JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
+ return service_description.has(EIP.ALLOWED_ANON) && service_description.getBoolean(EIP.ALLOWED_ANON);
} catch (JSONException e) {
return false;
}
@@ -67,8 +72,8 @@ public class ProviderDetailFragment extends DialogFragment {
private boolean registration_allowed(JSONObject provider_json) {
try {
- JSONObject service_description = provider_json.getJSONObject(ConfigHelper.SERVICE_KEY);
- return service_description.has(ConfigHelper.ALLOW_REGISTRATION_KEY) && service_description.getBoolean(ConfigHelper.ALLOW_REGISTRATION_KEY);
+ JSONObject service_description = provider_json.getJSONObject(Provider.SERVICE);
+ return service_description.has(Provider.ALLOW_REGISTRATION) && service_description.getBoolean(Provider.ALLOW_REGISTRATION);
} catch (JSONException e) {
return false;
}
@@ -77,10 +82,10 @@ public class ProviderDetailFragment extends DialogFragment {
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
- ConfigHelper.removeFromSharedPref(ConfigHelper.PROVIDER_KEY);
- ConfigHelper.removeFromSharedPref(ConfigHelper.DANGER_ON);
- ConfigHelper.removeFromSharedPref(ConfigHelper.ALLOWED_ANON);
- ConfigHelper.removeFromSharedPref(ConfigHelper.EIP_SERVICE_KEY);
+ ConfigHelper.removeFromSharedPref(Provider.KEY);
+ ConfigHelper.removeFromSharedPref(ProviderItem.DANGER_ON);
+ ConfigHelper.removeFromSharedPref(EIP.ALLOWED_ANON);
+ ConfigHelper.removeFromSharedPref(EIP.KEY);
}
public static DialogFragment newInstance() {