Mercurial > dwindows
changeset 2847:ca3cc0e1c563
Android: Preserve the background stripe color when selecting rows.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 18 Oct 2022 06:27:22 +0000 |
parents | e6edeb2b63bc |
children | 6790bea27685 |
files | android/DWindows.kt |
diffstat | 1 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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