Skip to content

Commit

Permalink
Hide 'up indicator' if activity was started with NO_HISTORY flag
Browse files Browse the repository at this point in the history
That flag will cause the activity to be finished once navigating away
from it, which includes using the up navigation (which launches a new
activity on the task). Since the navigation is confusing that way, don't
offer it in the first place.

Fixes #1142
  • Loading branch information
maniac103 committed Nov 26, 2021
1 parent 17f56e7 commit 2eef605
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/src/main/java/com/gh4a/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,17 @@ protected void onCreate(Bundle savedInstanceState) {
setupNavigationDrawer();
setupHeaderDrawable();

boolean showHomeAsUp =
// if NO_HISTORY is set, we can't navigate up, since launching a new activity
// will kill our activity. Hide the icon in that case.
(getIntent().getFlags() & Intent.FLAG_ACTIVITY_NO_HISTORY) == 0
// new task intents we started ourselves also should not show home as up
&& !IntentUtils.isNewTaskIntent(getIntent());

ActionBar actionBar = getSupportActionBar();
actionBar.setTitle(getActionBarTitle());
actionBar.setSubtitle(getActionBarSubtitle());
actionBar.setDisplayHomeAsUpEnabled(!IntentUtils.isNewTaskIntent(getIntent()));
actionBar.setDisplayHomeAsUpEnabled(showHomeAsUp);

scheduleTaskDescriptionUpdate();
}
Expand Down

0 comments on commit 2eef605

Please sign in to comment.