This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Queue; | |
import java.util.concurrent.atomic.*; | |
import rx.*; | |
import rx.Observable.Operator; | |
import rx.exceptions.MissingBackpressureException; | |
import rx.internal.operators.*; | |
import rx.internal.util.*; | |
import rx.internal.util.atomic.SpscAtomicArrayQueue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun String.encodeBase64ToString(): String = String(this.toByteArray().encodeBase64()) | |
fun String.encodeBase64ToByteArray(): ByteArray = this.toByteArray().encodeBase64() | |
fun ByteArray.encodeBase64ToString(): String = String(this.encodeBase64()) | |
fun String.decodeBase64(): String = String(this.toByteArray().decodeBase64()) | |
fun String.decodeBase64ToByteArray(): ByteArray = this.toByteArray().decodeBase64() | |
fun ByteArray.decodeBase64ToString(): String = String(this.decodeBase64()) | |
fun ByteArray.encodeBase64(): ByteArray { | |
val table = (CharRange('A', 'Z') + CharRange('a', 'z') + CharRange('0', '9') + '+' + '/').toCharArray() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* An [Observer] for [Event]s, simplifying the pattern of checking if the [Event]'s content has | |
* already been handled. | |
* | |
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled. | |
*/ | |
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> { | |
override fun onChanged(event: Event<T>?) { | |
event?.getContentIfNotHandled()?.let { value -> | |
onEventUnhandledContent(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.support.annotation.AttrRes | |
import android.support.design.widget.CoordinatorLayout | |
import android.support.v4.view.NestedScrollingChild2 | |
import android.support.v4.view.NestedScrollingChildHelper | |
import android.util.AttributeSet | |
import android.view.View | |
import com.douglas.startpage.R |
OlderNewer