Closed dominicoder closed 6 years ago
Thanks for the report. Ideally the CardForm#setXIcon
methods would all match the CardForm#XRequired
methods and be called before CardForm#setup
, without that there's not really an easy way to know when all the icons are unset. Without doing a major version to make those changes, you suggestion of adding CardForm#setIconsEnabled
would be a great addition, would you be willing to make a PR to add it?
Also #19 may be of some interest to you, it isn't quite done, but it adds cardholder name as a field.
Thanks for the reply. Not sure if I'll have the time to make a PR for this any time soon, unfortunately. But if / when I do and this isn't being worked on already, I'd be happy to tackle it myself. Thanks!
I'm going to close this, since it's not on our roadmap to address, but if you'd like to open a PR, we're happy to review it!
General information
Issue description
Relates to #22 (and it's associated fix https://github.com/braintree/android-card-form/commit/858d45bc77ee3cbd9e8b7927914655347351de46) If you set the card / postal code / phone number icons to 0 (to disable them) they are set to INVISIBLE instead of GONE and the associated text field maintains its explicit left padding, resulting in a ton of wasted space to the left of the form.
Example
We have a custom layout with a name field above the brain tree form. This looked great in 2.x, but with the update to 3.x and the icons that were forced on us, our UI would look like this:
For our app don't want the icons, or the empty whitespace that appears left of the expiration date, but then disabling them leads to this:
It'd be nice to disable all icons such that all that extra space is reclaimed. Something like:
CardForm.setIconsEnabled(false);
that sets all icons togone
and removes the excessive left padding from the associated fields.Workaround
For now, I'm going to extend
CardForm
and manually find and alter the views in question, but it'd be nice if this view were smarter about handling disabling these icons.