# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1639583379 0 # Node ID cd3c7740e3528bd51f421b00151b23a102d4fe55 # Parent 34e34d5d56e8fea40e9a639e350f0e234c60006f 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. diff -r 34e34d5d56e8 -r cd3c7740e352 android/DWindows.kt --- 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)