Skip to content

Instantly share code, notes, and snippets.

View gokulkrizh's full-sized avatar

gokul gokulkrizh

View GitHub Profile
@gokulkrizh
gokulkrizh / Extensions.kt
Last active February 28, 2020 10:03
Extension for feedback animation.
@SuppressLint("ClickableViewAccessibility")
fun View.feedBackTouchListener() {
// Add touch listener to view
setOnTouchListener(object : View.OnTouchListener {
override fun onTouch(v: View?, event: MotionEvent): Boolean {
when (event.action) {
// Press action
MotionEvent.ACTION_DOWN -> {
// scale ranges from 0.0f - 1.0f resp to percentage of view size
scaleAnimation(