aboutsummaryrefslogtreecommitdiff
path: root/library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt
diff options
context:
space:
mode:
Diffstat (limited to 'library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt')
-rw-r--r--library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt10
1 files changed, 6 insertions, 4 deletions
diff --git a/library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt b/library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt
index fbaad1a..df842f6 100644
--- a/library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt
+++ b/library/src/main/kotlin/ca/allanwang/kau/views/SimpleRippleDrawable.kt
@@ -4,7 +4,6 @@ import android.content.res.ColorStateList
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.RippleDrawable
import android.support.annotation.ColorInt
-import ca.allanwang.kau.searchview.SearchItem
import ca.allanwang.kau.utils.adjustAlpha
/**
@@ -12,6 +11,9 @@ import ca.allanwang.kau.utils.adjustAlpha
*
* Tries to mimic a standard ripple, given the foreground and background colors
*/
-class SimpleRippleDrawable(@ColorInt foregroundColor: Int, @ColorInt backgroundColor: Int
-) : RippleDrawable(ColorStateList(arrayOf(intArrayOf()), intArrayOf(foregroundColor)),
- ColorDrawable(backgroundColor), ColorDrawable(foregroundColor.adjustAlpha(0.16f))) \ No newline at end of file
+fun createSimpleRippleDrawable(@ColorInt foregroundColor: Int, @ColorInt backgroundColor: Int): RippleDrawable {
+ val states = ColorStateList(arrayOf(intArrayOf()), intArrayOf(foregroundColor))
+ val content = ColorDrawable(backgroundColor)
+ val mask = ColorDrawable(foregroundColor.adjustAlpha(0.16f))
+ return RippleDrawable(states, content, mask)
+} \ No newline at end of file