summaryrefslogtreecommitdiff
path: root/src/se
diff options
context:
space:
mode:
Diffstat (limited to 'src/se')
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java20
-rw-r--r--src/se/leap/bitmaskclient/ProviderDetailFragment.java9
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java8
-rw-r--r--src/se/leap/leapclient/ProviderListAdapter.java11
4 files changed, 28 insertions, 20 deletions
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java
index b1230932..0a0858ec 100644
--- a/src/se/leap/bitmaskclient/ConfigurationWizard.java
+++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java
@@ -25,12 +25,12 @@ import org.json.JSONObject;
import se.leap.bitmaskclient.R;
import se.leap.bitmaskclient.ProviderAPIResultReceiver.Receiver;
import se.leap.bitmaskclient.ProviderListContent.ProviderItem;
+
import android.app.Activity;
import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
-import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.res.AssetManager;
@@ -38,22 +38,15 @@ import android.os.Bundle;
import android.os.Handler;
import android.view.Display;
import android.view.Menu;
-<<<<<<< HEAD:src/se/leap/bitmaskclient/ConfigurationWizard.java
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
-=======
-import android.view.MenuItem;
-import android.view.View;
import android.view.View.MeasureSpec;
-import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ListAdapter;
import android.widget.ListView;
-import android.widget.ProgressBar;
import android.widget.RelativeLayout;
->>>>>>> 2e45441... CW ProgressBar is translated below provider.:src/se/leap/leapclient/ConfigurationWizard.java
/**
* Activity that builds and shows the list of known available providers.
@@ -109,7 +102,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
// TODO: If exposing deep links into your app, handle intents here.
}
- private void refreshProviderList(int top_padding) {
+ public void refreshProviderList(int top_padding) {
ProviderListFragment providerList = new ProviderListFragment();
Bundle top_padding_bundle = new Bundle();
top_padding_bundle.putInt(getResources().getString(R.string.top_padding), top_padding);
@@ -133,11 +126,13 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
ConfigHelper.saveSharedPref(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON));
mConfigState.setAction(PROVIDER_SET);
- refreshProviderList(0);
if(resultData.containsKey(Provider.NAME)) {
String provider_id = resultData.getString(Provider.NAME);
mSelectedProvider = getProvider(provider_id);
+
+ if(mSelectedProvider.custom)
+ refreshProviderList(0);
if(!mProgressBar.isShown()) {
int provider_index = getProviderIndex(provider_id);
@@ -182,13 +177,14 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
String reason_to_fail = resultData.getString(ProviderAPI.ERRORS);
showDownloadFailedDialog(getCurrentFocus(), reason_to_fail);
refreshProviderList(0);
+ //Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_json_files_message,
mProgressBar.setVisibility(ProgressBar.GONE);
setResult(RESULT_CANCELED, mConfigState);
}
else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) {
mProgressBar.incrementProgressBy(1);
mProgressBar.setVisibility(ProgressBar.GONE);
- refreshProviderList(0);
+ //refreshProviderList(0);
setResult(RESULT_OK);
showProviderDetails(getCurrentFocus());
} else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) {
@@ -255,7 +251,7 @@ implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogIn
mProgressBar.setProgress(0);
mProgressBar.setMax(3);
int measured_height = listItemHeight(list_item_index);
- mProgressBar.setTranslationY(measured_height*list_item_index);
+ mProgressBar.setTranslationY(measured_height);
}
private int getProviderIndex(String id) {
diff --git a/src/se/leap/bitmaskclient/ProviderDetailFragment.java b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
index 4006a76c..2616cdbf 100644
--- a/src/se/leap/bitmaskclient/ProviderDetailFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderDetailFragment.java
@@ -83,10 +83,18 @@ public class ProviderDetailFragment extends DialogFragment {
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
+<<<<<<< HEAD
ConfigHelper.removeFromSharedPref(Provider.KEY);
ConfigHelper.removeFromSharedPref(ProviderItem.DANGER_ON);
ConfigHelper.removeFromSharedPref(EIP.ALLOWED_ANON);
ConfigHelper.removeFromSharedPref(EIP.KEY);
+=======
+ ConfigHelper.removeFromSharedPref(ConfigHelper.PROVIDER_KEY);
+ ConfigHelper.removeFromSharedPref(ConfigHelper.DANGER_ON);
+ ConfigHelper.removeFromSharedPref(ConfigHelper.ALLOWED_ANON);
+ ConfigHelper.removeFromSharedPref(ConfigHelper.EIP_SERVICE_KEY);
+ interface_with_configuration_wizard.refreshProviderList(0);
+>>>>>>> Only selected provider remain visible.
}
public static DialogFragment newInstance() {
@@ -108,6 +116,7 @@ public class ProviderDetailFragment extends DialogFragment {
public interface ProviderDetailFragmentInterface {
public void login();
public void use_anonymously();
+ public void refreshProviderList(int top_padding);
}
ProviderDetailFragmentInterface interface_with_configuration_wizard;
diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java
index b9a10925..d7ead700 100644
--- a/src/se/leap/bitmaskclient/ProviderListFragment.java
+++ b/src/se/leap/bitmaskclient/ProviderListFragment.java
@@ -24,7 +24,6 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
import android.widget.ListView;
/**
@@ -38,7 +37,7 @@ import android.widget.ListView;
*/
public class ProviderListFragment extends ListFragment {
- private ArrayAdapter<ProviderItem> content_adapter;
+ private ProviderListAdapter<ProviderItem> content_adapter;
/**
* The serialization (saved instance state) Bundle key representing the
@@ -146,6 +145,11 @@ public class ProviderListFragment extends ListFragment {
// Notify the active callbacks interface (the activity, if the
// fragment is attached to one) that an item has been selected.
mCallbacks.onItemSelected(ProviderListContent.ITEMS.get(position).id);
+
+ for(int item_position = 0; item_position < listView.getCount(); item_position++) {
+ if(item_position != position)
+ content_adapter.hide(item_position);
+ }
}
@Override
diff --git a/src/se/leap/leapclient/ProviderListAdapter.java b/src/se/leap/leapclient/ProviderListAdapter.java
index 441763d0..61fe6bfa 100644
--- a/src/se/leap/leapclient/ProviderListAdapter.java
+++ b/src/se/leap/leapclient/ProviderListAdapter.java
@@ -1,12 +1,8 @@
package se.leap.leapclient;
import java.util.List;
-import java.lang.reflect.Array;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
import android.content.Context;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -68,8 +64,9 @@ public class ProviderListAdapter<T> extends ArrayAdapter<T> {
}
@Override
- public View getView(int position, View convertView, ViewGroup parent) {
- TwoLineListItem row;
+ public View getView(int index, View convertView, ViewGroup parent) {
+ TwoLineListItem row;
+ int position = getRealPosition(index);
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = (TwoLineListItem)inflater.inflate(android.R.layout.simple_list_item_2, null);
@@ -79,6 +76,8 @@ public class ProviderListAdapter<T> extends ArrayAdapter<T> {
ProviderListContent.ProviderItem data = ProviderListContent.ITEMS.get(position);
row.getText1().setText(data.domain);
row.getText2().setText(data.name);
+
+
return row;
}