Makes full use of the Android Support Design Library. A lot of small things fixed or improved. Added dozens of new colors.
This commit is contained in:
parent
b233b3b718
commit
31926d7983
45 changed files with 447 additions and 599 deletions
|
|
@ -6,7 +6,6 @@ import android.content.SharedPreferences;
|
|||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.kabouzeid.gramophone.R;
|
||||
import com.kabouzeid.gramophone.dialogs.ColorChooserDialog;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -33,7 +32,6 @@ public final class PreferenceUtils {
|
|||
public static final String COLORED_NAVIGATION_BAR_PLAYIST = "colored_navigation_bar_playlist";
|
||||
public static final String COLORED_NAVIGATION_BAR_TAG_EDITOR = "colored_navigation_bar_tag_editor";
|
||||
public static final String COLORED_NAVIGATION_BAR_OTHER_SCREENS = "colored_navigation_bar_other_screens";
|
||||
public static final String TRANSPARENT_TOOLBAR = "transparent_toolbar";
|
||||
public static final String ALBUM_GRID_COLUMNS = "album_grid_columns";
|
||||
public static final String ALBUM_GRID_COLUMNS_LAND = "album_grid_columns_land";
|
||||
public static final String OPAQUE_TOOLBAR_NOW_PLAYING = "opaque_toolbar_now_playing";
|
||||
|
|
@ -72,7 +70,7 @@ public final class PreferenceUtils {
|
|||
}
|
||||
|
||||
public int getThemeColorPrimaryDarker() {
|
||||
return ColorChooserDialog.shiftColorDown(getThemeColorPrimary());
|
||||
return Util.shiftColorDown(getThemeColorPrimary());
|
||||
}
|
||||
|
||||
@SuppressLint("CommitPrefEdits")
|
||||
|
|
@ -161,10 +159,6 @@ public final class PreferenceUtils {
|
|||
// mPreferences.edit().putBoolean(COLORED_NAVIGATION_BAR_OTHER_SCREENS, coloredNavbar).commit();
|
||||
// }
|
||||
|
||||
public final boolean transparentToolbar() {
|
||||
return mPreferences.getBoolean(TRANSPARENT_TOOLBAR, false);
|
||||
}
|
||||
|
||||
public final boolean opaqueToolbarNowPlaying() {
|
||||
return mPreferences.getBoolean(OPAQUE_TOOLBAR_NOW_PLAYING, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,10 @@ package com.kabouzeid.gramophone.util;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
|
|
@ -107,6 +109,12 @@ public class Util {
|
|||
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
|
||||
}
|
||||
|
||||
public static void setAllowDrawUnderStatusBar(Window window) {
|
||||
window.getDecorView().setSystemUiVisibility(
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
}
|
||||
|
||||
// public static boolean isOnline(final Context context) {
|
||||
// if (context == null)
|
||||
// return false;
|
||||
|
|
@ -203,7 +211,31 @@ public class Util {
|
|||
return drawable;
|
||||
}
|
||||
|
||||
public static int getColorWithoutAlpha(@ColorInt int color) {
|
||||
public static int getOpaqueColor(@ColorInt int color) {
|
||||
return color | 0xFF000000;
|
||||
}
|
||||
|
||||
public static int getColorWithAlpha(float alpha, int baseColor) {
|
||||
int a = Math.min(255, Math.max(0, (int) (alpha * 255))) << 24;
|
||||
int rgb = 0x00ffffff & baseColor;
|
||||
return a + rgb;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResourceType")
|
||||
public static int shiftColorDown(int color) {
|
||||
int alpha = Color.alpha(color);
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color, hsv);
|
||||
hsv[2] *= 0.9f; // value component
|
||||
return (alpha << 24) + (0x00ffffff & Color.HSVToColor(hsv));
|
||||
}
|
||||
|
||||
public static ColorStateList getEmptyColorStateList(int color) {
|
||||
return new ColorStateList(
|
||||
new int[][]{
|
||||
new int[]{}
|
||||
},
|
||||
new int[]{color}
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue