Skip to content

Commit

Permalink
Merge pull request #11769 from nextcloud/fix/back-icon
Browse files Browse the repository at this point in the history
Fix back arrow appearing as hamburger icon
  • Loading branch information
AndyScherzinger authored Jul 28, 2023
2 parents 8ec2f34 + 55bd8cb commit e7ee653
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,8 @@ public void onBackPressed() {
}
} else if (leftFragment instanceof PreviewTextStringFragment) {
createMinFragments(null);
} else if (leftFragment instanceof PreviewPdfFragment) {
super.onBackPressed();
} else {
// pop back
resetScrolling(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ protected void setTitle() {
setTitle(R.string.drawer_item_shared);
break;
default:
setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()));
setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false);
break;
}
}
Expand Down Expand Up @@ -1591,7 +1591,7 @@ public void onMessageEvent(ChangeMenuEvent changeMenuEvent) {
((FileDisplayActivity) activity).initSyncBroadcastReceiver();
}

setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()));
setTitle(themeUtils.getDefaultDisplayNameForRootFolder(getContext()), false);
activity.getIntent().removeExtra(OCFileListFragment.SEARCH_EVENT);
}

Expand Down Expand Up @@ -1843,18 +1843,30 @@ public void onMessageEvent(FileLockEvent event) {
}
}

/**
* Theme default action bar according to provided parameters.
* Replaces back arrow with hamburger menu icon.
*
* @param title string res id of title to be shown in action bar
*/
protected void setTitle(@StringRes final int title) {
setTitle(getContext().getString(title));
setTitle(requireContext().getString(title), true);
}

protected void setTitle(final String title) {
getActivity().runOnUiThread(() -> {
/**
* Theme default action bar according to provided parameters.
*
* @param title title to be shown in action bar
* @param showBackAsMenu iff true replace back arrow with hamburger menu icon
*/
protected void setTitle(final String title, Boolean showBackAsMenu) {
requireActivity().runOnUiThread(() -> {
if (getActivity() != null) {
final ActionBar actionBar = ((FileDisplayActivity) getActivity()).getSupportActionBar();
final Context context = getContext();

if (actionBar != null && context != null) {
viewThemeUtils.files.themeActionBar(context, actionBar, title, true);
viewThemeUtils.files.themeActionBar(context, actionBar, title, showBackAsMenu);
}
}
});
Expand Down

0 comments on commit e7ee653

Please sign in to comment.