Skip to content

Commit

Permalink
Enhanced Back Button Functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparker0i committed Jun 4, 2017
1 parent aa74f74 commit b75dbde
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,15 @@ public void onInput(@NonNull MaterialDialog dialog, @NonNull CharSequence input)

@Override
public void onBackPressed() {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
if (drawer.isDrawerOpen()) {
drawer.closeDrawer();
}
else {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}

@Override
Expand Down

0 comments on commit b75dbde

Please sign in to comment.