1
0
mirror of https://github.com/TeamNewPipe/NewPipe.git synced 2024-11-22 19:12:45 +01:00

-Fixed bookmark fragment in main pager not showing hamburger menu.

This commit is contained in:
John Zhen Mo 2018-02-08 10:13:29 -08:00
parent c3941d5bec
commit 0630423c8e
2 changed files with 29 additions and 9 deletions

View File

@ -86,19 +86,30 @@ public abstract class BaseLocalListFragment<I, N> extends BaseStateFragment<I>
// Lifecycle - Menu
//////////////////////////////////////////////////////////////////////////*/
/** Determines if the fragment is part of the main fragment view pager.
* If so, then this method must be overriden to return true
* in order to show the hamburger menu. */
protected boolean isPartOfFrontPager() {
return false;
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
if (DEBUG) Log.d(TAG, "onCreateOptionsMenu() called with: menu = [" + menu +
"], inflater = [" + inflater + "]");
super.onCreateOptionsMenu(menu, inflater);
ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar != null) {
supportActionBar.setDisplayShowTitleEnabled(true);
if(useAsFrontPage) {
supportActionBar.setDisplayHomeAsUpEnabled(false);
} else {
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
final ActionBar supportActionBar = activity.getSupportActionBar();
if (supportActionBar == null) return;
supportActionBar.setDisplayShowTitleEnabled(true);
// Show up arrow icon if the fragment is not used as front page or part of the front pager
if (!useAsFrontPage && !isPartOfFrontPager()) {
// If set true, an up arrow icon will be displayed.
// If set false, no icon will be shown.
// If unset, show hamburger menu
supportActionBar.setDisplayHomeAsUpEnabled(true);
}
}

View File

@ -148,6 +148,15 @@ public final class BookmarkFragment
});
}
/*//////////////////////////////////////////////////////////////////////////
// Fragment Lifecycle - Menu
//////////////////////////////////////////////////////////////////////////*/
@Override
protected boolean isPartOfFrontPager() {
return true;
}
///////////////////////////////////////////////////////////////////////////
// Fragment LifeCycle - Loading
///////////////////////////////////////////////////////////////////////////