Skip to content

Instantly share code, notes, and snippets.

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@xvadsan
xvadsan / ViewVisibilityExtensions.kt
Created December 19, 2020 07:55 — forked from brescia123/ViewVisibilityExtensions.kt
Useful Android Kotlin Extension functions to easily change the visibility of a View
/** Set the View visibility to VISIBLE and eventually animate the View alpha till 100% */
fun View.visible(animate: Boolean = true) {
if (animate) {
animate().alpha(1f).setDuration(300).setListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
super.onAnimationStart(animation)
visibility = View.VISIBLE
}
})
} else {
@xvadsan
xvadsan / Extention.kt
Created December 19, 2020 17:44 — forked from armanso/Extention.kt
Part 2 of blog post - Control view's shadow
fun View.setShadow(
@ColorRes shadowColor: Int,
@DimenRes cornerRadius: Int,
@DimenRes elevation: Int,
shadowGravity: Int = Gravity.BOTTOM,
@ColorRes backgroundColorResource: Int = 0
) {
val resource = context.resources
val firstLayer = 0
val ratioTopBottom = 3