diff --git a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimation.kt b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimation.kt index 9a2f15f..668fad8 100644 --- a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimation.kt +++ b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimation.kt @@ -16,6 +16,7 @@ object RxAnimation { * @param view [View] param mandatory. * @return An [Observable] of [View]. */ + @JvmStatic fun from(view: View): Observable = Observable.just(view) /** @@ -25,6 +26,7 @@ object RxAnimation { * @see from * @return A [Completable]. */ + @JvmStatic fun together(vararg completables: Completable): Completable = Completable.mergeArray(*completables) @@ -35,6 +37,7 @@ object RxAnimation { * @see from * @return A [Completable]. */ + @JvmStatic fun sequentially(vararg completables: Completable): Completable = completables.first().run { if (completables.size > 1) { diff --git a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimationExtension.kt b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimationExtension.kt index 2773391..2b1800d 100644 --- a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimationExtension.kt +++ b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxAnimationExtension.kt @@ -1,3 +1,4 @@ +@file:JvmName("RxAnimationExtension") package com.mikhaellopez.rxanimation import android.animation.TimeInterpolator @@ -27,6 +28,7 @@ private fun Observable.doCompletable(actionCompletable: (View) -> Completa * @param action ([Any]) -> [Unit] the action to do on UpdateListener. * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.startValueAnimator( valueAnimator: ValueAnimator, duration: Long? = null, @@ -50,6 +52,7 @@ fun Observable.startValueAnimator( * @see rangeInt * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.rangeFloat( start: Float, end: Float, duration: Long? = null, @@ -72,6 +75,7 @@ fun Observable.rangeFloat( * @see rangeFloat * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.rangeInt( start: Int, end: Int, duration: Long? = null, @@ -98,6 +102,7 @@ fun Observable.rangeInt( * @see fadeOut * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.alpha( alpha: Float, duration: Long? = null, @@ -121,6 +126,7 @@ fun Observable.alpha( * @see fadeOut * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.fadeIn( duration: Long? = null, interpolator: TimeInterpolator? = null, @@ -143,6 +149,7 @@ fun Observable.fadeIn( * @see fadeIn * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.fadeOut( duration: Long? = null, interpolator: TimeInterpolator? = null, @@ -167,6 +174,7 @@ fun Observable.fadeOut( * @param reverse [Boolean] optional, false by default. * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.translation( translationX: Float, translationY: Float, @@ -201,6 +209,7 @@ fun Observable.translation( * @see translationY * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.translationX( translationX: Float, duration: Long? = null, @@ -225,6 +234,7 @@ fun Observable.translationX( * @see translationX * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.translationY( translationY: Float, duration: Long? = null, @@ -251,6 +261,7 @@ fun Observable.translationY( * @see scaleY * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.scale( scale: Float, duration: Long? = null, @@ -275,6 +286,7 @@ fun Observable.scale( * @see scaleY * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.scaleX( scaleX: Float, duration: Long? = null, @@ -299,6 +311,7 @@ fun Observable.scaleX( * @see scaleX * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.scaleY( scaleY: Float, duration: Long? = null, @@ -325,6 +338,7 @@ fun Observable.scaleY( * @see rotationY * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.rotation( rotation: Float, duration: Long? = null, @@ -349,6 +363,7 @@ fun Observable.rotation( * @see rotationY * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.rotationX( rotationX: Float, duration: Long? = null, @@ -373,6 +388,7 @@ fun Observable.rotationX( * @see rotationX * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.rotationY( rotationY: Float, duration: Long? = null, @@ -400,6 +416,7 @@ fun Observable.rotationY( * @return An [Observable] of [View]. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) +@JvmOverloads fun Observable.xyz( x: Float? = null, y: Float? = null, @@ -427,6 +444,7 @@ fun Observable.xyz( * @see z * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.x( x: Float, duration: Long? = null, @@ -452,6 +470,7 @@ fun Observable.x( * @see z * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.y( y: Float, duration: Long? = null, @@ -478,6 +497,7 @@ fun Observable.y( * @return An [Observable] of [View]. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) +@JvmOverloads fun Observable.z( z: Float, duration: Long? = null, @@ -502,6 +522,7 @@ fun Observable.z( * @param reverse [Boolean] optional, false by default. * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.resize( width: Int, height: Int, duration: Long? = null, @@ -524,6 +545,7 @@ fun Observable.resize( * @see height * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.width( width: Int, duration: Long? = null, @@ -546,6 +568,7 @@ fun Observable.width( * @see width * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.height( height: Int, duration: Long? = null, @@ -570,6 +593,7 @@ fun Observable.height( * @see View.backgroundColor * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.backgroundColor( colorFrom: Int, colorTo: Int, @@ -590,6 +614,7 @@ fun Observable.backgroundColor( * @see View.shake * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.shake( duration: Long = 300, nbShake: Float = 2f, @@ -610,6 +635,7 @@ fun Observable.shake( * @see View.press * @return An [Observable] of [View]. */ +@JvmOverloads fun Observable.press( depth: Float = 0.95f, duration: Long? = null, @@ -634,6 +660,7 @@ fun Observable.press( * @see TextView.text * @return An [Observable] of [TextView]. */ +@JvmOverloads fun Observable.text( text: String, duration: Long = 300L, diff --git a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxViewAnimationExtension.kt b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxViewAnimationExtension.kt index 3aeecb0..861b3ea 100644 --- a/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxViewAnimationExtension.kt +++ b/rxanimation/src/main/java/com/mikhaellopez/rxanimation/RxViewAnimationExtension.kt @@ -1,3 +1,4 @@ +@file:JvmName("RxViewAnimationExtension") package com.mikhaellopez.rxanimation import android.animation.* @@ -60,6 +61,7 @@ private fun Completable.reverse( * @see ViewPropertyAnimator * @return A [Completable]. */ +@JvmOverloads fun View.animate( alpha: Float? = null, translationX: Float? = null, @@ -128,6 +130,7 @@ private fun ValueAnimator.start( * @see startValueAnimator * @return A [Completable]. */ +@JvmOverloads fun ValueAnimator.start( duration: Long? = null, interpolator: Interpolator? = null, @@ -167,6 +170,7 @@ fun ViewPropertyAnimator.animate(): Completable = * @see rangeIntToCompletable * @return A [Completable]. */ +@JvmOverloads fun Pair.rangeFloatToCompletable( duration: Long? = null, interpolator: Interpolator? = null, @@ -193,6 +197,7 @@ fun Pair.rangeFloatToCompletable( * @see rangeFloatToCompletable * @return A [Completable]. */ +@JvmOverloads fun Pair.rangeIntToCompletable( duration: Long? = null, interpolator: Interpolator? = null, @@ -233,6 +238,7 @@ fun Pair.rangeIntToCompletable( * @see View.fadeOut * @return A [Completable]. */ +@JvmOverloads fun View.alpha( alpha: Float, duration: Long? = null, @@ -266,6 +272,7 @@ fun View.alpha( * @see View.alpha * @return A [Completable]. */ +@JvmOverloads fun View.fadeIn( duration: Long? = null, interpolator: TimeInterpolator? = null, @@ -289,6 +296,7 @@ fun View.fadeIn( * @see View.alpha * @return A [Completable]. */ +@JvmOverloads fun View.fadeOut( duration: Long? = null, interpolator: TimeInterpolator? = null, @@ -315,6 +323,7 @@ fun View.fadeOut( * @see View.translationY * @return A [Completable]. */ +@JvmOverloads fun View.translation( translationX: Float, translationY: Float, @@ -351,6 +360,7 @@ fun View.translation( * @see View.translationY * @return A [Completable]. */ +@JvmOverloads fun View.translationX( translationX: Float, duration: Long? = null, @@ -385,6 +395,7 @@ fun View.translationX( * @see View.translationX * @return A [Completable]. */ +@JvmOverloads fun View.translationY( translationY: Float, duration: Long? = null, @@ -421,6 +432,7 @@ fun View.translationY( * @see View.scaleY * @return A [Completable]. */ +@JvmOverloads fun View.scale( scale: Float, duration: Long? = null, @@ -461,6 +473,7 @@ fun View.scale( * @see View.scaleY * @return A [Completable]. */ +@JvmOverloads fun View.scaleX( scaleX: Float, duration: Long? = null, @@ -495,6 +508,7 @@ fun View.scaleX( * @see View.scaleX * @return A [Completable]. */ +@JvmOverloads fun View.scaleY( scaleY: Float, duration: Long? = null, @@ -531,6 +545,7 @@ fun View.scaleY( * @see View.rotationY * @return A [Completable]. */ +@JvmOverloads fun View.rotation( rotation: Float, duration: Long? = null, @@ -565,6 +580,7 @@ fun View.rotation( * @see View.rotationY * @return A [Completable]. */ +@JvmOverloads fun View.rotationX( rotationX: Float, duration: Long? = null, @@ -599,6 +615,7 @@ fun View.rotationX( * @see View.rotationX * @return A [Completable]. */ +@JvmOverloads fun View.rotationY( rotationY: Float, duration: Long? = null, @@ -639,6 +656,7 @@ fun View.rotationY( * @return A [Completable]. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) +@JvmOverloads fun View.xyz( x: Float? = null, y: Float? = null, @@ -678,6 +696,7 @@ fun View.xyz( * @see View.z * @return A [Completable]. */ +@JvmOverloads fun View.x( x: Float, duration: Long? = null, @@ -713,6 +732,7 @@ fun View.x( * @see View.z * @return A [Completable]. */ +@JvmOverloads fun View.y( y: Float, duration: Long? = null, @@ -749,6 +769,7 @@ fun View.y( * @return A [Completable]. */ @TargetApi(Build.VERSION_CODES.LOLLIPOP) +@JvmOverloads fun View.z( z: Float, duration: Long? = null, @@ -814,6 +835,7 @@ private fun View.heightToCompletable( * @see View.height * @return A [Completable]. */ +@JvmOverloads fun View.resize( width: Int, height: Int, duration: Long? = null, @@ -843,6 +865,7 @@ fun View.resize( * @see View.height * @return A [Completable]. */ +@JvmOverloads fun View.width( width: Int, duration: Long? = null, @@ -871,6 +894,7 @@ fun View.width( * @see View.width * @return A [Completable]. */ +@JvmOverloads fun View.height( height: Int, duration: Long? = null, @@ -915,6 +939,7 @@ private fun View.backgroundColorToCompletable( * @see backgroundColor * @return A [Completable]. */ +@JvmOverloads fun View.backgroundColor( colorFrom: Int, colorTo: Int, @@ -938,6 +963,7 @@ fun View.backgroundColor( * @see shake * @return A [Completable]. */ +@JvmOverloads fun View.shake( duration: Long = 300, nbShake: Float = 2f, @@ -965,6 +991,7 @@ fun View.shake( * @see press * @return A [Completable]. */ +@JvmOverloads fun View.press( depth: Float = 0.95f, duration: Long? = null, @@ -988,6 +1015,7 @@ fun View.press( * @param reverse [Boolean] optional, false by default. * @return A [Completable]. */ +@JvmOverloads fun TextView.text( text: String, duration: Long = 300L,