com.activeandroid.rxschedulers.AndroidSchedulers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activeandroidrx Show documentation
Show all versions of activeandroidrx Show documentation
ActiveAndroid fork with reactive extensions.
package com.activeandroid.rxschedulers;
import android.os.Handler;
import android.os.Looper;
import rx.Scheduler;
/** Android-specific Schedulers. */
public final class AndroidSchedulers {
private AndroidSchedulers() {
throw new AssertionError("No instances");
}
private static final Scheduler MAIN_THREAD_SCHEDULER =
new HandlerScheduler(new Handler(Looper.getMainLooper()));
/** A {@link Scheduler} which executes actions on the Android UI thread. */
public static Scheduler mainThread() {
Scheduler scheduler =
RxAndroidPlugins.getInstance().getSchedulersHook().getMainThreadScheduler();
return scheduler != null ? scheduler : MAIN_THREAD_SCHEDULER;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy