Java Code Examples for com.kabouzeid.appthemehelper.util.ColorUtil#darkenColor()

The following examples show how to use com.kabouzeid.appthemehelper.util.ColorUtil#darkenColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FlatPlayerFragment.java    From Music-Player with GNU General Public License v3.0 6 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.playbackControlsFragment.getView(), fragment.lastColor, newColor);
    Animator statusBarAnimator = ViewUtil.createBackgroundColorTransition(fragment.playerStatusBar, fragment.lastColor, newColor);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(backgroundAnimator, statusBarAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.MUSIC_ANIM_TIME);
    return animatorSet;
}
 
Example 2
Source File: FlatPlayerFragment.java    From Orin with GNU General Public License v3.0 6 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.playbackControlsFragment.getView(), fragment.lastColor, newColor);
    Animator statusBarAnimator = ViewUtil.createBackgroundColorTransition(fragment.playerStatusBar, fragment.lastColor, newColor);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(backgroundAnimator, statusBarAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
    return animatorSet;
}
 
Example 3
Source File: FlatPlayerFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 6 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.playbackControlsFragment.getView(), fragment.lastColor, newColor);
    Animator statusBarAnimator = ViewUtil.createBackgroundColorTransition(fragment.playerStatusBar, fragment.lastColor, newColor);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(backgroundAnimator, statusBarAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.VINYL_MUSIC_PLAYER_ANIM_TIME);
    return animatorSet;
}
 
Example 4
Source File: FlatPlayerFragment.java    From Phonograph with GNU General Public License v3.0 6 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.playbackControlsFragment.getView(), fragment.lastColor, newColor);
    Animator statusBarAnimator = ViewUtil.createBackgroundColorTransition(fragment.playerStatusBar, fragment.lastColor, newColor);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(backgroundAnimator, statusBarAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
    return animatorSet;
}
 
Example 5
Source File: CardPlayerFragment.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //noinspection ConstantConditions
        int x = (int) (fragment.playbackControlsFragment.playPauseFab.getX() + fragment.playbackControlsFragment.playPauseFab.getWidth() / 2 + fragment.playbackControlsFragment.getView().getX());
        int y = (int) (fragment.playbackControlsFragment.playPauseFab.getY() + fragment.playbackControlsFragment.playPauseFab.getHeight() / 2 + fragment.playbackControlsFragment.getView().getY() + fragment.playbackControlsFragment.progressSlider.getHeight());
        float startRadius = Math.max(fragment.playbackControlsFragment.playPauseFab.getWidth() / 2, fragment.playbackControlsFragment.playPauseFab.getHeight() / 2);
        float endRadius = Math.max(fragment.colorBackground.getWidth(), fragment.colorBackground.getHeight());
        fragment.colorBackground.setBackgroundColor(newColor);
        backgroundAnimator = ViewAnimationUtils.createCircularReveal(fragment.colorBackground, x, y, startRadius, endRadius);
    } else {
        backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.colorBackground, fragment.lastColor, newColor);
    }

    AnimatorSet animatorSet = new AnimatorSet();

    animatorSet.play(backgroundAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.MUSIC_ANIM_TIME);
    return animatorSet;
}
 
Example 6
Source File: MusicColorUtil.java    From Music-Player with GNU General Public License v3.0 5 votes vote down vote up
@ColorInt
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
    while (ColorUtil.isColorLight(backgroundColor)) {
        backgroundColor = ColorUtil.darkenColor(backgroundColor);
    }
    return backgroundColor;
}
 
Example 7
Source File: CardPlayerFragment.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int topMargin = fragment.getResources().getDimensionPixelSize(R.dimen.status_bar_padding);
        //noinspection ConstantConditions
        int x = (int) (fragment.playbackControlsFragment.playPauseFab.getX() + fragment.playbackControlsFragment.playPauseFab.getWidth() / 2 + fragment.playbackControlsFragment.getView().getX());
        int y = (int) (topMargin + fragment.playbackControlsFragment.playPauseFab.getY() + fragment.playbackControlsFragment.playPauseFab.getHeight() / 2 + fragment.playbackControlsFragment.getView().getY());
        float startRadius = Math.max(fragment.playbackControlsFragment.playPauseFab.getWidth() / 2, fragment.playbackControlsFragment.playPauseFab.getHeight() / 2);
        float endRadius = Math.max(fragment.colorBackground.getWidth(), fragment.colorBackground.getHeight());
        fragment.colorBackground.setBackgroundColor(newColor);
        backgroundAnimator = ViewAnimationUtils.createCircularReveal(fragment.colorBackground, x, y, startRadius, endRadius);
    } else {
        backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.colorBackground, fragment.lastColor, newColor);
    }

    AnimatorSet animatorSet = new AnimatorSet();

    animatorSet.play(backgroundAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
    return animatorSet;
}
 
Example 8
Source File: PhonographColorUtil.java    From Orin with GNU General Public License v3.0 5 votes vote down vote up
@ColorInt
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
    while (ColorUtil.isColorLight(backgroundColor)) {
        backgroundColor = ColorUtil.darkenColor(backgroundColor);
    }
    return backgroundColor;
}
 
