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
class EnhancedMotionLayout @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyleAttr: Int = 0 | |
) : MotionLayout(context, attrs, defStyleAttr) { | |
private val listeners = CopyOnWriteArrayList<TransitionListener>() | |
fun addTransitionListener(listener: TransitionListener) { | |
listeners.addIfAbsent(listener) |
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 androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.LifecycleOwner | |
import androidx.lifecycle.OnLifecycleEvent | |
import kotlin.properties.ReadOnlyProperty | |
import kotlin.reflect.KProperty | |
/** | |
* Proxy for [LifecycleAwareLazyImpl] | |
* @see LifecycleAwareLazyImpl |
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
/** | |
* Merges two [ConstraintSet]s. If a Constraint exists in the first [ConstraintSet] and the second one, the original value will be replaced by the new value. | |
*/ | |
operator fun ConstraintSet.plus(other: ConstraintSet): ConstraintSet { | |
return this.copy().apply { updateWith(other) } | |
} | |
/** | |
* Clears the existing constraints and sets them to those of the [constraintSet] | |
*/ |
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
/** | |
* Helper class for [MotionLayout.TransitionListener] which provides Android Support Annotations and proper parameter names | |
*/ | |
abstract class TransitionListener: MotionLayout.TransitionListener { | |
/** | |
* Called when a transition has been completed | |
*/ | |
override fun onTransitionCompleted(view: MotionLayout, @IdRes constraintSetId: Int) = Unit |
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
package com.amulyakhare.textdrawable; | |
import android.graphics.*; | |
import android.graphics.drawable.ShapeDrawable; | |
import android.graphics.drawable.shapes.OvalShape; | |
import android.graphics.drawable.shapes.RectShape; | |
import android.graphics.drawable.shapes.RoundRectShape; | |
/** | |
* @author amulya |