<lambda>null1 // Copyright 2015-present 650 Industries. All rights reserved.
2 package host.exp.exponent.views
3 
4 import android.content.Context
5 import android.graphics.Color
6 import android.util.AttributeSet
7 import android.view.MotionEvent
8 import androidx.appcompat.widget.AppCompatImageButton
9 
10 class ExponentImageButton : AppCompatImageButton {
11   constructor(context: Context) : super(context) {
12     init()
13   }
14 
15   constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
16     init()
17   }
18 
19   constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(
20     context,
21     attrs,
22     defStyleAttr
23   ) {
24     init()
25   }
26 
27   private fun init() {
28     setOnTouchListener { v, event ->
29       if (event.action == MotionEvent.ACTION_UP) {
30         setColorFilter(Color.TRANSPARENT)
31       } else if (event.action == MotionEvent.ACTION_DOWN) {
32         setColorFilter(Color.GRAY)
33       }
34       false
35     }
36   }
37 }
38