Mercurial > dwindows
comparison android/DWindows.kt @ 2808:965c3c6ed1ed
Android: Gray out disabled bitmap buttons...
Previously there was no way to visually know if an ImageButton was disabled.
This uses a deprecated method, but the new way didn't seem to work...
May have a change coming soon if I can get the new method working.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 26 Jul 2022 17:55:26 +0000 |
parents | d7b6e19e44d2 |
children | f81e92947f4a |
comparison
equal
deleted
inserted
replaced
2807:975df4680ff7 | 2808:965c3c6ed1ed |
---|---|
2992 return retval | 2992 return retval |
2993 } | 2993 } |
2994 | 2994 |
2995 fun windowSetEnabled(window: View, state: Boolean) { | 2995 fun windowSetEnabled(window: View, state: Boolean) { |
2996 waitOnUiThread { | 2996 waitOnUiThread { |
2997 window.setEnabled(state) | 2997 window.isEnabled = state |
2998 if(window is ImageButton) { | |
2999 val ib = window as ImageButton | |
3000 | |
3001 if(ib.drawable != null) { | |
3002 if(state) { | |
3003 ib.drawable.setColorFilter(null) | |
3004 } else { | |
3005 ib.drawable.setColorFilter(Color.LTGRAY, PorterDuff.Mode.SRC_IN) | |
3006 } | |
3007 if(ib.background != null) { | |
3008 if(state) { | |
3009 ib.background.setColorFilter(null) | |
3010 } else { | |
3011 ib.background.setColorFilter(Color.LTGRAY, PorterDuff.Mode.SRC_IN) | |
3012 } | |
3013 } | |
3014 } | |
3015 } | |
2998 } | 3016 } |
2999 } | 3017 } |
3000 | 3018 |
3001 fun typefaceFromFontName(fontname: String?): Typeface? | 3019 fun typefaceFromFontName(fontname: String?): Typeface? |
3002 { | 3020 { |