Comments (4)
Thank you very much!
Currently the view-binding is only supported for View
/Fragment
/Activity
, however I'll create support for RecyclerView.ViewHolder
this weekend.
I'll also add some documentation explaining basic binding examples for View
, Fragment
, Activity
and RecyclerView.ViewHolder
binding.
The documentation does explain under 'Usage' that you can bind fragments in onViewCreated()
, but I already suspected that this was probably not very clear to people.
For now, I can give you a temporary work-around for your RecyclerView
issue:
You could create a new custom View class that basically wraps the functionality you need. It would look something like this:
@BindLayout(R.layout.news_item_row)
public CustomView extends FrameLayout
{
@BindView(R.id.yourview)
private View mView;
public CustomView(Context context)
{
super(context);
Spork.bind(this);
}
}
And then it's just business as usual:
CustomView view = new CustomView();
return new NewsRecyclerViewHolder(context, view);
I'll keep you posted on the release of the new feature and documentation over the weekend.
from spork.
I have published a new version (2.3.0) with the following features:
BindView
/BindClick
/BindResource
/BindComponent
support forRecyclerView.ViewHolder
- no need to call
SporkAndroid.initialize()
anymore - improved Javadoc for existing annotations
Also, I have given the website a major update. It includes a whole bunch of examples including one for RecyclerView
right here.
from spork.
Works perfectly! Thanks! Also, the web is really awesome.
Another problem I'm having is using Spork on PagerAdapter (to display views on a ViewPager). For now, I'm going to use your approach by creating a custom view.
from spork.
Good to hear! And you're welcome!
Could you open a new ticket for the PagerAdapter? I'll close this ticket now.
from spork.
Related Issues (18)
- Observe changes on the View tree HOT 1
- System service injection
- Feature: Resource injection HOT 1
- Activity Extra injection
- Fragment argument binding
- BindFragment by tag
- Spork on PagerAdapter HOT 1
- View Not Found Exception HOT 4
- Create a more representative test (project) HOT 1
- Fix typo in BindClick Exception HOT 1
- ViewResolver throws wrong error HOT 1
- Create separate "Spork Android Support" library HOT 1
- JSR-330 support HOT 2
- BindException HOT 4
- spork injection 4.0 HOT 1
- Improve internal Exception mechanisms
- Dependency Injection of Default Constructor
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spork.