sockeqwe / AnnotatedAdapter

Write less code with AnnotatedAdapter, an annotation processor for generating RecyclerView and AbsListView adapters
http://hannesdorfmann.com/android/AnnotatedAdapter/
Apache License 2.0
195 stars 31 forks source link

Enhancement: use Data Binding #14

Open IgorGanapolsky opened 9 years ago

IgorGanapolsky commented 9 years ago

Hi, I was wondering if there are any plans to use Android's new Data Binding framework inside of AnnotatedAdapter. Or perhaps there is an easy way for devs to integrate it themselves now?

sockeqwe commented 9 years ago

I haven't had time yet to have a deep look at data binding for adapters, but my understanding is that is makes creating ViewHolders useless (there is something called BindingHolder that seems to be a replacement for creating ViewHolders on your own). Therefore, I'm not sure if data binding is a complete replace AnnotatedAdapter. I will have a look at the data binding framework once it's out of beta later this summer. If it makes sense then I think I will integrate data binding in AnnotatedAdapter (i.e. as far as I see distinguishing between different ViewTypes must still be done by hand, maybe AnnotatedAdapter could reduce writing that code).

IgorGanapolsky commented 9 years ago

You are correct that it does all the work of ViewHolders for us. You just call the ViewHolder's constructor like ViewHolder(ViewDataBinding binding), and it does the rest. But I do think that we need support for different ViewTypes - as AnnotatedAdapter does.

sockeqwe commented 9 years ago

Ah thanks, good to know. I will wait until a final 1.0.0 release of data binding and then I will see what is possible and whether it makes sense or not.

IgorGanapolsky commented 9 years ago

@sockeqwe Thanks for making your framework better. Have some @changetip $1 bitcoin.

BashCo commented 9 years ago

@IgorGanapolsky Don't mind me, just testing the tip bot. $1 @changetip

changetip commented 9 years ago

Hi @igorganapolsky, I've delivered a Bitcoin tip worth 4,025 bits ($1.00) from @BashCo to your ChangeTip wallet.

Learn about ChangeTip

changetip commented 9 years ago

Hi @sockeqwe, @IgorGanapolsky sent you a Bitcoin tip worth 4,025 bits ($1.00), and I'm here to deliver it ➔ collect your tip.

Learn more about ChangeTip

IgorGanapolsky commented 9 years ago

Hey, I was wondering if you've considered the Data Binding option for Mosby 2.0?

sockeqwe commented 9 years ago

Hi, this library AnnotatedAdapter is not Mosby related nor part of mosby. However, right now I have no plans to add DataBinding to AnnotatedAdapter since I have other projects with higher priority. I have started another library for Adapters called AdapterDelegates which you may find useful. I think I will spend more time on the new library (AdapterDelegates) than on this one. There were some requests in combining AnnotatedAdapter withwith the new one (AdapterDelegates) but this will not happen: see https://github.com/sockeqwe/AdapterDelegates/issues/2 .

Regarding, data binding and Mosby: Yes I do have plans to add MVVM (Model-View-ViewModel) with data binding as addition to Mosby (addition to MVP, not replacement) but I can't say any concrete date when this will be implemented. It will definitely not be part of Mosby 2.0 (probably in Mosby 3.0). There is a issue on mosby's github repo for that https://github.com/sockeqwe/mosby/issues/71. Also I'm not 100% convinced that MVVM is the best choice as Android application architecture. Nevertheless, I see the benefit of data binding frameworks and I hope to come up with a solution.

IgorGanapolsky commented 9 years ago

Awesome, thanks. So are AdapterDelegates gonna repace AnnotatedAdapter in your Mosby samples eventually? On Sep 1, 2015 6:02 PM, "Hannes Dorfmann" notifications@github.com wrote:

