mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Issue-944: Fix for same activity getting instantiated multiple times
This is happening because the finish() method on current activity is not called before switching to the new activity
This commit is contained in:
parent
c568f8180c
commit
2c1f20f1fd
1 changed files with 12 additions and 8 deletions
|
|
@ -91,35 +91,36 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
|
||||
@Override
|
||||
public boolean onNavigationItemSelected(@NonNull final MenuItem item) {
|
||||
switch (item.getItemId()) {
|
||||
final int itemId = item.getItemId();
|
||||
switch (itemId) {
|
||||
case R.id.action_home:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof ContributionsActivity)) {
|
||||
ContributionsActivity.startYourself(this);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_nearby:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof NearbyActivity)) {
|
||||
NearbyActivity.startYourself(this);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_about:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof AboutActivity)) {
|
||||
AboutActivity.startYourself(this);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_settings:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
if (!(this instanceof SettingsActivity)) {
|
||||
SettingsActivity.startYourself(this);
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_introduction:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
WelcomeActivity.startYourself(this);
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_feedback:
|
||||
drawerLayout.closeDrawer(navigationView);
|
||||
Intent feedbackIntent = new Intent(Intent.ACTION_SEND);
|
||||
|
|
@ -134,7 +135,7 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
} catch (ActivityNotFoundException e) {
|
||||
Toast.makeText(this, R.string.no_email_client, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
case R.id.action_logout:
|
||||
new AlertDialog.Builder(this)
|
||||
.setMessage(R.string.logout_verification)
|
||||
|
|
@ -146,10 +147,13 @@ public abstract class NavigationBaseActivity extends BaseActivity
|
|||
})
|
||||
.setNegativeButton(R.string.no, (dialog, which) -> dialog.cancel())
|
||||
.show();
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
Timber.e("Unknown option [%s] selected from the navigation menu", itemId);
|
||||
return false;
|
||||
}
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
private class BaseLogoutListener implements CommonsApplication.LogoutListener {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue