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.graphics.Rect | |
import android.view.View | |
import android.view.View.OnAttachStateChangeListener | |
import android.view.WindowInsets | |
import androidx.core.view.updatePadding | |
fun View.updatePaddingWithInsets(left: Boolean = false, | |
top: Boolean = false, | |
right: Boolean = false, | |
bottom: Boolean = false) { |
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.graphics.Path | |
import android.graphics.PointF | |
import android.transition.PathMotion | |
import kotlin.math.atan | |
import kotlin.math.sin | |
import kotlin.math.sqrt | |
import kotlin.math.tan | |
/** | |
* A PathMotion that generates a curved path along an arc on an imaginary circle containing the two points. The two |
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 Transition.sharedElementsInOverlay(container: ViewGroup, start: View, end: View): Transition = | |
addListener(object : Transition.TransitionListener { | |
val endParent = end.parent as ViewGroup | |
val endOriginalPosition = endParent.indexOfChild(end) | |
override fun onTransitionStart(transition: Transition) { | |
start.visibility = View.GONE | |
container.overlay.add(start) | |
container.overlay.add(end) | |
} |
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 rx.Emitter; | |
import rx.Observable; | |
import rx.schedulers.Schedulers; | |
public final class EmitterTest { | |
public static void main(String[] args) { | |
Observable<Integer> obs = Observable.fromEmitter(emitter -> { | |
for (int i = 1; i < 1000; i++) { | |
if (i % 5 == 0) { | |
sleep(300L); |
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.content.Context | |
import android.os.FileObserver | |
import com.squareup.moshi.JsonAdapter | |
import com.squareup.moshi.Moshi | |
import com.squareup.moshi.Types | |
import okio.Okio | |
import rx.Observable | |
import rx.Scheduler | |
import rx.lang.kotlin.observable | |
import rx.lang.kotlin.single |
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
/** | |
* <p> | |
* A simplified version of the String class. Unlike the normal implementation of | |
* String, memory is only allocated during initialisation, or when the internal | |
* character array must be expanded. | |
* </p> | |
* <p> | |
* This makes it useful for environments where text must be modified at run time | |
* whilst displaying smooth animations. | |
* </p> |