Skip to content

Use Context instead of Activity for layout inflation #773

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

Closed
WillieCubed opened this issue Jun 22, 2017 · 5 comments
Closed

Use Context instead of Activity for layout inflation #773

WillieCubed opened this issue Jun 22, 2017 · 5 comments

Comments

@WillieCubed
Copy link
Contributor

I'm updating an addon library to this library, and it appears the FirebaseListAdapter is using an Activity parameter in the constructor where only a Context is needed. This would help out in situations where a home screen widget uses the adapter but doesn't have access to an Activity.
I say replacing it with a Context is a good idea because we only need it to inflate the layout, and the system already provides a more generalized way to access the layout inflater.

Instead of mActivity.getLayoutInflater().inflate(mLayout, viewGroup, false);
we should do this: LayoutInflater.from(mContext).inflate(mLayout, viewGroup, false); in the FirebaseListAdapter.

@WillieCubed WillieCubed changed the title Use Use Context instead of Activity for layout inflation Jun 22, 2017
@WillieCubed
Copy link
Contributor Author

Shall I go ahead and submit a PR?

@SUPERCILEX
Copy link
Collaborator

SUPERCILEX commented Jun 22, 2017

@TheCraftKid go for it, I don't think @samtstern will bite! 😀😂

@WillieCubed
Copy link
Contributor Author

I targeted the branch for 2.1.0. Is that a good target?

@samtstern
Copy link
Contributor

samtstern commented Jun 22, 2017 via email

@samtstern
Copy link
Contributor

The fix for this issue has been released in v2.1.0.

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

3 participants