Mercurial > dwindows
comparison android/DWindows.kt @ 2686:95f61d3f3d0d
Android: Initial attempt at implmenting dw_window_get_preferred_size().
This function missing was causing layout issues in code using this function.
The SeekBar (slider/scrollbar/etc) code seems to be backwards but it works this way.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Wed, 27 Oct 2021 22:00:31 +0000 |
parents | 17c34bdaec6c |
children | 42ff9d95e87b |
comparison
equal
deleted
inserted
replaced
2685:17c34bdaec6c | 2686:95f61d3f3d0d |
---|---|
1239 dataArrayMap.remove(name) | 1239 dataArrayMap.remove(name) |
1240 } | 1240 } |
1241 } | 1241 } |
1242 } | 1242 } |
1243 | 1243 |
1244 fun windowGetPreferredSize(window: View): Long | |
1245 { | |
1246 var retval: Long = 0 | |
1247 | |
1248 waitOnUiThread { | |
1249 window.measure(0, 0) | |
1250 val width = window.measuredWidth | |
1251 val height = window.measuredHeight | |
1252 retval = width.toLong() or (height.toLong() shl 32) | |
1253 if(window is SeekBar) { | |
1254 val slider = window as SeekBar | |
1255 | |
1256 // If the widget is rotated, swap width and height | |
1257 if(slider.rotation != 270F && slider.rotation != 90F) { | |
1258 retval = height.toLong() or (width.toLong() shl 32) | |
1259 } | |
1260 } | |
1261 } | |
1262 return retval | |
1263 } | |
1264 | |
1244 fun windowGetData(window: View, name: String): Long { | 1265 fun windowGetData(window: View, name: String): Long { |
1245 var retval = 0L | 1266 var retval = 0L |
1246 | 1267 |
1247 if (window.tag != null) { | 1268 if (window.tag != null) { |
1248 val dataArrayMap: SimpleArrayMap<String, Long> = window.tag as SimpleArrayMap<String, Long> | 1269 val dataArrayMap: SimpleArrayMap<String, Long> = window.tag as SimpleArrayMap<String, Long> |