Translucent status bar in artist and album detail view on KitKat/Lollipop
This commit is contained in:
parent
872987bfc5
commit
a573e58261
3 changed files with 29 additions and 9 deletions
|
|
@ -65,6 +65,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
private int titleViewHeight;
|
private int titleViewHeight;
|
||||||
private int albumArtViewHeight;
|
private int albumArtViewHeight;
|
||||||
private int toolbarColor;
|
private int toolbarColor;
|
||||||
|
|
||||||
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
private final SmallObservableScrollViewCallbacks observableScrollViewCallbacks = new SmallObservableScrollViewCallbacks() {
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
public void onScrollChanged(int scrollY, boolean b, boolean b2) {
|
||||||
|
|
@ -105,9 +106,11 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
|
|
||||||
App.bus.register(this);
|
App.bus.register(this);
|
||||||
|
|
||||||
if (Util.hasLollipopSDK()) postponeEnterTransition();
|
if (Util.hasLollipopSDK()) {
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarAlbumEnabled())
|
postponeEnterTransition();
|
||||||
|
if (PreferenceUtils.getInstance(this).coloredNavigationBarAlbumEnabled())
|
||||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||||
|
}
|
||||||
|
|
||||||
Bundle intentExtras = getIntent().getExtras();
|
Bundle intentExtras = getIntent().getExtras();
|
||||||
int albumId = -1;
|
int albumId = -1;
|
||||||
|
|
@ -125,6 +128,11 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
setUpViews();
|
setUpViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean translucentStatusBarOnLollipop() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean shouldColorStatusBar() {
|
protected boolean shouldColorStatusBar() {
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -155,6 +163,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
int toolbarHeight = Util.getActionBarSize(this);
|
int toolbarHeight = Util.getActionBarSize(this);
|
||||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||||
headerOffset = toolbarHeight;
|
headerOffset = toolbarHeight;
|
||||||
|
if (Util.hasKitKatSDK())
|
||||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,15 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
||||||
getSupportActionBar().setTitle(null);
|
getSupportActionBar().setTitle(null);
|
||||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
|
||||||
if (Util.hasLollipopSDK()) fixLollipopTransitionImageWrongSize();
|
if (Util.hasLollipopSDK()) {
|
||||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
fixLollipopTransitionImageWrongSize();
|
||||||
|
startPostponedEnterTransition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean translucentStatusBarOnLollipop() {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -165,6 +172,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
||||||
int toolbarHeight = Util.getActionBarSize(this);
|
int toolbarHeight = Util.getActionBarSize(this);
|
||||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||||
headerOffset = toolbarHeight;
|
headerOffset = toolbarHeight;
|
||||||
|
if (Util.hasKitKatSDK())
|
||||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,8 +76,7 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
|
|
||||||
protected void setUpTranslucence(boolean statusBarTranslucent, boolean navigationBarTranslucent) {
|
protected void setUpTranslucence(boolean statusBarTranslucent, boolean navigationBarTranslucent) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||||
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
if (translucentStatusBarOnLollipop() || Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||||
// Not needed on Lollipop
|
|
||||||
Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent);
|
Util.setStatusBarTranslucent(getWindow(), statusBarTranslucent);
|
||||||
}
|
}
|
||||||
if (Util.isInPortraitMode(this) || Util.isTablet(this)) {
|
if (Util.isInPortraitMode(this) || Util.isTablet(this)) {
|
||||||
|
|
@ -88,6 +87,10 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean translucentStatusBarOnLollipop() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract boolean shouldColorStatusBar();
|
protected abstract boolean shouldColorStatusBar();
|
||||||
|
|
||||||
protected abstract boolean shouldColorNavBar();
|
protected abstract boolean shouldColorNavBar();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue