This file contains hidden or 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 <K> K.springAnimationOf( | |
property: FloatPropertyCompat<K>, | |
finalPosition: Float = Float.NaN | |
): SpringAnimation { | |
return if (finalPosition.isNaN()) { | |
SpringAnimation(this, property) | |
} else { | |
SpringAnimation(this, property, finalPosition) | |
} | |
} |
This file contains hidden or 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
val springAnimation = view.springAnimationOf(DynamicAnimation.TRANSLATION_Y) | |
val springAnimation = view.springAnimationOf(DynamicAnimation.TRANSLATION_Y, 0f) |
This file contains hidden or 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
val springForce = SpringForce(0f) | |
.setStiffness(SpringForce.STIFFNESS_MEDIUM) | |
.setDampingRatio(SpringForce.DAMPING_RATIO_HIGH_BOUNCY) | |
val springAnimation = SpringAnimation(view, DynamicAnimation.TRANSLATION_X) | |
.setSpring(springForce) |
This file contains hidden or 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
inline fun <K: View> K.springAnimationOf(property: FloatPropertyCompat<K>, | |
finalPosition: Float, | |
func: SpringForce.() -> Unit): SpringAnimation { | |
val springAnimation = SpringAnimation(this, property, finalPosition) | |
springAnimation.spring.func() | |
return springAnimation | |
} |
This file contains hidden or 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
val springAnimation = view.springAnimationOf(DynamicAnimation.TRANSLATION_X, 0f) { | |
stiffness = STIFFNESS_MEDIUM | |
dampingRatio = DAMPING_RATIO_MEDIUM_BOUNCY | |
} |
This file contains hidden or 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
inline fun <K: View> K.springAnimationOf(property: FloatPropertyCompat<K>, | |
func: SpringForce.() -> Unit): SpringAnimation { | |
val springAnimation = SpringAnimation(this, property) | |
val springForce = SpringForce() | |
springForce.func() | |
springAnimation.spring = springForce | |
return springAnimation | |
} |
This file contains hidden or 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
val springAnimation = view.springAnimationOf(DynamicAnimation.TRANSLATION_X) { | |
stiffness = STIFFNESS_MEDIUM | |
dampingRatio = DAMPING_RATIO_MEDIUM_BOUNCY | |
} |
This file contains hidden or 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 demo { | |
print("Hi there") | |
} |
This file contains hidden or 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 Trie { | |
data class Node(var word: String? = null, val childNodes: MutableMap<Char, Node> = mutableMapOf()) | |
private val root = Node() | |
fun insert(word: String) { | |
var currentNode = root | |
for (char in word) { | |
if (currentNode.childNodes[char] == null) { |
This file contains hidden or 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
. | |
. | |
. | |
launch { | |
//CoroutineScope | |
val permissionResult = PermissionManager.requestPermissions( //Suspends the coroutine | |
this@Fragment, | |
REQUEST_ID, | |
Manifest.permission.ACCESS_FINE_LOCATION, |