Hi, this library AnnotatedAdapter is not Mosby related nor part of mosby. However, right now I have no plans to add DataBinding to AnnotatedAdapter since I have other projects with higher priority. I have started another library for Adapters called AdapterDelegates which you may find useful. I think I will spend more time on the new library (AdapterDelegates) than on this one. There were some requests in combining AnnotatedAdapter withwith the new one (AdapterDelegates) but this will not happen: see sockeqwe/AdapterDelegates#2 https://github.com/sockeqwe/AdapterDelegates/issues/2 .

Regarding, data binding and Mosby: Yes I do have plans to add MVVM (Model-View-ViewModel) with data binding as addition to Mosby (addition to MVP, not replacement) but I can't say any concrete date when this will be implemented. It will definitely not be part of Mosby 2.0 (probably in Mosby 3.0). There is a issue on mosby's github repo for that sockeqwe/mosby#71 https://github.com/sockeqwe/mosby/issues/71. Also I'm not 100% convinced that MVVM is the best choice as Android application architecture. Nevertheless, I see the benefit of data binding frameworks and I hope to come up with a solution.

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/AnnotatedAdapter/issues/14#issuecomment-136877156 .

sockeqwe commented 9 years ago

I don't think so. Eventually the sample adapters get replaced with default handwritten adapter implementations because the users who just want to have a look at mosby samples shouldn't have to understand other third party libraries like AnnotatedAdapter as well...

IgorGanapolsky commented 9 years ago

Ahh, darn. Just when I started to understand AnnotatedAdapters and implementing them in my own apps, I will have to go and rip them out :(

On Tue, Sep 1, 2015 at 11:16 PM, Hannes Dorfmann notifications@github.com wrote:

I don't think so. Eventually the sample adapters get replaced with default handwritten adapter implementations because the users who just want to have a look at mosby samples shouldn't have to understand other third party libraries like AnnotatedAdapter as well...

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/AnnotatedAdapter/issues/14#issuecomment-136922752 .

sockeqwe commented 9 years ago

You don't have to, there is nothing wrong with using AnnotatedAdapter...

IgorGanapolsky commented 9 years ago

Ok, slight comment: in Mosby you are using AnnotatedAdapter v1.0.0, but the latest AnnotatedAdapter available is 1.0.1. They differ specifically on how com.hannesdorfmann.annotatedadapter.annotation.Field defines an id. Is it prudent for me to update my app to the latest AnnotatedAdapter and make the changes, or is it ok to stick with an outdated version?

sockeqwe commented 9 years ago

The samples has been updated to latest AnnotatedAdapter version 1.1.1 on Mosby 2.0 branch ( https://github.com/sockeqwe/mosby/tree/2.0 ) .

There was some changes from 1.0.0 to 1.1.0 regarding @Field which has become @ViewFiled. Starting in 1.1.0 @Field can be used to define Fields in ViewHolder, like a Field for a OnClickListener.

1.1.1 added some @SuppressLint annotations since Android build tools 23.0.0 are more aggressive now and need this @SuppressLint. So if you want to use build tools 23.0.0 then you have to use AnnotatedAdapter 1.1.1, sorry

IgorGanapolsky commented 9 years ago

Looks good thanks! On Sep 2, 2015 12:52 PM, "Hannes Dorfmann" notifications@github.com wrote:

The samples has been updated to latest AnnotatedAdapter version 1.1.1 on Mosby 2.0 branch ( https://github.com/sockeqwe/mosby/tree/2.0 ) .

There was some changes from 1.0.0 to 1.1.0 regarding @Field which has become @ViewFiled. Starting in 1.1.0 @Field can be used to define Fields in ViewHolder, like a Field for a OnClickListener.

1.1.1 added some @SuppressLint annotations since Android build tools 23.0.0 are more aggressive now and need this @SuppressLint. So if you want to use build tools 23.0.0 then you have to use AnnotatedAdapter 1.1.1, sorry

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/AnnotatedAdapter/issues/14#issuecomment-137168351 .