Search in sources :

Example 1 with Rx

use of com.afollestad.aesthetic.Rx 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

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 ColorIsDarkState (com.afollestad.aesthetic.ColorIsDarkState)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