Instead of the verbose setOnClickListener
:
RxView.clicks(submitButton).subscribe(o -> log("submit button clicked!"));
Observable
.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
/** | |
* @param interval The base interval to start backing off from. The function is: attemptNum^2 * intervalTime | |
* @param units The units for interval | |
* @param retryAttempts The max number of attempts to retry this task or -1 to try MAX_INT times, | |
*/ | |
public static <T> Observable.Transformer<T, T> backoff(final long interval, final TimeUnit units, final int retryAttempts) { | |
return new Observable.Transformer<T, T>() { | |
@Override | |
public Observable<T> call(final Observable<T> observable) { | |
return observable.retryWhen( |
class Parent { | |
// Somewhere in here, a lot of external service modules are included and contribute their `Service` impls to this multibinding | |
@Inject lateinit var services: Map<String, Provider<Service>> | |
fun showChild() { | |
addChildController(serviceKey = "barServiceKey") // Key into the services map | |
} | |
} |
fun notification() { | |
val channelId = "stars" | |
val notificationManager = activity.getSystemService<NotificationManager>() | |
if (VERSION.SDK_INT >= VERSION_CODES.O) { | |
val channels = notificationManager.notificationChannels | |
if (channels.none { it.id == channelId }) { | |
NotificationChannel( | |
channelId, "stars", NotificationManager.IMPORTANCE_HIGH) | |
.apply { | |
description = "Demo" |
val asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true) | |
RxAndroidPlugins.setInitMainThreadSchedulerHandler { asyncMainThreadScheduler } | |
// Or if the default scheduler is already initialiazed | |
RxAndroidPlugins.setMainThreadSchedulerHandler { asyncMainThreadScheduler } |
Scheduler asyncMainThreadScheduler = AndroidSchedulers.from(Looper.getMainLooper(), true); | |
RxAndroidPlugins.setInitMainThreadSchedulerHandler(callable -> asyncMainThreadScheduler); | |
// Or if the default scheduler is already initialiazed | |
RxAndroidPlugins.setMainThreadSchedulerHandler(scheduler -> asyncMainThreadScheduler); |
import com.google.common.truth.Truth.assertThat | |
import org.junit.Test | |
inline fun <T> guard(receiver: T?, block: () -> Nothing): T { | |
if (receiver == null) { | |
block() | |
} | |
return receiver | |
} |
import android.support.v4.view.animation.PathInterpolatorCompat; | |
import android.view.animation.Interpolator; | |
/** | |
* Cheatsheet: http://easings.net/ | |
*/ | |
public class EasingsConstants { | |
public static final Interpolator easeInSine = PathInterpolatorCompat.create(0.47f, 0f, 0.745f, 0.715f); | |
public static final Interpolator easeOutSine = PathInterpolatorCompat.create(0.39f, 0.575f, 0.565f, 1f); | |
public static final Interpolator easeInOutSine = PathInterpolatorCompat.create(0.445f, 0.05f, 0.55f, 0.95f); |
> Task :compileJava | |
warning: [options] bootstrap class path not set in conjunction with -source 1.6 | |
warning: [options] source value 1.6 is obsolete and will be removed in a future release | |
warning: [options] target value 1.6 is obsolete and will be removed in a future release | |
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. | |
/Users/zsweers/dev/java/contributing/RxJava/src/main/java/io/reactivex/Single.java:135: error: [NullAway] passing @Nullable parameter 'null' where @NonNull is required | |
return RxJavaPlugins.onAssembly(new SingleAmb<T>(null, sources)); | |
^ | |
(see http://t.uber.com/nullaway ) | |
/Users/zsweers/dev/java/contributing/RxJava/src/main/java/io/reactivex/Single.java:163: error: [NullAway] passing @Nullable parameter 'null' where @NonNull is required |