No need to implement an Adapter for every RecyclerView. Snap Adapters initializes in a single line and comes with endless loader and multiple layout.

Overview

Snap RecyclerView Utils

Android Arsenal Travis CI

Simple Library to create RecyclerView Adapters and Viewholder in a snap.

Features

  • Simple RecyclerView Adapter
  • Multiple Layouts RecyclerView Adapter
  • Endless Loader
  • Alternate View Support
  • Automatic Empty RecyclerView Layout Handling
  • Adapter based OnItemClickListener

Add to your project

Release

###Check out v2 Beta!

Add JitPack to repositories in your project's root build.gradle file:

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

Add the dependency to your module's build.gradle file:

dependencies {
	...
    compile 'com.github.prashantsolanki3:Snap-RecyclerView-Utils:v1.8'
}

Usage

###Check out the wiki!

Make a ViewHolder which extends SnapViewHolder.

SnapAdapter<SimpleProduct, ViewHolderProduct> adapterRecycler = new SnapAdapter<>(
	getContext(), //Context
	SimpleProduct.class, //Model class, matching generic type
        R.layout.item_recycler_product, // Item Layout
        ViewHolderProduct.class); // ViewHolder class, matching generic type
                
recyclerView.setAdapter(adapterRecycler);

//Add items to RecyclerView
adapterRecycler.addAll(new ArrayList<SimpleProduct>());

Yeah That's All!


##Contribute

Contribute by creating issues (tagged enhancement, bugs) in the repo or create a pull request.

##Using Snap RecyclerView Utils?

If you are using Snap RecyclerView Utils in your app and would like to be listed here, please let us know opening a new issue!

###License

Copyright 2015 Prashant Solanki

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.

Comments
  • Constrain the data type to ArrayList

    Constrain the data type to ArrayList

    public void set(@Nullable ArrayList<T> data) {
        this.clear();
        if(data != null) {
            this.mData.addAll(data);
        }
    
        this.handleEmptyLayoutVisibility();
    }
    

    Why constrains to ArrayList not List? I try the example and find the data type List can't be cast to ArrayList, which is so bad, cause I'll need to alter the data type to ArrayList manually to make it work, or just give up...

    opened by baoxiehao 2
  • Overlapping scroll animation

    Overlapping scroll animation

    Hey,

    I tried showing animation to list items on scrolling but they are overlapping.

    In ViewHolder

    @Override
    public void animateViewHolder(SnapViewHolder snapViewHolder, int position) {
         snapViewHolder.itemView.startAnimation(AnimationUtils.loadAnimation(getContext(), R.anim.up_from_bottom));
    }
    

    In up_from_bottom.xml

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android"
        android:shareInterpolator="@android:anim/decelerate_interpolator">
        <translate
            android:fromXDelta="0%" android:toXDelta="0%"
            android:fromYDelta="100%" android:toYDelta="0%"
            android:duration="400" />
    </set>
    
    opened by AkshayChordiya 2
  • More cleanup and updates

    More cleanup and updates

    1. Removed unused parameter from the SnapAdapter constructor.
    2. Renamed app module to sample.
    3. Correct notify... methods are used in SnapAdapter where needed.
    4. Rather than continuously allocating list, it's cleared and updated where needed.
    5. Renamed SnapAdapter methods to be more standard, e.g. addAndOverwriteAllItems() is now set().
    6. Added annotations to constructor and methods to enforce correct variable types (e.g. layout for int, or non-null/nullable parameters).
    7. SnapAdapter's generic typing now requires that the passed type extends SnapViewHolder, no need to check if the ViewHolder is an instance of SnapViewHolder.
    8. SnapRecyclerView was empty and unused, so I removed it. Hopefully you didn't need it.
    9. Other fixes and cleanup.
    opened by afollestad 2
  • README updates

    README updates

    1. Added JitPack.io badge.
    2. Added syntax highlighting to code blocks and inline class/method names.
    3. Added final statements to ViewHolder fields.
    4. Other improvements.
    opened by afollestad 0
  • squid:S2039 - Member variable visibility should be specified

    squid:S2039 - Member variable visibility should be specified

    This pull request is focused on resolving occurrences of Sonar rule squid:S2039 - Member variable visibility should be specified

    You can find more information about the issue here: https://dev.eclipse.org/sonar/coding_rules#q=squid:S2039

    Please let me know if you have any questions.

    M-Ezzat

    opened by m-ezzat 1
Releases(2.0.0-beta-6)
Simple lib to create a endless recycler view scroll

Endless RecyclerView A simple lib to create an infinite list in a RecyclerView. When you reach the end of the list, a callback is triggered, where you

Jaison Klemer 4 Sep 2, 2022
ANDROID. ChipsLayoutManager (SpanLayoutManager, FlowLayoutManager). A custom layout manager for RecyclerView which mimicric TextView span behaviour, flow layouts behaviour with support of amazing recyclerView features

ChipsLayoutManager This is ChipsLayoutManager - custom Recycler View's LayoutManager which moves item to the next line when no space left on the curre

Oleg Beloy 3.2k Dec 25, 2022
A Common RecyclerView.Adapter implementation which supports all kind of items and has useful data operating APIs such as remove,add,etc.

##PowerfulRecyclerViewAdapter A Common RecyclerView.Adapter implementation which supports any kind of items and has useful data operating APIs such as

null 313 Nov 12, 2022
Elegant design and convenient to use RecyclerView adapter library based on Kotlin DSL.

xAdapter: Kotlin DSL 风格的 Adapter 封装 1、简介 该项目是 KotlinDSL 风格的 Adapter 框架封装,用来简化 Adapter 调用,思想是采用工厂和构建者方式获取 Adapter 避免代码中定义大量的 Adapter 类。该项目在 BRVAH 的 Ada

ShouHeng 17 Oct 9, 2022
Add RecyclerView, use Adapter class and ViewHolder to display data.

فكرة المشروع في هذا المشروع سنقوم بعرض قائمة من البيانات للطلاب على واجهة تطبيق Android بإستخدام: مفهوم RecyclerView مفهوم Adapter مفهوم ViewModel محت

Shaima Alghamdi 3 Nov 18, 2021
Don't write a RecyclerView adapter again. Not even a ViewHolder!

LastAdapter Don't write a RecyclerView adapter again. Not even a ViewHolder! Based on Android Data Binding Written in Kotlin No need to write the adap

Miguel Ángel Moreno 781 Dec 19, 2022
kotlin dsl for kids to simplify RecyclerView.Adapter logic

KidAdapter RecyclerView adapter for kids. A kotlin dsl mechanism to simplify and reduce boilerplate logic of a RecyclerView.Adapter. With KidAdapter y

Eugeniu Tufar 56 Nov 27, 2022
A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps

Infinite Recycler View A RecyclerView Adapter which allows you to have an Infinite scrolling list in your apps. This library offers you a custom adapt

IB Sikiru 26 Dec 10, 2019
Reproducible sample with Fix for Memory Leak in RecyclerView Adapter

Memory Leak RecyclerView Adapter Reproducible Sample with Fix Video Instructions: https://www.youtube.com/c/awesomedevnotes Code Only the relevant and

Awesome Dev Notes | Android Dev Notes YouTube 7 Jun 7, 2022
RecyclerView With No Adapter | Available For Jetpack Compose

About This Project Available on Google Dev Library Click Here RecyclerView No Adapter (Adapter Has Been Handled) RecyclerView No Adapter Using ViewBin

Faisal Amir 142 Oct 18, 2022
Easy RecyclerView Adapter

GenericAdapter Easy RecyclerView Adapter Getting started build.gradle allprojects { repositories { // ... maven { url 'https://jit

JaredDoge 4 Dec 3, 2021
Just another one easy-to-use adapter for RecyclerView :rocket:

Elementary RecyclerView Adapter Another one easy-to-use adapter for RecyclerView ?? Features: DSL-like methods for building adapters similar to Jetpac

Roman Andrushchenko 29 Jan 6, 2023
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

RecyclerViewSwipeDismiss A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. Preview How to use Add these lines to yo

xcodebuild 431 Nov 23, 2022
A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView.

RecyclerViewSwipeDismiss A very easy-to-use and non-intrusive implement of Swipe to dismiss for RecyclerView. Preview How to use Add these lines to yo

xcodebuild 431 Nov 23, 2022
Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagination in app.

Pagination View Handy library to integrate pagination, which allow no data layout, refresh layout, recycler view in one view and easy way to bind pagi

DhiWise 4 Dec 18, 2021
Android library for RecyclerView to manage order of items and multiple view types.

recyclerview-binder Android Library for RecyclerView to manage order of items and multiple view types. Features Insert any items to wherever you want

Satoru Fujiwara 185 Nov 15, 2022
A layout manager for the RecyclerView with interchangeable linear, grid, and staggered displays of views, all with configurable section headers including the sticky variety as specified in the material design docs.

SuperSLiM This is the version 5 development branch. Project Plan Support me on Patreon Blog What is Version 5 Version 5 is the current development bra

Tonic Artos 2.1k Jan 2, 2023
A RecyclerView that implements pullrefresh and loadingmore featrues.you can use it like a standard RecyclerView

XRecyclerView a RecyclerView that implements pullrefresh , loadingmore and header featrues.you can use it like a standard RecyclerView. you don't need

XRecyclerView 5.3k Dec 26, 2022