mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
back press on first run activity closes app
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
db8940f6f7
commit
b7089df901
2 changed files with 15 additions and 1 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue