diff options
author | Parménides GV <parmegv@sdf.org> | 2013-08-29 11:02:58 +0200 |
---|---|---|
committer | cyBerta <richy@cyborgsociety.org> | 2013-11-15 23:25:16 +0100 |
commit | 1d57d052814b8d46f3bdc850893171f238cdb2ef (patch) | |
tree | b5833bd8245f052a19c2b3be196204ee90110324 /src/se/leap/bitmaskclient | |
parent | 54cd37ae861e57b33c0a6f1b6b5098da848ec05b (diff) |
Only selected provider remain visible.
The progressbar is always below the first row, because only the selected
provider row remain visible.
If the user cancels the ProviderDetailFragment, all providers appear
again.
Next step: implement the same behaviour with the new provider usecase.
Diffstat (limited to 'src/se/leap/bitmaskclient')
-rw-r--r-- | src/se/leap/bitmaskclient/ConfigurationWizard.java | 20 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/ProviderDetailFragment.java | 9 | ||||
-rw-r--r-- | src/se/leap/bitmaskclient/ProviderListFragment.java | 8 |
3 files changed, 23 insertions, 14 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
|