All Projects → mkrupal09 → Easyadapter

mkrupal09 / Easyadapter

Recyclerview adapter library- Create adapter in just 3 lines of code

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Easyadapter

Zoomrecylerlayout
🎢 Zoom Recycler Layout Manager For Android Kotlin
Stars: ✭ 618 (+406.56%)
Mutual labels:  android-development, recyclerview, android-ui, recyclerview-adapter
RecyclerELE
Android Library for easy addition of Empty, Loading and Error views in a RecyclerView
Stars: ✭ 27 (-77.87%)
Mutual labels:  recyclerview, android-development, android-ui, recyclerview-adapter
Tableview
TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
Stars: ✭ 2,928 (+2300%)
Mutual labels:  android-development, recyclerview, android-ui, recyclerview-adapter
Fastadapter
The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Stars: ✭ 3,512 (+2778.69%)
Mutual labels:  android-development, recyclerview, android-ui, recyclerview-adapter
Notzz App
📝 A Simple Note-Taking App built to demonstrate the use of Modern Android development tools - (Kotlin, Coroutines, State Flow, Hilt-Dependency Injection, Jetpack DataStore, Architecture Components, MVVM, Room, Material Design Components).
Stars: ✭ 158 (+29.51%)
Mutual labels:  android-development, recyclerview, android-ui
android-tableview-kotlin
Android's missing TableView component.
Stars: ✭ 40 (-67.21%)
Mutual labels:  recyclerview, android-development, android-ui
recycler-adapter
RecyclerView-driven declarative UIs
Stars: ✭ 124 (+1.64%)
Mutual labels:  recyclerview, android-development, android-ui
Recyclerview
How to use a recyclerview
Stars: ✭ 121 (-0.82%)
Mutual labels:  android-development, recyclerview, recyclerview-adapter
Discretescrollview
A scrollable list of items that centers the current element and provides easy-to-use APIs for cool item animations.
Stars: ✭ 5,533 (+4435.25%)
Mutual labels:  android-development, recyclerview, android-ui
Codeview Android
Display code with syntax highlighting ✨ in native way.
Stars: ✭ 748 (+513.11%)
Mutual labels:  recyclerview, android-ui, recyclerview-adapter
Elements
⚒ Modular components for RecyclerView development enforcing clean, reusable and testable code, with built-in support for paging and complex hierarchies of data.
Stars: ✭ 75 (-38.52%)
Mutual labels:  recyclerview, recyclerview-adapter
Edxposedmanager
Companion Android application for EdXposed
Stars: ✭ 1,172 (+860.66%)
Mutual labels:  android-development, android-ui
Groupedrecyclerviewadapter
GroupedRecyclerViewAdapter可以很方便的实现RecyclerView的分组显示,并且每个组都可以包含组头、组尾和子项;可以方便实现多种Type类型的列表,可以实现如QQ联系人的列表一样的列表展开收起功能,还可以实现头部悬浮吸顶功能等。
Stars: ✭ 1,163 (+853.28%)
Mutual labels:  recyclerview, recyclerview-adapter
Autorecycleradapter
Automated configuration RecyclerView.Adapter for Android
Stars: ✭ 67 (-45.08%)
Mutual labels:  recyclerview, recyclerview-adapter
Expandable Recycler View
[DEPRECATED]
Stars: ✭ 1,234 (+911.48%)
Mutual labels:  recyclerview, recyclerview-adapter
Flexadapter
The easiest way to use a RecyclerView on Android
Stars: ✭ 80 (-34.43%)
Mutual labels:  recyclerview, recyclerview-adapter
Recyclerview Examples
Samples to learn about RecyclerView
Stars: ✭ 87 (-28.69%)
Mutual labels:  recyclerview, recyclerview-adapter
Cartlayout
🦄 使用 RecyclerView 实现店铺分组购物车。 高仿京东购物车、高仿淘宝购物车、高仿天猫购物车
Stars: ✭ 101 (-17.21%)
Mutual labels:  recyclerview, recyclerview-adapter
Mediapicker
Easy customizable picker for all your needs in Android application
Stars: ✭ 105 (-13.93%)
Mutual labels:  android-development, android-ui
Fitbutton
The button which can use with icon, text, divider, custom ripple effect, border, corner radius e.t.c.
Stars: ✭ 63 (-48.36%)
Mutual labels:  android-development, android-ui

EasyAdapter Based on Android Data Binding

Create your recyclerview adapter in just 3 lines.

RecyclerView is mostly used android widgets in the Android Project, for that you have to implement an Adapter which provides the items for the view. In most cases it require the same base logic, but require you to write everything again and again.so here is sollution for it.

N|Solid Download Circle CI

  • Reduce Boilerplate code to create adapter and holder.
  • you can filter adapter without coding much.
  • You wil have load more feature with progress bar at bottom.
  • includes swipe to action.
  • includes View Events callbacks (ClickEvent,CheckChangeEvent)
  • and many more..

RecyclerView Adapter LibraryRecyclerView Adapter LibraryRecyclerView Adapter LibraryRecyclerView Adapter Library

Download

Grab via Maven:

<dependency>
  <groupId>com.dc.easyadapter</groupId>
  <artifactId>easyadapter</artifactId>
  <version>2.0.3</version>
  <type>pom</type>
</dependency>

or Gradle:

implementation 'com.dc.easyadapter:easyadapter:2.0.3'

To enable data binding

inside app build.gradle

android {
    dataBinding {
        enabled = true
    }
}

For Kotlin also add

