card.io-Android-SDK
card.io-Android-SDK copied to clipboard
Cannot stylize buttons when using application theme
Required Information
- card.io Android SDK Version: 5.3.2
- Android Version and Device (Motorola Droid Razr Maxx with Android 4.4.2, Samsung S7 with Android 6.0, etc...): Sony Xperia Z3 @ Android 5.1.1
Issue Description
When using EXTRA_KEEP_APPLICATION_THEME
, buttons are not stylized as primary and secondary like they are without any theme. It would be useful to be able to control the style, in particular the color, of the buttons. For example, in my app, I have a green accent color used for all primary action buttons, but without forking cardio I am unable to make the accept button that color.
To be specific, in ViewUtil.styleAsButton()
, the primary
parameter is only used if useApplicationTheme
is false
.
Thinking of it, general theming support as supported by the android support library also for older platforms would be really great, either by allowing an EXTRA to keep a theme ID to be applied to the card io activities (instead of just "application theme = true/false") (and having theme properties such as primaryColor, accentColor etc apply to different parts of the layout), or, even fancier and super useful, by defining a card.io resource namespace with and declare stylables/attributes such as cardio:acceptButtonColor
, cardio:cancelButtonColor
, cardio:manualEntryButtonPosition
etc that can be stuffed into a custom theme and passed to CardIOActivity (it seems cardio doesn't really utilize android resources and the power of AAR:s at all currently?).
This issue may be related to #99 - there's more discussion about using the support library and buttons. I recall not styling the buttons when a theme is present because I thought the theme should do the styling for you. However, we can see that buttons are a complex case, and it doesn't work right.
You're also correct that we don't utilize the power of AARs, beyond packaging the jni's and proguard files together. However, that doesn't mean that we can't or won't, just that we haven't yet.