Search in sources :

Example 1 with ColorIsDarkState

use of com.afollestad.aesthetic.ColorIsDarkState in project Shuttle by timusus.

the class PlayerFragment method invalidateColors.

void invalidateColors(ColorSet colorSet) {
    boolean ignorePalette = false;
    if (!settingsManager.getUsePalette() && !settingsManager.getUsePaletteNowPlayingOnly()) {
        // If we're not using Palette at all, use non-tinted colors for text.
        colorSet.setPrimaryTextColorTinted(colorSet.getPrimaryTextColor());
        colorSet.setSecondaryTextColorTinted(colorSet.getSecondaryTextColor());
        ignorePalette = true;
    }
    if (!isLandscape && backgroundView != null) {
        backgroundView.setBackgroundColor(colorSet.getPrimaryColor());
    }
    if (!isLandscape && currentTime != null) {
        currentTime.setTextColor(colorSet.getPrimaryTextColor());
    }
    if (!isLandscape && totalTime != null) {
        totalTime.setTextColor(colorSet.getPrimaryTextColor());
    }
    if (track != null) {
        track.setTextColor(colorSet.getPrimaryTextColorTinted());
    }
    if (album != null) {
        album.setTextColor(colorSet.getSecondaryTextColorTinted());
    }
    if (artist != null) {
        artist.setTextColor(colorSet.getSecondaryTextColorTinted());
    }
    if (seekBar != null) {
        seekBar.invalidateColors(new ColorIsDarkState(ignorePalette ? colorSet.getAccentColor() : colorSet.getPrimaryTextColorTinted(), false));
    }
    if (shuffleButton != null) {
        shuffleButton.invalidateColors(colorSet.getPrimaryTextColor(), colorSet.getPrimaryTextColorTinted());
    }
    if (repeatButton != null) {
        repeatButton.invalidateColors(colorSet.getPrimaryTextColor(), colorSet.getPrimaryTextColorTinted());
    }
    if (prevButton != null) {
        prevButton.invalidateColors(colorSet.getPrimaryTextColor());
    }
    if (nextButton != null) {
        nextButton.invalidateColors(colorSet.getPrimaryTextColor());
    }
    if (playPauseView != null) {
        playPauseView.setDrawableColor(colorSet.getPrimaryTextColor());
    }
    this.colorSet = colorSet;
}
Also used : ColorIsDarkState(com.afollestad.aesthetic.ColorIsDarkState)

Example 2 with ColorIsDarkState

use of com.afollestad.aesthetic.ColorIsDarkState in project Shuttle by timusus.

the class CustomCheckbox method onAttachedToWindow.

@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    subscriptions = new CompositeDisposable();
    // noinspection ConstantConditions
    subscriptions.add(Observable.combineLatest(ViewUtil.getObservableForResId(getContext(), backgroundResId, Aesthetic.get(getContext()).colorAccent()), Aesthetic.get(getContext()).isDark(), ColorIsDarkState.creator()).compose(Rx.<ColorIsDarkState>distinctToMainThread()).subscribe(colorIsDarkState -> invalidateColors(colorIsDarkState), onErrorLogAndRethrow()));
    ViewTextColorAction.create(this).accept(Color.BLACK);
}
Also used : Color(android.graphics.Color) Context(android.content.Context) ViewTextColorAction(com.afollestad.aesthetic.ViewTextColorAction) Aesthetic(com.afollestad.aesthetic.Aesthetic) CompositeDisposable(io.reactivex.disposables.CompositeDisposable) AttributeSet(android.util.AttributeSet) Rx(com.afollestad.aesthetic.Rx) Rx.onErrorLogAndRethrow(com.afollestad.aesthetic.Rx.onErrorLogAndRethrow) Observable(io.reactivex.Observable) AestheticCheckBox(com.afollestad.aesthetic.AestheticCheckBox) ColorIsDarkState(com.afollestad.aesthetic.ColorIsDarkState) ViewUtil(com.afollestad.aesthetic.ViewUtil) CompositeDisposable(io.reactivex.disposables.CompositeDisposable)

Aggregations

ColorIsDarkState (com.afollestad.aesthetic.ColorIsDarkState)2 Context (android.content.Context)1 Color (android.graphics.Color)1 AttributeSet (android.util.AttributeSet)1 Aesthetic (com.afollestad.aesthetic.Aesthetic)1 AestheticCheckBox (com.afollestad.aesthetic.AestheticCheckBox)1 Rx (com.afollestad.aesthetic.Rx)1 Rx.onErrorLogAndRethrow (com.afollestad.aesthetic.Rx.onErrorLogAndRethrow)1 ViewTextColorAction (com.afollestad.aesthetic.ViewTextColorAction)1 ViewUtil (com.afollestad.aesthetic.ViewUtil)1 Observable (io.reactivex.Observable)1 CompositeDisposable (io.reactivex.disposables.CompositeDisposable)1