Display hue slider

This commit is contained in:
Moez Bhatti
2018-03-24 04:48:11 -04:00
parent 63070609bd
commit 640a7b0109
2 changed files with 18 additions and 0 deletions
@@ -20,6 +20,7 @@ package feature.themepicker
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.support.constraint.ConstraintLayout
import android.util.AttributeSet
import android.view.MotionEvent
@@ -32,6 +33,9 @@ import kotlinx.android.synthetic.main.hsv_picker_view.view.*
class HSVPickerView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ConstraintLayout(context, attrs) {
private val hues = arrayOf(0xFFFF0000, 0xFFFFFF00, 0xFF00FF00, 0xFF00FFFF, 0xFF0000FF, 0xFFFF00FF, 0xFFFF0000)
.map { it.toInt() }.toIntArray()
private var min: Float = 0f
private var max = 0f
@@ -72,6 +76,9 @@ class HSVPickerView @JvmOverloads constructor(context: Context, attrs: Attribute
}
true
}
hueBackground.clipToOutline = true
hueBackground.setImageDrawable(GradientDrawable(GradientDrawable.Orientation.LEFT_RIGHT, hues))
}
private fun setupBounds() {