Do not display navigation icon if unneccessary
This commit is contained in:
parent
6d4af947a5
commit
8480db8dc1
|
@ -31,6 +31,7 @@ import de.danoeh.antennapod.R;
|
||||||
import de.danoeh.antennapod.core.event.MessageEvent;
|
import de.danoeh.antennapod.core.event.MessageEvent;
|
||||||
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
import de.danoeh.antennapod.core.preferences.UserPreferences;
|
||||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
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.core.util.download.AutoUpdateManager;
|
||||||
import de.danoeh.antennapod.dialog.RatingDialog;
|
import de.danoeh.antennapod.dialog.RatingDialog;
|
||||||
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
import de.danoeh.antennapod.fragment.AddFeedFragment;
|
||||||
|
@ -98,8 +99,11 @@ public class MainActivity extends CastEnabledActivity {
|
||||||
|
|
||||||
final FragmentManager fm = getSupportFragmentManager();
|
final FragmentManager fm = getSupportFragmentManager();
|
||||||
fm.addOnBackStackChangedListener(() -> {
|
fm.addOnBackStackChangedListener(() -> {
|
||||||
|
boolean showArrow = fm.getBackStackEntryCount() != 0;
|
||||||
if (drawerToggle != null) { // Tablet layout does not have a drawer
|
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);
|
drawerLayout.addDrawerListener(drawerToggle);
|
||||||
drawerToggle.syncState();
|
drawerToggle.syncState();
|
||||||
drawerToggle.setDrawerIndicatorEnabled(getSupportFragmentManager().getBackStackEntryCount() == 0);
|
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);
|
super.setSupportActionBar(toolbar);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,11 +33,15 @@ public abstract class ToolbarIconTintManager implements AppBarLayout.OnOffsetCha
|
||||||
public void updateTint() {
|
public void updateTint() {
|
||||||
if (isTinted) {
|
if (isTinted) {
|
||||||
doTint(new ContextThemeWrapper(context, R.style.Theme_AntennaPod_Dark));
|
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);
|
toolbar.getOverflowIcon().setColorFilter(0xffffffff, PorterDuff.Mode.SRC_ATOP);
|
||||||
} else {
|
} else {
|
||||||
doTint(context);
|
doTint(context);
|
||||||
toolbar.getNavigationIcon().clearColorFilter();
|
if (toolbar.getNavigationIcon() != null) { // Tablets do not show a navigation icon
|
||||||
|
toolbar.getNavigationIcon().clearColorFilter();
|
||||||
|
}
|
||||||
toolbar.getOverflowIcon().clearColorFilter();
|
toolbar.getOverflowIcon().clearColorFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue