# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1666074442 0 # Node ID ca3cc0e1c5632498a5ef6afe9e63ce0c2eebd970 # Parent e6edeb2b63bca7df56f42f7416bb8a1412088cfe Android: Preserve the background stripe color when selecting rows. diff -r e6edeb2b63bc -r ca3cc0e1c563 android/DWindows.kt --- a/android/DWindows.kt Tue Oct 18 02:38:51 2022 +0000 +++ b/android/DWindows.kt Tue Oct 18 06:27:22 2022 +0000 @@ -2280,12 +2280,18 @@ class DWContainerRow : RelativeLayout, Checkable { private var mChecked = false private var colorSelection = Color.DKGRAY + private var colorBackground: Int? = null var position: Int = -1 var imageview: ImageView = ImageView(context) var text: TextView = TextView(context) var stack: LinearLayout = LinearLayout(context) var parent: ListView? = null + override fun setBackgroundColor(color: Int) { + colorBackground = color + super.setBackgroundColor(color) + } + fun setup(context: Context?) { val wrap = RelativeLayout.LayoutParams.WRAP_CONTENT val match = RelativeLayout.LayoutParams.MATCH_PARENT @@ -2321,9 +2327,14 @@ fun updateBackground() { if(mChecked) { - this.setBackgroundColor(colorSelection) + super.setBackgroundColor(colorSelection) } else { - this.setBackgroundColor(Color.TRANSPARENT) + // Preserve the stripe color when toggling selection + if(colorBackground != null) { + super.setBackgroundColor(colorBackground!!) + } else { + super.setBackgroundColor(Color.TRANSPARENT) + } } if(parent is ListView && position != -1) { val cont = this.parent as ListView