card-io / card.io-Android-SDK

card.io provides fast, easy credit card scanning in mobile apps
Other
1.99k stars 532 forks source link

Cannot stylize buttons when using application theme #139

Open henhal opened 8 years ago

henhal commented 8 years ago

Required Information

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?).

braebot commented 8 years ago

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.