Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ineat/quick-adapter
One library to quickly fill your RecyclerView
https://github.com/ineat/quick-adapter
Last synced: 6 days ago
JSON representation
One library to quickly fill your RecyclerView
- Host: GitHub
- URL: https://github.com/ineat/quick-adapter
- Owner: ineat
- License: apache-2.0
- Created: 2016-10-04T08:34:50.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-04T15:21:32.000Z (about 8 years ago)
- Last Synced: 2024-11-07T11:44:26.815Z (about 2 months ago)
- Language: Java
- Homepage: https://ineat.github.io/quick-adapter/
- Size: 243 KB
- Stars: 2
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Quick Adapter
============[![Logo](website/logo_ineat_small.png)][1]
One library to quickly fill your RecyclerView and remove boilerplate code adapter.
# Simple Adapter : Simple cell
```java
@QuickLayout(R.layout.item_example)
public class ExampleQuickItemRenderer extends QuickItemRenderer {private TextView mTextView;
public ExampleQuickItemRenderer(View itemView) {
super(itemView);
mTextView = (TextView) itemView.findViewById(R.id.txt_label);
}@Override
public void onBind(int position, MyModel myModel) {
mTextView.setText(myModel.getLabel());
}}
SimpleQuickAdapter adapter =
new SimpleQuickAdapter<>(values, ExampleQuickItemRenderer.class);
mRecyclerView.setAdapter(adapter);```
# Multi Cell
```java
@QuickLayout(R.layout.item_cell_one)
public class CellOneQuickItemRenderer extends QuickItemRenderer {private TextView mTextView;
public ExampleQuickItemRenderer(View itemView) {
super(itemView);
mTextView = (TextView) itemView.findViewById(R.id.txt_label);
}@Override
public void onBind(int position, MyModel myModel) {
mTextView.setText(myModel.getLabel());
}}
@QuickLayout(R.layout.item_cell_two)
public class CellTwoQuickItemRenderer extends QuickItemRenderer {private TextView mTextView;
public ExampleQuickItemRenderer(View itemView) {
super(itemView);
mTextView = (TextView) itemView.findViewById(R.id.txt_label);
}@Override
public void onBind(int position, MyModel myModel) {
mTextView.setText(myModel.getLabel());
}}
QuickAdapter adapter = new QuickAdapter<>(ineatienList);
adapter.registerItemRenderer(CellOneQuickItemRenderer.class);
adapter.registerItemRenderer(CellTwoQuickItemRenderer.class);
adapter.setQuickAdapterTypeFactory((position, ineatien) -> {
if ((i % 2) == 0) {
return CellOneQuickItemRenderer.class;
}return CellTwoQuickItemRenderer.class;
});
mRecyclerView.setAdapter(adapter);```
For documentation and additional information see [the website][2].
Download
--------Configure your `build.gradle`:
```groovy
dependencies {
compile 'com.ineat-group:quick-adapter:1.0.2'
}
```License
-------Copyright 2016 Ineat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.[1]: http://www.ineat-group.com/
[2]: https://ineat.github.io/quick-adapter/