# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1666060731 0 # Node ID e6edeb2b63bca7df56f42f7416bb8a1412088cfe # Parent 64c528d38fb8505719ea417734be120c9e4bc506 Android: Fix container problems after a clear(). diff -r 64c528d38fb8 -r e6edeb2b63bc android/DWindows.kt --- a/android/DWindows.kt Mon Sep 26 08:35:26 2022 +0000 +++ b/android/DWindows.kt Tue Oct 18 02:38:51 2022 +0000 @@ -2284,6 +2284,7 @@ var imageview: ImageView = ImageView(context) var text: TextView = TextView(context) var stack: LinearLayout = LinearLayout(context) + var parent: ListView? = null fun setup(context: Context?) { val wrap = RelativeLayout.LayoutParams.WRAP_CONTENT @@ -2324,7 +2325,7 @@ } else { this.setBackgroundColor(Color.TRANSPARENT) } - if(this.parent is ListView && position != -1) { + if(parent is ListView && position != -1) { val cont = this.parent as ListView val adapter = cont.adapter as DWContainerAdapter @@ -2333,8 +2334,10 @@ } override fun setChecked(b: Boolean) { - mChecked = b - updateBackground() + if(b != mChecked) { + mChecked = b + updateBackground() + } } override fun isChecked(): Boolean { @@ -2396,8 +2399,9 @@ if(rowView == null) { rowView = DWContainerRow(context) - // Save the position for later use + // Save variables for later use rowView.position = position + rowView.parent = parent as ListView // Handle DW_CONTAINER_MODE_MULTI by setting the orientation vertical if(contMode == 2) { @@ -2465,8 +2469,9 @@ } } } else { - // Need to save the position to set the check state + // Update the position and parent rowView.position = position + rowView.parent = parent as ListView // Refresh the selected state from the model rowView.isChecked = model.getRowSelected(position) @@ -5416,6 +5421,8 @@ adapter.lastClickRow = -1 adapter.selectedItem = -1 adapter.model.clear() + + windowSetData(cont, "_dw_rowstart", 0L) } }