vinaygaba / CreditCardView

💳 CreditCardView is an Android library that allows developers to create the UI which replicates an actual Credit Card.
797 stars 143 forks source link

Card doesn't render properly when programatically setting card number etc. #13

Closed biddster closed 9 years ago

biddster commented 9 years ago

I'm using the card view in a list. In the list adapter's getView, I findViewById for the credit card view and then I set card number, name and expiry.

The following scenarios happen:

  1. If the card isn't editable, nothing appears in the fields.
  2. If the card is editable, I can tap in the card number field and then my card number appears.
  3. If I remove the programmatic calls to setCardNumber etc and hardcode the number, name and expiry in the layout xml, the card renders correctly.
vinaygaba commented 9 years ago

Hi @biddster, could you please share your code, specifically the list adapter where u are setting up the views for me to troubleshoot the issue. Thanks.

biddster commented 9 years ago

I can't share that very easily due to the sensitive nature of the project, I'll knock up a test application that I can push to github for you.

vinaygaba commented 9 years ago

@biddster hey sure no problem. I'll set up something locally as well to test it out!

biddster commented 9 years ago

Here you go: https://github.com/biddster/CreditCardViewDemo

heyharvs commented 9 years ago

I can confirm, getting the same issue. Using a List Fragment with BaseAdapter and viewholder pattern. It correctly finds it, but none of the set() methods have any affect.

vinaygaba commented 9 years ago

Hi @biddster @heyharvs, i have identified the fix and will be completing it in the next 1 hour. Will be putting it on maven soon after. Sending an update in a bit. Thank you for pointing this out.

vinaygaba commented 9 years ago

@biddster @heyharvs This was released just now as part of v1.0.3. So if you were already using the library (@bidster you were already using v1.0.3), you will have to delete the library(gradle\caches\modules-2\files-2.1\com.vinaygaba\creditcardview\1.0.3) and do the build again to get the latest version.

biddster commented 9 years ago

Thanks @vinaygaba, I'll test it. Is there any reason why you didn't bump the version number to 1.0.4? It's much easier for us all to be certain we're testing your fixed code that way.

vinaygaba commented 9 years ago

@biddster The reason I released this as part of v1.0.3 was because v1.0.3 was not "officially" released until today. I wanted to add more features as part of this release and hence I had not updated the documentation until today. Hence, I don't think anyone apart from you was using that version till now as even the Readme file showed v1.0.2 only.

biddster commented 9 years ago

Understood. I'm having real trouble getting the latest version. I've blown away my entire gradle cache directory and I'm still seeing the old code. I'm wondering if it's stuck in a maven proxy cache somewhere?

vinaygaba commented 9 years ago

Not sure @biddster . If you check the files here -https://oss.sonatype.org/content/groups/staging/com/vinaygaba/creditcardview/1.0.3/ you will see that the files have been updated today. Do you see v1.0.3 in your cache directory once it was downloaded again?

biddster commented 9 years ago

Yeah - the aar has been cache on the intertubes somewhere I think.

I delete my gradle cache directory and the aar that gets downloaded is 1,271,325 bytes.

Your new version is 1,271,636.

I suspect that it's cached somewhere as it's not designed to update versions you've already uploaded.

vinaygaba commented 9 years ago

@biddster Really sorry about that. Did you try the clean --> build cycle? Or could you download the aar and jar files and replace it in the cache? Never tried it but worth a shot. Before you do this, plz take a back up though as it does match the signatures so its possible it might fail.

vinaygaba commented 9 years ago

@biddster Do let me know if you are able to fix the cache issue. Henceforth, I will be more careful about the releases. Sorry about this!

biddster commented 9 years ago

Oh don't worry - we'll get to the bottom of it. The bigger worry for me is that if it is really permanently cached, other consumers will suffer the same problem as me as it's already too late.

biddster commented 9 years ago

I suspect snapshot releases are the way to go in the future:

https://discuss.gradle.org/t/how-to-get-gradle-to-download-newer-snapshots-to-gradle-cache-when-using-an-ivy-repository/7344

Then we can use the changing flag on the compile dependency.

vinaygaba commented 9 years ago

@biddster I'm going to read more about this and do releases in a more efficient manner. Sorry about the trouble I might have caused you.

biddster commented 9 years ago

Ok, it's working nicely via jitpack.io.

Add jitpack to all projects.

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and then in your app gradle file

dependencies {
    compile(group: 'com.github.vinaygaba', name: 'CreditCardView', version: '1.0.3')
}
biddster commented 9 years ago

Confirming this bug as fixed.

vinaygaba commented 9 years ago

@biddster I had actually added a comment about jitpack but deleted it immediately as there are some new features that are still in dev that were commited to the repo. But looks like jitpack is smart enough to pick binaries from the releases. Which is great!

biddster commented 9 years ago

Yes, it's working really well.

Many thanks again for the fixes.

vinaygaba commented 9 years ago

@biddster Thank you for pointing this out :+1: