comparison android/DWindows.kt @ 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
comparison
equal deleted inserted replaced
2733:34e34d5d56e8 2734:cd3c7740e352
5404 params.setMargins(margin,margin,margin,margin) 5404 params.setMargins(margin,margin,margin,margin)
5405 layout.addView(display, params) 5405 layout.addView(display, params)
5406 params = RelativeLayout.LayoutParams(w, w) 5406 params = RelativeLayout.LayoutParams(w, w)
5407 params.setMargins(margin,margin,margin,margin) 5407 params.setMargins(margin,margin,margin,margin)
5408 params.addRule(RelativeLayout.BELOW, display.id) 5408 params.addRule(RelativeLayout.BELOW, display.id)
5409 params.addRule(RelativeLayout.ABOVE, gradientBar.id)
5409 layout.addView(colorWheel, params) 5410 layout.addView(colorWheel, params)
5410 params = RelativeLayout.LayoutParams(w, h) 5411 params = RelativeLayout.LayoutParams(w, h)
5411 params.setMargins(margin,margin,margin,margin) 5412 params.setMargins(margin,margin,margin,margin)
5412 params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM) 5413 params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM)
5413 layout.addView(gradientBar, params) 5414 layout.addView(gradientBar, params)
5414 5415
5415 dialog.setContentView(layout) 5416 dialog.setContentView(layout)
5416 colorChosen = Color.rgb(red, green, blue) 5417 colorChosen = Color.rgb(red, green, blue)
5417 colorWheel.rgb = colorChosen 5418 colorWheel.rgb = colorChosen
5418 gradientBar.setBlackToColor(colorChosen) 5419 gradientBar.setBlackToColor(colorWheel.rgb)
5419 gradientBar.offset = 1F 5420 var hsv = FloatArray(3)
5421 Color.colorToHSV(colorChosen, hsv)
5422 gradientBar.offset = hsv[2]
5420 display.setBackgroundColor(colorChosen) 5423 display.setBackgroundColor(colorChosen)
5421 colorWheel.colorChangeListener = { rgb: Int -> 5424 colorWheel.colorChangeListener = { rgb: Int ->
5422 gradientBar.setBlackToColor(rgb) 5425 gradientBar.setBlackToColor(rgb)
5423 display.setBackgroundColor(gradientBar.argb) 5426 display.setBackgroundColor(gradientBar.argb)
5424 colorChosen = gradientBar.argb 5427 colorChosen = gradientBar.argb