Mercurial > dwindows
changeset 2734:cd3c7740e352
Android: Attempt at some Color Chooser improvements... Fix layout.
Try to select the color passed in on the wheel and slider.
The wheel seems to work, but the slider seems wrong... attempted to convert
to HSV and use the V (brightness) value for the slider offset... seems like
this should work, but it is not the same when testing.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 15 Dec 2021 15:49:39 +0000 |
parents | 34e34d5d56e8 |
children | 970cbcdb68f9 |
files | android/DWindows.kt |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/android/DWindows.kt Wed Dec 15 14:53:04 2021 +0000 +++ b/android/DWindows.kt Wed Dec 15 15:49:39 2021 +0000 @@ -5406,6 +5406,7 @@ params = RelativeLayout.LayoutParams(w, w) params.setMargins(margin,margin,margin,margin) params.addRule(RelativeLayout.BELOW, display.id) + params.addRule(RelativeLayout.ABOVE, gradientBar.id) layout.addView(colorWheel, params) params = RelativeLayout.LayoutParams(w, h) params.setMargins(margin,margin,margin,margin) @@ -5415,8 +5416,10 @@ dialog.setContentView(layout) colorChosen = Color.rgb(red, green, blue) colorWheel.rgb = colorChosen - gradientBar.setBlackToColor(colorChosen) - gradientBar.offset = 1F + gradientBar.setBlackToColor(colorWheel.rgb) + var hsv = FloatArray(3) + Color.colorToHSV(colorChosen, hsv) + gradientBar.offset = hsv[2] display.setBackgroundColor(colorChosen) colorWheel.colorChangeListener = { rgb: Int -> gradientBar.setBlackToColor(rgb)