Renamed two Util methods
This commit is contained in:
parent
82c7128ea8
commit
4b2921c6c7
10 changed files with 33 additions and 33 deletions
|
|
@ -106,7 +106,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
|
||||
App.bus.register(this);
|
||||
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
postponeEnterTransition();
|
||||
if (PreferenceUtils.getInstance(this).coloredNavigationBarAlbumEnabled())
|
||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||
|
|
@ -158,7 +158,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
int toolbarHeight = Util.getActionBarSize(this);
|
||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||
headerOffset = toolbarHeight;
|
||||
if (Util.hasKitKatSDK())
|
||||
if (Util.isAtLeastKitKat())
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
}
|
||||
|
||||
|
|
@ -189,7 +189,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
albumArtImageView.setImageResource(R.drawable.default_album_art);
|
||||
resetColors();
|
||||
}
|
||||
if (Util.hasLollipopSDK()) startPostponedEnterTransition();
|
||||
if (Util.isAtLeastLollipop()) startPostponedEnterTransition();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
toolbarColor = vibrantSwatch.getRgb();
|
||||
albumTitleView.setBackgroundColor(toolbarColor);
|
||||
albumTitleView.setTextColor(vibrantSwatch.getTitleTextColor());
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
|
||||
getWindow().setNavigationBarColor(toolbarColor);
|
||||
notifyTaskColorChange(toolbarColor);
|
||||
} else {
|
||||
|
|
@ -226,7 +226,7 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
albumTitleView.setBackgroundColor(defaultBarColor);
|
||||
albumTitleView.setTextColor(titleTextColor);
|
||||
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||
|
||||
notifyTaskColorChange(toolbarColor);
|
||||
|
|
@ -245,9 +245,9 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
|||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void setNavigationBarColored(boolean colored) {
|
||||
if (colored) {
|
||||
if (Util.hasLollipopSDK()) getWindow().setNavigationBarColor(toolbarColor);
|
||||
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(toolbarColor);
|
||||
} else {
|
||||
if (Util.hasLollipopSDK()) getWindow().setNavigationBarColor(Color.BLACK);
|
||||
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
|
||||
App.bus.register(this);
|
||||
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
postponeEnterTransition();
|
||||
if (PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||
|
|
@ -137,7 +137,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
getSupportActionBar().setTitle(null);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
fixLollipopTransitionImageWrongSize();
|
||||
startPostponedEnterTransition();
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
int toolbarHeight = Util.getActionBarSize(this);
|
||||
titleViewHeight = getResources().getDimensionPixelSize(R.dimen.title_view_height);
|
||||
headerOffset = toolbarHeight;
|
||||
if (Util.hasKitKatSDK())
|
||||
if (Util.isAtLeastKitKat())
|
||||
headerOffset += getResources().getDimensionPixelSize(R.dimen.statusMargin);
|
||||
}
|
||||
|
||||
|
|
@ -197,9 +197,9 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void setNavigationBarColored(boolean colored) {
|
||||
if (colored) {
|
||||
if (Util.hasLollipopSDK()) getWindow().setNavigationBarColor(toolbarColor);
|
||||
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(toolbarColor);
|
||||
} else {
|
||||
if (Util.hasLollipopSDK()) getWindow().setNavigationBarColor(Color.BLACK);
|
||||
if (Util.isAtLeastLollipop()) getWindow().setNavigationBarColor(Color.BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
toolbarColor = vibrantSwatch.getRgb();
|
||||
artistNameTv.setBackgroundColor(vibrantSwatch.getRgb());
|
||||
artistNameTv.setTextColor(vibrantSwatch.getTitleTextColor());
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
|
||||
getWindow().setNavigationBarColor(vibrantSwatch.getRgb());
|
||||
notifyTaskColorChange(toolbarColor);
|
||||
} else {
|
||||
|
|
@ -338,7 +338,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
|||
artistNameTv.setBackgroundColor(defaultBarColor);
|
||||
artistNameTv.setTextColor(titleTextColor);
|
||||
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||
|
||||
notifyTaskColorChange(toolbarColor);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class MainActivity extends AbsFabActivity
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||
setStatusBarTranslucent(!Util.isAtLeastLollipop());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
|
|
@ -90,7 +90,7 @@ public class MainActivity extends AbsFabActivity
|
|||
|
||||
@Override
|
||||
protected boolean shouldColorStatusBar() {
|
||||
return !Util.hasLollipopSDK();
|
||||
return !Util.isAtLeastLollipop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -139,13 +139,13 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
private void setUpBox(boolean boxEnabled) {
|
||||
if (boxEnabled) {
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
mediaControllerContainer.setElevation(getResources().getDimensionPixelSize(R.dimen.cardview_default_elevation));
|
||||
}
|
||||
mediaControllerContainer.setBackgroundColor(
|
||||
DialogUtils.resolveColor(this, R.attr.music_controller_container_color));
|
||||
} else {
|
||||
if (Util.hasLollipopSDK() && !Util.isInPortraitMode(this)) {
|
||||
if (Util.isAtLeastLollipop() && !Util.isInPortraitMode(this)) {
|
||||
mediaControllerContainer.setElevation(getResources().getDimensionPixelSize(R.dimen.cardview_default_elevation));
|
||||
mediaControllerContainer.setBackgroundColor(
|
||||
DialogUtils.resolveColor(this, R.attr.music_controller_container_color));
|
||||
|
|
@ -358,7 +358,7 @@ public class MusicControllerActivity extends AbsFabActivity {
|
|||
} else {
|
||||
footer.setBackgroundColor(newColor);
|
||||
}
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarCurrentPlayingEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarCurrentPlayingEnabled())
|
||||
getWindow().setNavigationBarColor(newColor);
|
||||
lastFooterColor = newColor;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class PlaylistDetailActivity extends AbsFabActivity {
|
|||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||
setStatusBarTranslucent(!Util.isAtLeastLollipop());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_playlist_detail);
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class SettingsActivity extends AbsBaseActivity implements ColorChooserDia
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||
setStatusBarTranslucent(!Util.isAtLeastLollipop());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_preferences);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ import android.graphics.Color;
|
|||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.afollestad.materialdialogs.ThemeSingleton;
|
||||
import com.kabouzeid.gramophone.R;
|
||||
|
|
@ -27,7 +26,7 @@ import com.readystatesoftware.systembartint.SystemBarTintManager;
|
|||
* <p/>
|
||||
* KitKat or Lollipop solid statusBar with the right color (primaryDark):
|
||||
* - shouldColorStatusBar return true OR return false and call setStatusBarColor() in the activity with a custom color
|
||||
* - setStatusBarTranslucent(!Util.hasLollipopSDK())
|
||||
* - setStatusBarTranslucent(!Util.isAtLeastLollipop())
|
||||
* <p/>
|
||||
* KitKat or Lollipop translucent statusBar (not the color is too dark on Lollipop and KitKat only does fading but MUCH better performance the setStatusBarColor in onScrollCallback)
|
||||
* - shouldColorStatusBar return false DO NOT return true and do not call setStatusBarColor() in this case at all here
|
||||
|
|
@ -108,8 +107,9 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
|
|||
|
||||
protected abstract boolean shouldColorNavBar();
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
protected final void setStatusBarColor(int color, boolean forceSystemBarTint) {
|
||||
if (!forceSystemBarTint && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (!forceSystemBarTint && Util.isAtLeastLollipop()) {
|
||||
getWindow().setStatusBarColor(color);
|
||||
} else {
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(this);
|
||||
|
|
@ -120,7 +120,7 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
|
|||
|
||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||
protected final void setShouldColorNavBar(boolean shouldColorNavBar) {
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
if (shouldColorNavBar) {
|
||||
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
|
||||
getWindow().setNavigationBarColor(primaryDark);
|
||||
|
|
@ -136,7 +136,7 @@ public abstract class ThemeBaseActivity extends AppCompatActivity implements Kab
|
|||
final int primaryDark = PreferenceUtils.getInstance(this).getThemeColorPrimaryDarker();
|
||||
setStatusBarColor(primaryDark, false);
|
||||
} else {
|
||||
if (Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastLollipop()) {
|
||||
getWindow().setStatusBarColor(Util.resolveColor(this, android.R.attr.statusBarColor));
|
||||
} else {
|
||||
SystemBarTintManager tintManager = new SystemBarTintManager(this);
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
setStatusBarTranslucent(!Util.hasLollipopSDK());
|
||||
setStatusBarTranslucent(!Util.isAtLeastLollipop());
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(getContentViewResId());
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
paletteColorPrimary = primaryColor;
|
||||
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
||||
setStatusBarColor(ColorChooserDialog.shiftColorDown(primaryColor), false);
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
||||
getWindow().setNavigationBarColor(primaryColor);
|
||||
notifyTaskColorChange(primaryColor);
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
|
||||
int primaryDark = ColorChooserDialog.shiftColorDown(paletteColorPrimary);
|
||||
setStatusBarColor(primaryDark, false);
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
||||
getWindow().setNavigationBarColor(primaryDark);
|
||||
}
|
||||
|
||||
|
|
@ -310,7 +310,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
|||
paletteColorPrimary = vibrantColor;
|
||||
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
||||
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
|
||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
|
||||
if (Util.isAtLeastLollipop() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
|
||||
getWindow().setNavigationBarColor(vibrantColor);
|
||||
notifyTaskColorChange(vibrantColor);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public abstract class AbsMainActivityFragment extends Fragment implements KabVie
|
|||
final int norm = Util.getActionBarSize(getActivity()) +
|
||||
getResources().getDimensionPixelSize(R.dimen.tab_height) +
|
||||
getResources().getDimensionPixelSize(R.dimen.list_padding_vertical);
|
||||
if (Util.hasKitKatSDK() && !Util.hasLollipopSDK()) {
|
||||
if (Util.isAtLeastKitKat() && !Util.isAtLeastLollipop()) {
|
||||
if (Util.isInPortraitMode(getActivity()) || Util.isTablet(getActivity())) {
|
||||
return norm + Util.getStatusBarHeight(getActivity());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,11 +178,11 @@ public class Util {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean hasLollipopSDK() {
|
||||
public static boolean isAtLeastLollipop() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
|
||||
}
|
||||
|
||||
public static boolean hasKitKatSDK() {
|
||||
public static boolean isAtLeastKitKat() {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue