Awesome
NoRecyclerViewAdapter
Simple base adapter for RecyclerView
with custom Freemarker template, which allow create adapter with LAYOUT
item and ViewHolder
for one click.
The library will adhere to the rule: Only the most necessary methods and the most simple API.
Gradle
Beginning with Gradle 3 compile
is deprecated.
implementation 'ru.alexbykov:norecyclerviewadapter:0.0.2'
Install
public class SampleRecyclerViewAdapter extends NoRecyclerViewAdapter<String, SampleRecyclerViewAdapter.ViewHolder> {
private static final int LAYOUT = R.layout.item_sample;
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
return new ViewHolder(inflate(parent, LAYOUT));
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.tvSample.setText(items.get(position));
}
public static class ViewHolder extends RecyclerView.ViewHolder {
private TextView tvSample;
public ViewHolder(View itemView) {
super(itemView);
tvSample = itemView.findViewById(R.id.tvSample);
}
}
}
Actions
adapter.add(item);
adapter.add(item, position);
adapter.addItems(items);
adapter.remove(position);
adapter.remove(item);
adapter.clear();
adapter.getItem(position);
adapter.getItems();
Roadmap
- DiffUtils support
- Wiki
Contributing
If you find any bug, or you have suggestions, don't be shy to create issues or make a PRs in the develop
branch.
You can read contribution guidelines here
My other libraries:
- NoPermission — Simple Android permission library, consist of only one class
- NoPaginate — Simple Android pagination library
License
Copyright 2018 Alex Bykov
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 at
http://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.