Skip to content

Commit

Permalink
fix #1007: Prevented switching to home on clicking Share or Settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-jha98 authored and therajanmaurya committed Feb 1, 2019
1 parent 2fe0f1e commit 82e313b
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class HomeActivity extends BaseActivity implements UserDetailsView, Navig
private static final int PLAY_SERVICES_RESOLUTION_REQUEST = 9000;
private boolean isReceiverRegistered;
private int menuItem;
boolean doubleBackToExitPressedOnce = false;
boolean doubleBackToExitPressedOnce = false;

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down Expand Up @@ -154,9 +154,14 @@ protected void onResume() {
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// select which item to open
clearFragmentBackStack();
setToolbarElevation();
menuItem = item.getItemId();
if (menuItem != R.id.item_settings && menuItem != R.id.item_share) {
// If we have clicked something other than settings or share
// we can safely clear the back stack as a new fragment will replace
// the current fragment.
clearFragmentBackStack();
}
switch (item.getItemId()) {
case R.id.item_home:
hideToolbarElevation();
Expand Down Expand Up @@ -431,6 +436,7 @@ public void onClick(View v) {
// Click Header to view full profile of User
startActivity(new Intent(HomeActivity.this, UserProfileActivity.class));
}

/**
* Check the device to make sure it has the Google Play Services APK. If
* it doesn't, display a dialog that allows users to download the APK from
Expand Down

0 comments on commit 82e313b

Please sign in to comment.