summaryrefslogtreecommitdiff
path: root/app/src/main/java/se/leap/bitmaskclient
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2019-05-21 12:42:12 +0200
committercyBerta <cyberta@riseup.net>2019-05-21 12:42:12 +0200
commite92081d9aff29b0f2592ab960593c59b5db41dbc (patch)
treebc3b4d03a6a537c27ce1d483ddafa2b72cd5f858 /app/src/main/java/se/leap/bitmaskclient
parentcaadb236f39b4b6139a697eec57aa2796595422f (diff)
* if provider allows only anonymous vpn connections, skip the provider detail activity
* fix app crash on switch provider
Diffstat (limited to 'app/src/main/java/se/leap/bitmaskclient')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java24
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/MainActivity.java8
3 files changed, 20 insertions, 16 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java b/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java
index 6349cb15..36dd5868 100644
--- a/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/AbstractProviderDetailActivity.java
@@ -48,10 +48,13 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct
if (provider.allowsRegistered()) {
optionsList.add(getString(R.string.login_to_profile));
optionsList.add(getString(R.string.create_profile));
+ if (provider.allowsAnonymous()) {
+ optionsList.add(getString(R.string.use_anonymously_button));
+ }
+ } else {
+ onAnonymouslySelected();
}
- if (provider.allowsAnonymous()) {
- optionsList.add(getString(R.string.use_anonymously_button));
- }
+
options.setAdapter(new ArrayAdapter<>(
this,
@@ -71,11 +74,7 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct
Log.d(TAG, "signup selected");
intent = new Intent(getApplicationContext(), SignupActivity.class);
} else {
- Log.d(TAG, "use anonymously selected");
- intent = new Intent();
- intent.putExtra(Provider.KEY, provider);
- setResult(RESULT_OK, intent);
- finish();
+ onAnonymouslySelected();
return;
}
intent.putExtra(PROVIDER_KEY, provider);
@@ -101,4 +100,13 @@ public abstract class AbstractProviderDetailActivity extends ConfigWizardBaseAct
}
}
+ private void onAnonymouslySelected() {
+ Intent intent;
+ Log.d(TAG, "use anonymously selected");
+ intent = new Intent();
+ intent.putExtra(Provider.KEY, provider);
+ setResult(RESULT_OK, intent);
+ finish();
+ }
+
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java b/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java
index a612820d..d567277d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java
+++ b/app/src/main/java/se/leap/bitmaskclient/FragmentManagerEnhanced.java
@@ -53,10 +53,6 @@ public class FragmentManagerEnhanced {
}
- public FragmentTransaction beginTransaction() {
- return genericFragmentManager.beginTransaction();
- }
-
public Fragment findFragmentByTag(String tag) {
return genericFragmentManager.findFragmentByTag(tag);
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java
index b0acd860..32b4562a 100644
--- a/app/src/main/java/se/leap/bitmaskclient/MainActivity.java
+++ b/app/src/main/java/se/leap/bitmaskclient/MainActivity.java
@@ -182,14 +182,14 @@ public class MainActivity extends AppCompatActivity implements EipSetupListener,
break;
}
}
- //TODO: Why do we want this --v? legacy and redundant?
+
+ // on switch provider we need to set the EIP fragment
Fragment fragment = new EipFragment();
Bundle arguments = new Bundle();
arguments.putParcelable(PROVIDER_KEY, provider);
fragment.setArguments(arguments);
- new FragmentManagerEnhanced(getSupportFragmentManager()).beginTransaction()
- .replace(R.id.container, fragment, EipFragment.TAG)
- .commit();
+ new FragmentManagerEnhanced(getSupportFragmentManager())
+ .replace(R.id.main_container, fragment, EipFragment.TAG);
}
@Override