mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Display hue slider
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -46,8 +46,19 @@
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:background="@drawable/circle"
|
||||
android:elevation="2dp"
|
||||
android:padding="2dp"
|
||||
android:src="@drawable/circle"
|
||||
tools:tint="@color/tools_theme" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/hueBackground"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="2dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:background="@drawable/rounded_rectangle_2dp"
|
||||
app:layout_constraintEnd_toEndOf="@id/saturation"
|
||||
app:layout_constraintStart_toStartOf="@id/saturation"
|
||||
app:layout_constraintTop_toBottomOf="@id/saturation" />
|
||||
|
||||
</merge>
|
||||
Reference in New Issue
Block a user