Add only forward flag when coming from main activity

This commit is contained in:
Shinokuni 2019-05-23 21:53:00 +02:00
parent 52219995bb
commit 14596c75fd
2 changed files with 7 additions and 1 deletions

View File

@ -41,10 +41,15 @@ public class AccountTypeListActivity extends AppCompatActivity {
binding.accountTypeRecyclerview.setLayoutManager(new LinearLayoutManager(this));
binding.accountTypeRecyclerview.addItemDecoration(new DividerItemDecoration(this, LinearLayout.VERTICAL));
boolean fromMainActivity = getIntent().getBooleanExtra("fromMainActivity", false);
adapter = new AccountTypeListAdapter(accountType -> {
if (!(accountType.getAccountType() == Account.AccountType.LOCAL)) {
Intent intent = new Intent(getApplicationContext(), AddAccountActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
if (fromMainActivity)
intent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
intent.putExtra("accountType", accountType);
startActivity(intent);

View File

@ -145,6 +145,7 @@ public class MainActivity extends AppCompatActivity implements SwipeRefreshLayou
switch (id) {
case DrawerManager.ADD_ACCOUNT_ID:
Intent intent = new Intent(this, AccountTypeListActivity.class);
intent.putExtra("fromMainActivity", true);
startActivityForResult(intent, ADD_ACCOUNT_REQUEST);
break;
case DrawerManager.ACCOUNT_SETTINGS_ID: