diff --git a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java index fea9e82eb..04d31d096 100644 --- a/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java +++ b/app/src/main/java/de/danoeh/antennapod/activity/MainActivity.java @@ -31,6 +31,7 @@ import de.danoeh.antennapod.R; import de.danoeh.antennapod.core.event.MessageEvent; import de.danoeh.antennapod.core.preferences.UserPreferences; import de.danoeh.antennapod.core.util.StorageUtils; +import de.danoeh.antennapod.core.util.ThemeUtils; import de.danoeh.antennapod.core.util.download.AutoUpdateManager; import de.danoeh.antennapod.dialog.RatingDialog; import de.danoeh.antennapod.fragment.AddFeedFragment; @@ -98,8 +99,11 @@ public class MainActivity extends CastEnabledActivity { final FragmentManager fm = getSupportFragmentManager(); fm.addOnBackStackChangedListener(() -> { + boolean showArrow = fm.getBackStackEntryCount() != 0; if (drawerToggle != null) { // Tablet layout does not have a drawer - drawerToggle.setDrawerIndicatorEnabled(fm.getBackStackEntryCount() == 0); + drawerToggle.setDrawerIndicatorEnabled(!showArrow); + } else if (getActionBar() != null) { + getActionBar().setDisplayHomeAsUpEnabled(showArrow); } }); @@ -161,6 +165,10 @@ public class MainActivity extends CastEnabledActivity { drawerLayout.addDrawerListener(drawerToggle); drawerToggle.syncState(); drawerToggle.setDrawerIndicatorEnabled(getSupportFragmentManager().getBackStackEntryCount() == 0); + } else if (getSupportFragmentManager().getBackStackEntryCount() == 0) { + toolbar.setNavigationIcon(null); + } else { + toolbar.setNavigationIcon(ThemeUtils.getDrawableFromAttr(this, R.attr.homeAsUpIndicator)); } super.setSupportActionBar(toolbar); } diff --git a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java index dcf8ff20d..163100fff 100644 --- a/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java +++ b/app/src/main/java/de/danoeh/antennapod/view/ToolbarIconTintManager.java @@ -33,11 +33,15 @@ public abstract class ToolbarIconTintManager implements AppBarLayout.OnOffsetCha public void updateTint() { if (isTinted) { doTint(new ContextThemeWrapper(context, R.style.Theme_AntennaPod_Dark)); - toolbar.getNavigationIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP); + if (toolbar.getNavigationIcon() != null) { // Tablets do not show a navigation icon + toolbar.getNavigationIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP); + } toolbar.getOverflowIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP); } else { doTint(context); - toolbar.getNavigationIcon().clearColorFilter(); + if (toolbar.getNavigationIcon() != null) { // Tablets do not show a navigation icon + toolbar.getNavigationIcon().clearColorFilter(); + } toolbar.getOverflowIcon().clearColorFilter(); } }