diff options
4 files changed, 28 insertions, 0 deletions
diff --git a/src/se/leap/bitmaskclient/ConfigurationWizard.java b/src/se/leap/bitmaskclient/ConfigurationWizard.java index f4409056..012a444c 100644 --- a/src/se/leap/bitmaskclient/ConfigurationWizard.java +++ b/src/se/leap/bitmaskclient/ConfigurationWizard.java @@ -477,6 +477,13 @@ implements ProviderListFragment.Callbacks, NewProviderDialogInterface, ProviderD if(provider_list_fragment != null)
provider_list_fragment.unhideAll();
}
+
+ public void removeLastProviderItem() {
+ provider_list_fragment = (ProviderListFragment) getFragmentManager().findFragmentByTag(ProviderListFragment.TAG);
+ if(provider_list_fragment != null) {
+ provider_list_fragment.removeLastItem();
+ }
+ }
@Override
public void login() {
diff --git a/src/se/leap/bitmaskclient/DownloadFailedDialog.java b/src/se/leap/bitmaskclient/DownloadFailedDialog.java index 72455b2f..b759b1a3 100644 --- a/src/se/leap/bitmaskclient/DownloadFailedDialog.java +++ b/src/se/leap/bitmaskclient/DownloadFailedDialog.java @@ -18,6 +18,7 @@ import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.NewProviderDialog.NewProviderDialogInterface; +import se.leap.bitmaskclient.ProviderListContent.ProviderItem; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -57,6 +58,11 @@ public class DownloadFailedDialog extends DialogFragment { }) .setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { + ConfigHelper.removeFromSharedPref(Provider.KEY); + ConfigHelper.removeFromSharedPref(ProviderItem.DANGER_ON); + ConfigHelper.removeFromSharedPref(EIP.ALLOWED_ANON); + ConfigHelper.removeFromSharedPref(EIP.KEY); + interface_with_ConfigurationWizard.removeLastProviderItem(); dialog.dismiss(); } }); @@ -67,6 +73,7 @@ public class DownloadFailedDialog extends DialogFragment { public interface DownloadFailedDialogInterface { public void retrySetUpProvider(); + public void removeLastProviderItem(); } DownloadFailedDialogInterface interface_with_ConfigurationWizard; diff --git a/src/se/leap/bitmaskclient/ProviderListAdapter.java b/src/se/leap/bitmaskclient/ProviderListAdapter.java index 4abf15a2..c5e8b64d 100644 --- a/src/se/leap/bitmaskclient/ProviderListAdapter.java +++ b/src/se/leap/bitmaskclient/ProviderListAdapter.java @@ -86,6 +86,14 @@ public class ProviderListAdapter<T> extends ArrayAdapter<T> { new_hidden[hidden.length] = false; hidden = new_hidden; } + + @Override + public void remove(T item) { + super.remove(item); + boolean[] new_hidden = new boolean[hidden.length-1]; + System.arraycopy(hidden, 0, new_hidden, 0, hidden.length-1); + hidden = new_hidden; + } @Override public View getView(int index, View convertView, ViewGroup parent) { diff --git a/src/se/leap/bitmaskclient/ProviderListFragment.java b/src/se/leap/bitmaskclient/ProviderListFragment.java index 76628f8c..53b6cb6d 100644 --- a/src/se/leap/bitmaskclient/ProviderListFragment.java +++ b/src/se/leap/bitmaskclient/ProviderListFragment.java @@ -201,6 +201,12 @@ public class ProviderListFragment extends ListFragment { content_adapter.notifyDataSetChanged();
}
+ public void removeLastItem() {
+ unhideAll();
+ content_adapter.remove(content_adapter.getItem(content_adapter.getCount()-1));
+ content_adapter.notifyDataSetChanged();
+ }
+
public void hideAllBut(int position) {
for(int i = 0; i < content_adapter.getCount(); i++)
if(i != position)
|