Skip to content

Instantly share code, notes, and snippets.

@Test
fun `hot observable to single with firstOrError`() {
val observable = Observable.fromIterable<Int>((1..5).toList())
.doOnNext { println("Source observable emitting $it") }
.publish()
val single = observable.firstOrError()
.doOnSuccess { println("Single succeeded with value: $it") }
val testObserver = single.test()
Source observable emitting 1
Single succeeded with value: 1
@Test
fun `observable to single with firstOrError`() {
val observable = Observable.fromIterable<Int>((1..5).toList())
.doOnNext { println("Source observable emitting $it") }
val single = observable.firstOrError()
.doOnSuccess { println("Single succeeded with value: $it") }
val testObserver = single.test().await()
@talosdev
talosdev / styles_v27.xml
Created August 28, 2019 13:01
Styles override for V27
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FlavorTheme" parent="FlavorThemeCompat.V27" />
<style name="FlavorThemeCompat.V27" parent="FlavorThemeCompat.V23">
<item name="android:windowLightNavigationBar">true</item>
<item name="android:navigationBarColor">@color/flavorPrimaryDarkColor</item>
</style>
@talosdev
talosdev / styles_v23.xml
Created August 28, 2019 12:49
Styles override for v23
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FlavorTheme" parent="FlavorThemeCompat.V23" />
<style name="FlavorThemeCompat.V23">
<item name="android:windowLightStatusBar">true</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="FlavorTheme" parent="FlavorThemeCompat">
<!-- this should be empty, just a reference to FlavorThemeCompat -->
<style/>
<style name="FlavorThemeCompat" parent="@style/Theme.AppCompat.Light">
<!-- Add any common attributes for all versions here -->
</style>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="flavorPrimaryDarkColor">#eeeeee</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="flavorPrimaryColor">@android:color/white</color>
<color name="flavorPrimaryDarkColor">#cccccc</color>
<color name="flavorAccentColor">#E64A19</color>
</resources>
@talosdev
talosdev / colors_dawn.xml
Last active August 28, 2019 11:22
Flavored colors dawn
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="flavorPrimaryColor">@android:color/white</color>
<color name="flavorPrimaryDarkColor">#eeeeee</color>
<color name="flavorAccentColor">#E64A19</color>
</resources>
@talosdev
talosdev / colors_dusk.xml
Created August 28, 2019 11:03
Flavored colors dusk
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="flavorPrimaryColor">#37474F</color>
<color name="flavorPrimaryDarkColor">#212121</color>
<color name="flavorAccentColor">#673AB7</color>
</resources>