Genericadapter

⛳️ Easy to use android databinding ready recyclerview adapter
Alternatives To Genericadapter
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Baserecyclerviewadapterhelper23,551
17 days ago9August 31, 2022555mitKotlin
BRVAH:Powerful and flexible RecyclerAdapter
Binding Collection Adapter1,7134332 years ago15March 08, 202031apache-2.0Java
Easy way to bind collections to listviews and recyclerviews with the new Android Data Binding framework
Lastadapter756
5 years ago12apache-2.0Kotlin
Don't write a RecyclerView adapter again. Not even a ViewHolder!
All Base Adapter528
6 years ago5apache-2.0Java
Adapter terminator, including DataBinding, any ViewGroup, list(Rv, Lv ). Write Adapter, it is enough .Adapter终结者,包含DataBinding,任意ViewGroup,Rv、Lv列表。写Adapter,有它就够了
Mvvm Juejin405
4 years ago8mitJava
高仿"掘金Android App": databinding + kotlin + rx 的优雅实践。(持续打磨中~)
Multiitem349
5 years ago8apache-2.0Java
一个优雅的实现多类型的RecyclerView类库 支持DataBinding Form表单录入 跨多个RecyclerView拖动
Items258
4 years agoapache-2.0Kotlin
Generate data-view-binding adapters of android recycler view.
Rxrecycleradapter194
4 years ago4Kotlin
Rx based RecyclerView Adapter.
Kotlin Adapter119
5 years ago1Kotlin
🔥 RecyclerView,AbsListView适配器, 支持多种视图样式, 支持吸顶、侧滑删除、拖拽效果
Multi Type Adapter99
4 years ago1Java
Super simple and easy to use common multi-type-adapter by android data-binding
Alternatives To Genericadapter
Select To Compare


Alternative Project Comparisons
Readme

Android Library

GenericAdapter Tweet

An Easy to use adapter for android

  1. No need to create seperate class for adapter
  2. No need of viewholder
  3. More readble code

Supports 2 types of adapters

GenericAdapter : Adapter for simple usage

GenericFilterAdapter : Adapter with list filtering capability

Medium

Please find detail medium post here, Android Generic Adapter

Download

This library is available in jitPack which is the default Maven repository used in Android Studio.

Gradle

Step 1. Add it in your root build.gradle at the end of repositories

allprojects 
{
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency in your apps module build.gradle

dependencies {
	 implementation 'com.github.manojbhadane:GenericAdapter:v1.4'
}

Usage

  1. In App level build.gradle
dataBinding {
        enabled true
}
  1. In Activity/Fragment (Java)
 mDataBinding.recylerview.setAdapter(new GenericAdapter<PeopleModel, ListitemMainBinding>(this, arrayList) {
            @Override
            public int getLayoutResId() {
                return R.layout.listitem_main;
            }

            @Override
            public void onBindData(PeopleModel model, int position, ListitemMainBinding dataBinding) {
                dataBinding.txtName.setText(model.getName());
                dataBinding.txtAddress.setText(model.getAddress());
            }

            @Override
            public void onItemClick(PeopleModel model, int position) {

            }
        });
  1. In Activity/Fragment (Kotlin)
 var adapter = object : GenericAdapter<PeopleModel, ListitemMainBinding>(this, arrayList) {
            override fun getLayoutResId(): Int {
                return R.layout.listitem_main
            }

            override fun onBindData(model: PeopleModel?, position: Int, dataBinding: ListitemMainBinding?) {
                dataBinding!!.txtName.text = model.getName()
		dataBinding!!.txtAddress.text = model.getAddress()
            }

            override fun onItemClick(model: PeopleModel?, position: Int) {

            }
        }
	
dataBinding.recyclerview.layoutManager = LinearLayoutManager(this, RecyclerView.VERTICAL, false)
dataBinding.recyclerview.adapter = adapter

v1.2

Added list filtering capability to genericAdapter by extending GenericFilterAdapter class

Sample code of adapter with filter

mDataBinding.recylerview.setAdapter(new GenericFilterAdapter<PeopleModel, ListitemMainBinding>(this, arrayList) {
            @Override
            public int getLayoutResId() {
                return R.layout.listitem_main;
            }

            @Override
            public void onBindData(PeopleModel model, int position, ListitemMainBinding dataBinding) {
                dataBinding.txtName.setText(model.getName());
                dataBinding.txtAddress.setText(model.getAddress());
            }

            @Override
            public void onItemClick(PeopleModel model, int position) {

            }

            @Override
            public View getSearchField() {
                return mDataBinding.edtSearch;
            }

            @Override
            public ArrayList<PeopleModel> performFilter(String searchText, ArrayList<PeopleModel> originalList) {
                ArrayList<PeopleModel> filteredList = new ArrayList<>();
                for (PeopleModel row : originalList) {
                    if (row.getName().toLowerCase().contains(searchText.toLowerCase()) 
		    		|| row.getName().contains(searchText) 
				|| row.getAddress().toLowerCase().contains(searchText.toLowerCase())) {
                        filteredList.add(row);
                    }
                }

                return filteredList;
            }
        });

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull request are also welcome.

Spread Some ❤️

GitHub followers Twitter Follow

About The Author

Manoj Bhadane

Android & Backend Developer.

If this library helps you in anyway, show your love ❤️ by putting a ⭐️ on this project ✌️

License

MIT License

Copyright (c) 2020 Manoj Bhadane

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Popular Adapter Projects
Popular Databinding Projects
Popular Libraries Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Java
Adapter
Fragment
Filtering
Medium
Listview
Databinding