JoanZapata / base-adapter-helper

Abstraction for the usual BaseAdapter "ViewHolder" pattern
http://joanzapata.com/base-adapter-helper/
Other
1.76k stars 530 forks source link

Add a callback on view inflating #51

Open DayS opened 9 years ago

DayS commented 9 years ago

I have to apply custom font on my items. Currently we have no easy way to do this only once after inflating the view. It would be great to have a view inflated callback on the BaseAdapterHelper. I'll provide a PR soon for this

JoanZapata commented 9 years ago

In your usecase, I don't think using the existing BaseAdapterHelper.setTypeface() would be a problem, since the TextView just ignore the call if the typeface hasn't changed:

public void setTypeface(Typeface tf) {
    if (mTextPaint.getTypeface() != tf) {
        ...
    }
}
DayS commented 9 years ago

Setting typeface was just for the example. I have a highly brandable application and some logic in order to apply color, text size, custom drawables, etc... So, I would like to handle all this only once via a callback :) I already have a work-around but I had to fork a sub-part of BaseQuickAdapter. I'll be much nicer if a proper solution was integrated

JoanZapata commented 9 years ago

Oh I see. Waiting for your pull request then. :)

DayS commented 9 years ago

Any chance to move on Gradle before that ? =)

JoanZapata commented 9 years ago

Does it make any difference concerning this issue?

DayS commented 9 years ago

Nah, it's just a pain in the ass to import the project on AS

JoanZapata commented 9 years ago

Ah? Never had any trouble using IntelliJ. I'll try to get it done tonight then.

JoanZapata commented 9 years ago

Sorry for the delay, I tried to migrate to gradle but it's too much complication sorry:

I'm really curious about what's wrong with the maven build when you import the project. Could you elaborate please?