Sliding panel (early version, current implementation will probably replaced with a fragment implementation soon), translucent and colored statusbar for KitKat everywhere, use correct text colors for secondary texts, numerous clean ups
This commit is contained in:
parent
8f6e03f742
commit
5f0bfdb14b
65 changed files with 1247 additions and 1177 deletions
|
|
@ -35,14 +35,14 @@ public class ColorUtil {
|
|||
return color | 0xFF000000;
|
||||
}
|
||||
|
||||
public static int getColorWithAlpha(float alpha, int baseColor) {
|
||||
public static int getColorWithAlpha(float alpha, @ColorInt 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) {
|
||||
public static int shiftColorDown(@ColorInt int color) {
|
||||
int alpha = Color.alpha(color);
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(color, hsv);
|
||||
|
|
@ -51,7 +51,7 @@ public class ColorUtil {
|
|||
}
|
||||
|
||||
@NonNull
|
||||
public static ColorStateList getEmptyColorStateList(int color) {
|
||||
public static ColorStateList getEmptyColorStateList(@ColorInt int color) {
|
||||
return new ColorStateList(
|
||||
new int[][]{
|
||||
new int[]{}
|
||||
|
|
@ -60,11 +60,15 @@ public class ColorUtil {
|
|||
);
|
||||
}
|
||||
|
||||
public static boolean useDarkTextColorOnBackground(int backgroundColor) {
|
||||
public static boolean useDarkTextColorOnBackground(@ColorInt int backgroundColor) {
|
||||
return (Color.red(backgroundColor) * 0.299 + Color.green(backgroundColor) * 0.587 + Color.blue(backgroundColor) * 0.114) > (255 / 2);
|
||||
}
|
||||
|
||||
public static int getTextColorForBackground(int backgroundColor) {
|
||||
return useDarkTextColorOnBackground(backgroundColor) ? Color.BLACK : Color.WHITE;
|
||||
public static int getPrimaryTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||
return useDarkTextColorOnBackground(backgroundColor) ? context.getResources().getColor(R.color.primary_text_default_material_light) : context.getResources().getColor(R.color.primary_text_default_material_dark);
|
||||
}
|
||||
|
||||
public static int getSecondaryTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||
return useDarkTextColorOnBackground(backgroundColor) ? context.getResources().getColor(R.color.secondary_text_default_material_light) : context.getResources().getColor(R.color.secondary_text_default_material_dark);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ import com.kabouzeid.gramophone.interfaces.KabViewsDisableAble;
|
|||
import com.kabouzeid.gramophone.model.Playlist;
|
||||
import com.kabouzeid.gramophone.ui.activities.AlbumDetailActivity;
|
||||
import com.kabouzeid.gramophone.ui.activities.ArtistDetailActivity;
|
||||
import com.kabouzeid.gramophone.ui.activities.MusicControllerActivity;
|
||||
import com.kabouzeid.gramophone.ui.activities.PlaylistDetailActivity;
|
||||
|
||||
/**
|
||||
|
|
@ -85,30 +84,6 @@ public class NavigationUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static void openCurrentPlayingIfPossible(final Activity activity, @Nullable final Pair[] sharedViews) {
|
||||
if (activity instanceof MusicControllerActivity) {
|
||||
activity.onBackPressed();
|
||||
return;
|
||||
}
|
||||
if (MusicPlayerRemote.getPosition() != -1) {
|
||||
if ((activity instanceof KabViewsDisableAble && ((KabViewsDisableAble) activity).areViewsEnabled()) || !(activity instanceof KabViewsDisableAble)) {
|
||||
if (activity instanceof KabViewsDisableAble)
|
||||
((KabViewsDisableAble) activity).disableViews();
|
||||
Intent intent = new Intent(activity, MusicControllerActivity.class);
|
||||
if (sharedViews != null) {
|
||||
@SuppressWarnings("unchecked") ActivityOptionsCompat optionsCompat = ActivityOptionsCompat.makeSceneTransitionAnimation(activity,
|
||||
sharedViews
|
||||
);
|
||||
ActivityCompat.startActivity(activity, intent, optionsCompat.toBundle());
|
||||
} else {
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, activity.getResources().getString(R.string.playing_queue_empty), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public static void openPlayingQueueDialog(@NonNull final AppCompatActivity activity) {
|
||||
PlayingQueueDialog dialog = PlayingQueueDialog.create();
|
||||
if (dialog != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue