diff --git a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java index 76229305ed..49e1e6bb13 100644 --- a/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/main/java/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -198,6 +198,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity public static final String EMPTY_STRING = ""; private static final int REQUEST_CODE_QR_SCAN = 101; + public static final int REQUEST_CODE_FIRST_RUN = 102; /// parameters from EXTRAs in starter Intent @@ -978,6 +979,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity @Override protected void onNewIntent(Intent intent) { Log_OC.d(TAG, "onNewIntent()"); + + if (intent.getBooleanExtra(FirstRunActivity.EXTRA_EXIT, false)) { + super.finish(); + } + Uri data = intent.getData(); if (data != null && data.toString().startsWith(getString(R.string.oauth2_redirect_uri))) { mNewCapturedUriFromOAuth2Redirection = data; diff --git a/src/main/java/com/owncloud/android/ui/activity/FirstRunActivity.java b/src/main/java/com/owncloud/android/ui/activity/FirstRunActivity.java index a9a593caaa..d80cc8350a 100644 --- a/src/main/java/com/owncloud/android/ui/activity/FirstRunActivity.java +++ b/src/main/java/com/owncloud/android/ui/activity/FirstRunActivity.java @@ -54,6 +54,7 @@ import androidx.viewpager.widget.ViewPager; public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageChangeListener { public static final String EXTRA_ALLOW_CLOSE = "ALLOW_CLOSE"; + public static final String EXTRA_EXIT = "EXIT"; public static final int FIRST_RUN_RESULT_CODE = 199; private ProgressIndicator progressIndicator; @@ -157,6 +158,12 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh if (getIntent().getBooleanExtra(EXTRA_ALLOW_CLOSE, false)) { super.onBackPressed(); + } else { + Intent intent = new Intent(getApplicationContext(), AuthenticatorActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + intent.putExtra(EXTRA_EXIT, true); + startActivity(intent); + finish(); } } @@ -188,7 +195,8 @@ public class FirstRunActivity extends BaseActivity implements ViewPager.OnPageCh } if (isFirstRun(context) && context instanceof AuthenticatorActivity) { - context.startActivity(new Intent(context, FirstRunActivity.class)); + ((AuthenticatorActivity) context).startActivityForResult(new Intent(context, FirstRunActivity.class), + AuthenticatorActivity.REQUEST_CODE_FIRST_RUN); return true; } else { return false;