Example 9
Source File: AbsSlidingMusicPanelActivity.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
public void onPanelExpanded(View panel) {
    // setting fragments values
    int playerFragmentColor = mPlayerFragment.getPaletteColor();
    if (PreferenceUtil.getInstance(this).getAdaptiveColor() || ATHUtil.isWindowBackgroundDark(this)
            /*|| (currentNowPlayingScreen == NowPlayingScreen.FULL)*/) {
        super.setLightStatusbar(false);
    } else
        super.setLightStatusbar(true);
    super.setTaskDescriptionColor(playerFragmentColor);
    super.setNavigationbarColor(ColorUtil.darkenColor(ThemeStore.primaryColor(this)));

    mPlayerFragment.setMenuVisibility(true);
    mPlayerFragment.setUserVisibleHint(true);
    mPlayerFragment.onShow();
}
 
Example 10
Source File: RetroMusicColorUtil.java    From RetroMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@ColorInt
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
    while (ColorUtil.isColorLight(backgroundColor)) {
        backgroundColor = ColorUtil.darkenColor(backgroundColor);
    }
    return backgroundColor;
}
 
Example 11
Source File: CardPlayerFragment.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //noinspection ConstantConditions
        int x = (int) (fragment.playbackControlsFragment.playPauseFab.getX() + fragment.playbackControlsFragment.playPauseFab.getWidth() / 2 + fragment.playbackControlsFragment.getView().getX());
        int y = (int) (fragment.playbackControlsFragment.playPauseFab.getY() + fragment.playbackControlsFragment.playPauseFab.getHeight() / 2 + fragment.playbackControlsFragment.getView().getY() + fragment.playbackControlsFragment.progressSlider.getHeight());
        float startRadius = Math.max(fragment.playbackControlsFragment.playPauseFab.getWidth() / 2, fragment.playbackControlsFragment.playPauseFab.getHeight() / 2);
        float endRadius = Math.max(fragment.colorBackground.getWidth(), fragment.colorBackground.getHeight());
        fragment.colorBackground.setBackgroundColor(newColor);
        backgroundAnimator = ViewAnimationUtils.createCircularReveal(fragment.colorBackground, x, y, startRadius, endRadius);
    } else {
        backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.colorBackground, fragment.lastColor, newColor);
    }

    AnimatorSet animatorSet = new AnimatorSet();

    animatorSet.play(backgroundAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.VINYL_MUSIC_PLAYER_ANIM_TIME);
    return animatorSet;
}
 
Example 12
Source File: VinylMusicPlayerColorUtil.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@ColorInt
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
    while (ColorUtil.isColorLight(backgroundColor)) {
        backgroundColor = ColorUtil.darkenColor(backgroundColor);
    }
    return backgroundColor;
}
 
Example 13
Source File: CardPlayerFragment.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
public AnimatorSet createDefaultColorChangeAnimatorSet(int newColor) {
    Animator backgroundAnimator;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        //noinspection ConstantConditions
        int x = (int) (fragment.playbackControlsFragment.playPauseFab.getX() + fragment.playbackControlsFragment.playPauseFab.getWidth() / 2 + fragment.playbackControlsFragment.getView().getX());
        int y = (int) (fragment.playbackControlsFragment.playPauseFab.getY() + fragment.playbackControlsFragment.playPauseFab.getHeight() / 2 + fragment.playbackControlsFragment.getView().getY() + fragment.playbackControlsFragment.progressSlider.getHeight());
        float startRadius = Math.max(fragment.playbackControlsFragment.playPauseFab.getWidth() / 2, fragment.playbackControlsFragment.playPauseFab.getHeight() / 2);
        float endRadius = Math.max(fragment.colorBackground.getWidth(), fragment.colorBackground.getHeight());
        fragment.colorBackground.setBackgroundColor(newColor);
        backgroundAnimator = ViewAnimationUtils.createCircularReveal(fragment.colorBackground, x, y, startRadius, endRadius);
    } else {
        backgroundAnimator = ViewUtil.createBackgroundColorTransition(fragment.colorBackground, fragment.lastColor, newColor);
    }

    AnimatorSet animatorSet = new AnimatorSet();

    animatorSet.play(backgroundAnimator);

    if (!ATHUtil.isWindowBackgroundDark(fragment.getActivity())) {
        int adjustedLastColor = ColorUtil.isColorLight(fragment.lastColor) ? ColorUtil.darkenColor(fragment.lastColor) : fragment.lastColor;
        int adjustedNewColor = ColorUtil.isColorLight(newColor) ? ColorUtil.darkenColor(newColor) : newColor;
        Animator subHeaderAnimator = ViewUtil.createTextColorTransition(fragment.playerQueueSubHeader, adjustedLastColor, adjustedNewColor);
        animatorSet.play(subHeaderAnimator);
    }

    animatorSet.setDuration(ViewUtil.PHONOGRAPH_ANIM_TIME);
    return animatorSet;
}
 
Example 14
Source File: PhonographColorUtil.java    From Phonograph with GNU General Public License v3.0 5 votes vote down vote up
@ColorInt
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
    while (ColorUtil.isColorLight(backgroundColor)) {
        backgroundColor = ColorUtil.darkenColor(backgroundColor);
    }
    return backgroundColor;
}