diff options
Diffstat (limited to 'app/src/main/java')
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 |