dependencies{
       kapt 'com.android.databinding:compiler:3.1.2'
}

apply plugin: 'kotlin-kapt' //Top at build.gradle

How?

adapter = new EasyAdapter<Category, InflaterCategoryBinding>(R.layout.inflater_category) {
            @Override
            public void onBind(@NonNull InflaterCategoryBinding binding, @NonNull Category model) {
                binding.tvName.setText(model.name);
            }
        }
        

Usage

class CategoryAdapter() :EasyAdapter<Category, InflaterCategoryBinding>(R.layout.inflater_category) {
    override fun onBind(binding: InflaterCategoryBinding, model: Category) {
        binding.apply {
            tvName.text = model.name
            cbCategory.isChecked = model.isSelected
        }
    }
}

###java

     public CategoryAdapter() {
        super(R.layout.inflater_category);
    }

    @Override
    public void onBind(@NonNull InflaterCategoryBinding binding, @NonNull Category model) {
        binding.tvName.setText(model.name);
    }

1) To Handle recycler View item Events

//Override in Adapter
override fun onCreatingHolder(binding: InflaterCategoryBinding, easyHolder: EasyHolder) {
        super.onCreatingHolder(binding, easyHolder)
        binding.root.setOnClickListener(easyHolder.clickListener)
    }
adapter.setRecyclerViewItemClick { itemView, model -> 
//Perform Operation here 
}

2) Filter (Search,etc..)

adapter.performFilter(newText,filter)

val filter= object : EasyAdapter.OnFilter<Category> {
                    override fun onFilterApply(filter: Any, model: Category): Boolean {
                        return model.name.toLowerCase().contains(filter.toString().toLowerCase())
                    }

                    override fun onFilterResult(filteredList: ArrayList<Category>?) {
                        adapter.clear(false)
                        adapter.addAll(filteredList, false)
                        adapter.notifyDataSetChanged()
                    }
                }

3) Load More

adapter.setLoadMoreRes(R.layout.layout_progress)
adapter.setOnLoadMoreListener(binding.recyclerView, EasyAdapter.OnLoadMoreListener {
            if (paging != -1) {
                requestLoadMore() //Your Method
                return@OnLoadMoreListener true // Returns True if you have more data
            }
            return@OnLoadMoreListener false // Return false if you don't have more data
        })

4) Swipe Action

adapter.enableSwipeAction(binding.recyclerView)
override fun onCreatingHolder(binding: InflaterCategoryBinding, easyHolder: EasyHolder) {
        binding.llDelete.post {
            easyHolder.setEnableSwipeToDelete(binding.llCategory, 0, binding.llDelete.measuredWidth)
        }
    }
    
 <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        //Swipe Reveal Layout
        <LinearLayout
            android:id="@+id/llDelete"
            android:padding="10dp"
            android:layout_gravity="end"
            android:background="@android:color/holo_red_dark"
            android:layout_width="wrap_content"
            android:layout_height="match_parent">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@android:drawable/ic_input_delete" />
        </LinearLayout>

        //Your container
        <LinearLayout
            android:background="@android:color/white"
            android:id="@+id/llCategory"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:padding="5dp"/>
            
</FrameLayout>

5) Data Observe

adapter.setOnDataUpdateListener {
            if (it.size <= 0) {
                Toast.makeText(this@MainActivity, "No Data Found", Toast.LENGTH_SHORT).show()
            }
        }

Support with spinner

We've Created EasySpinner where you can use your EasyAdapter
No need to write ArrayAdapter or CustomArrayAdapter and you'll have lots of features from EasyAdapter.

  <easyadapter.dc.com.library.EasySpinner
            android:background="@drawable/rect_background"
            android:id="@+id/easyspinner"
            android:layout_width="220dp"
            android:layout_height="wrap_content"
            android:textColor="@android:color/black"
            android:drawableRight="@android:drawable/arrow_down_float"
            android:textColorHint="@android:color/black"
            android:padding="10dp"
            android:hint="Select Name" />
            

Setting adapter to EasySpinner

binding.easyspinner.setAdapter(adapter)

you can use spinner as autocomplete textview by using

 binding.easyspinner.enableAutoCompleteMode { easySpinner, text ->
            adapter.performFilter(text, filter)
}
        

That's it... you will have spinner adapter.

Pro Tips

Use tools attribute for previewing Layout, so you don't need to always run application

recyclerview

tools:listitem="@layout/inflater_category"
tools:itemCount="5"
tools:orientation="horizontal"
app:layoutManager="android.support.v7.widget.GridLayoutManager"

layout

tools:text="Sample Text"
tools:visibility="VISIBLE"
tools:background="@color/colorPrimary"

android predefine sample data

 tools:text="@tools:sample/cities,first_names,us_phones,lorem,lorem/random"
 tools:background="@tools:sample/backgrounds/scenic"
 tools:src="@tools/avatars"

custom sample data

To create your fake/sample data folder,
just right click on the “app” folder then “new > Sample Data directory” <br />
create new file with "filename" and write each text by new lines

file contains -

Georgia <br />
Illinois <br />
Paris <br />
London <br />

so it will randomly pick names and display in layout by
tools:text="@sample/filename" 

Changelog

[Special Thanks to]

https://github.com/alex-townsend/SwipeOpenItemTouchHelper
without this person cannot achieve swipe action in recyclerview

https://android.jlelse.eu/android-tools-attributes-listitem-sample-data-rocks-bbf49aaa9f07
for sharing knowledge of Android Tools attributes

  • Buy me a Beer. 🍺

License

Copyright 2013 DC, Inc.

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].