Skip to content

Commit

Permalink
Update MDC
Browse files Browse the repository at this point in the history
Slider values can now be changed with single clicks too
  • Loading branch information
Akilesh-T committed Jan 28, 2020
1 parent 0906d58 commit 9d8ecc7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ class ColorCustomisationFragment: Fragment() {
val hsl = FloatArray(3)
ColorUtils.colorToHSL(colorLight, hsl)

binding.lightSliders.hue.setOnChangeListener { _, value ->
binding.lightSliders.hue.addOnChangeListener { _, value, _ ->
hsl[0] = value
newColor = ColorUtils.HSLToColor(hsl)
model.lightAccent.value = toHex(newColor)
}

binding.lightSliders.saturation.setOnChangeListener { _, value ->
binding.lightSliders.saturation.addOnChangeListener { _, value, _ ->
hsl[1] = value
newColor = ColorUtils.HSLToColor(hsl)
model.lightAccent.value = toHex(newColor)
}

binding.lightSliders.lightness.setOnChangeListener { _, value ->
binding.lightSliders.lightness.addOnChangeListener { _, value, _ ->
hsl[2] = value
newColor = ColorUtils.HSLToColor(hsl)
model.lightAccent.value = toHex(newColor)
Expand All @@ -198,19 +198,19 @@ class ColorCustomisationFragment: Fragment() {
val hsl = FloatArray(3)
ColorUtils.colorToHSL(colorDark, hsl)

binding.darkSliders.hue.setOnChangeListener { _, value ->
binding.darkSliders.hue.addOnChangeListener { _, value, _ ->
hsl[0] = value
newColor = ColorUtils.HSLToColor(hsl)
model.darkAccent.value = toHex(newColor)
}

binding.darkSliders.saturation.setOnChangeListener { _, value ->
binding.darkSliders.saturation.addOnChangeListener { _, value, _ ->
hsl[1] = value
newColor = ColorUtils.HSLToColor(hsl)
model.darkAccent.value = toHex(newColor)
}

binding.darkSliders.lightness.setOnChangeListener { _, value ->
binding.darkSliders.lightness.addOnChangeListener { _, value, _ ->
hsl[2] = value
newColor = ColorUtils.HSLToColor(hsl)
model.darkAccent.value = toHex(newColor)
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/res/layout/hsl_sliders.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:orientation="vertical">
android:orientation="vertical"
>


<androidx.appcompat.widget.LinearLayoutCompat
Expand All @@ -26,7 +26,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:floatingLabel="true"
android:valueFrom="0"
android:valueTo="359" />

Expand All @@ -50,7 +49,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:floatingLabel="true"
android:valueFrom="0"
android:valueTo="1" />

Expand All @@ -73,7 +71,6 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:floatingLabel="true"
android:valueFrom="0"
android:valueTo="1" />

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object Libraries {
const val lifecycle = "2.2.0-rc03"
const val coroutines = "1.3.3"
const val fragment = "1.2.0-rc05"
const val material = "1.2.0-alpha03"
const val material = "1.2.0-alpha04"
const val libSu = "2.5.1"
const val chroma = "1.2.6"
const val bouncycastle = "1.63"
Expand Down

0 comments on commit 9d8ecc7

Please sign in to comment.