Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native ads support #5

Open
stanbar opened this issue May 5, 2017 · 1 comment
Open

Native ads support #5

stanbar opened this issue May 5, 2017 · 1 comment

Comments

@stanbar
Copy link

stanbar commented May 5, 2017

Hello.
Is there any way to support different viewTypes that doesn't extends Model like AdExpressViewHolder ?
The problem is that in your implementation onCreateViewHolder must return something that extend Model class
ViewHolder<? extends ExampleModel> onCreateViewHolder
Is it possible in my situation ?

@Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        final View v = inflater.inflate(viewType, parent, false);
        if (viewType == VIEW_TYPE_COLLAPSED) {
            return new CollapsedVH(v, this);
        } else if (viewType == VIEW_TYPE_EXPANDED) {
            return new ExpandedVH(v, this);
        } else if (viewType == VIEW_TYPE_AD_EXPRESS) {
            return new AdExpressViewHolder(v);
        } else return null;
    }
@xaverkapeller
Copy link
Owner

Hi! At the moment this is not possible. The Adapter has to enforce that type constraint to allow for the simplified binding functionality. However there are ways to still have the simplified binding feature and allow for any type of ViewHolder to be used. I am going to look into this at some point in the near future. In the meantime this issue is going to stay open until I either implemented this change or decided not to implement it at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants