summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-11-07 11:09:40 +0100
committerParménides GV <parmegv@sdf.org>2013-12-10 18:16:07 +0100
commit8abbfb678433c9033674db2c53070a01aa3a16a0 (patch)
tree9dab1168c145d6ddb5fdeab0a626e69532177d52 /src
parent0bcf72490f726825121e355afbeaf5b14636eb4d (diff)
Not added item is removed after canceling dialog.
Diffstat (limited to 'src')
-rw-r--r--src/se/leap/bitmaskclient/ConfigurationWizard.java7
-rw-r--r--src/se/leap/bitmaskclient/DownloadFailedDialog.java7
-rw-r--r--src/se/leap/bitmaskclient/ProviderListAdapter.java8
-rw-r--r--src/se/leap/bitmaskclient/ProviderListFragment.java6
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)