Moved a method to the ColorUtil class
This commit is contained in:
parent
357ef1df69
commit
abedc48f23
2 changed files with 6 additions and 1 deletions
|
|
@ -26,6 +26,7 @@ import com.kabouzeid.gramophone.R;
|
|||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.service.MusicService;
|
||||
import com.kabouzeid.gramophone.ui.activities.MainActivity;
|
||||
import com.kabouzeid.gramophone.util.ColorUtil;
|
||||
import com.kabouzeid.gramophone.util.MusicUtil;
|
||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||
import com.nostra13.universalimageloader.core.DisplayImageOptions;
|
||||
|
|
@ -253,7 +254,7 @@ public class PlayingNotificationHelper {
|
|||
if (vibrantSwatch != null) {
|
||||
int bgColor = vibrantSwatch.getRgb();
|
||||
setBackgroundColor(bgColor);
|
||||
setNotificationTextDark((Color.red(bgColor) * 0.299 + Color.green(bgColor) * 0.587 + Color.blue(bgColor) * 0.114) > 186);
|
||||
setNotificationTextDark(ColorUtil.useDarkTextColorOnBackground(bgColor));
|
||||
backgroundColorSet = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,8 @@ public class ColorUtil {
|
|||
new int[]{color}
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean useDarkTextColorOnBackground(int backgroundColor) {
|
||||
return (Color.red(backgroundColor) * 0.299 + Color.green(backgroundColor) * 0.587 + Color.blue(backgroundColor) * 0.114) > 186;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue