Expandable Recyclerview makes it easy to integrate nested recycler view...🔨 📝

Overview

SSExpandableRecyclerView

Expandable Recyclerview make it easy to integrate nested recyclerview

Build Status Kotlin Version Platform API

Features

  • Simple and easy to use ( no complex adapter required )
  • Just extend BaseRecyclerAdapter and good to go.
  • Get onClick event for parent recycler item as well child item.
  • Customize where you want to collapse/expand effect.

🎬 Preview

Expandable RecyclerView Expandable RecyclerView Expandable RecyclerView
me

Installation

  1. Extend BaseRecyclerAdapter in recycler adapter and implement below methods.
class ListAdapter : BaseRecyclerAdapter<ListDataModel, ChildDataModel>() {
// Pass parent and child model in BaseRecyclerAdapter

    override fun getLayoutIdForType(): Int = R.layout.item_parent  // Provide parent recycler item id

    override fun getLayoutIdForChild(): Int = R.layout.item_child  // Provide child recycler item id

    // Click event fot parent recycler item
    override fun onParentItemClick(triple: Triple<Int, Any, View>, viewDataBinding: ViewDataBinding) {
        val data = triple.second as ListDataModel // Here you can get parent item data for clicked item
        val position = triple.first // Get position of clicked item
        val view = triple.third // Get view of clicked item

        when (view.id) {
            R.id.text_movie_year -> {
                // Call this function where you want to expand collapse childView
                expandCollapse(triple.first, viewDataBinding)
            }
        }
    }

    // Click event for child rectycler item
    override fun onChildItemClicked(triple: Triple<Int, Any, View>, parentIndex: Int) {
        val data = triple.second as ChildDataModel // Here you can get child item data for clicked item
        val position = triple.first // Get position of clicked item
        val view = triple.third // Get view of clicked item

        when (view.id) {
            R.id.img_download_movie -> {
                // Here you can perform your action
            }
        }
    }
}
  1. Create variables in parent recycler item as par below and bind it as per requirement.
    <data>
        <variable
            name="data" // Variable name should be same
            type="com.expandable.recyclerview.model.ListDataModel" />
        <variable
            name="clickHandler" // Variable name should be same
            type="android.view.View.OnClickListener" />
        <variable
            name="adapter" // Variable name should be same and give type  BaseChildRecyclerAdapter
            type="com.expandable.recyclerview.base.BaseChildRecyclerAdapter" />
        <variable
            name="isVisible" // Variable name should be same
            type="Boolean" />
        <import type="android.view.View" />
    </data>
  1. SetUp child recyclerview with adapter and visiblty like this
    <androidx.recyclerview.widget.RecyclerView
                android:id="@+id/childRecycler"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/_8sdp"
                android:visibility="@{isVisible ? View.VISIBLE : View.GONE }" // Important line
                app:setAdapter="@{adapter}" //Important line
                .... />
  1. Create variables in child recycler item as par below and bind it as per requirement.
    <data>
        <variable
            name="data" // Variable name should be same
            type="com.expandable.recyclerview.model.ChildDataModel" />
        <variable
            name="clickHandler" // Variable name should be same
            type="android.view.View.OnClickListener" />
        <import type="android.view.View" />
    </data>
  1. Assign click handler where you want to recive click event
  <TextView
        android:id="@+id/movieTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="@{clickHandler::onClick}" /> // Important line

Find this sample useful? ❤️

Support it by joining stargazers for this repository.

🤝 How to Contribute

Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪 Check out our Contributing Guide for ideas on contributing.

Bugs and Feedback

For bugs, feature requests, and discussion please use GitHub Issues.

License

Copyright 2021 Simform Solutions

 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.
You might also like...
Android RecyclerView Adapter with nested items & expand/contract functionality
Android RecyclerView Adapter with nested items & expand/contract functionality

AccordionRecycler Android RecyclerView Adapter with nested items & expand/contract functionality With AccordionRecycler you can easily create awesome

Mobile App that shows Random Products in a Nested Recyclerview for Android [Kotlin] Developer Role at Edvora
Mobile App that shows Random Products in a Nested Recyclerview for Android [Kotlin] Developer Role at Edvora

EdvoraAndroidTest An simple Android App for Edvora Android Assessment. It consum

Nested popup menus with smooth height animations
Nested popup menus with smooth height animations

cascade cascade builds nested popup menus with smooth height animations. It is designed to be a drop-in replacement for PopupMenu so using it in your

ExpandableRecyclerView - Expandable RecyclerView For Kotlin
ExpandableRecyclerView - Expandable RecyclerView For Kotlin

Expandable RecyclerView ExpandableItemView in ScrollView: ExpandableRecyclerView

A layout engine for Android that decouples layouts from the View containers that manage scrolling and view recycling. FreeFlow makes it really easy to create custom layouts and beautiful transition animations as data and layouts change SSPullToRefresh makes PullRefresh easy to use, you can provide your own custom animations or set simple gifs on refresh view. The best feature is Lottie animations in refresh view, it uses lottie animations to render high quality animations on pull refresh. 🎉💥 Small, smart and generic adapter for recycler view with easy and advanced data to ViewHolder binding.
Small, smart and generic adapter for recycler view with easy and advanced data to ViewHolder binding.

smart-recycler-adapter Never code any boilerplate RecyclerAdapter again! This library will make it easy and painless to map your data item with a targ

Generate data-view-binding adapters of android recycler view.

Items 这个库可以为 Android 的 RecyclerView 生成基于 Data-View-Binding 的 Adapter。 对比其他一些类似的开源库,它有以下的一些优势: 更好的拓展性。这个库不需要你继承特定的 Adapter 或 ViewHolder 类,你可以继承任何第三方提供的

💡🚀⭐️ A generalized adapter for RecyclerView on Android which makes it easy to add heterogeneous items to a list
💡🚀⭐️ A generalized adapter for RecyclerView on Android which makes it easy to add heterogeneous items to a list

Mystique is a Kotlin library for Android’s RecyclerView which allows you to create homogeneous and heterogeneous lists effortlessly using an universal

Recycler-coroutines - RecyclerView Auto Add Data Using Coroutines

Sample RecyclerView Auto Add With Coroutine Colaborator Very open to anyone, I'l

Android library for creating an expandable to full screen view inside a viewgroup composition.
Android library for creating an expandable to full screen view inside a viewgroup composition.

Expandable Panel Android Library Check ExpandablePanel Demo application on GooglePlay: Details This Android library implements the expand by sliding l

Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android projects

ExpandableTextView Light-weighted, convenient implementation of expandable text view that supports expanding & collapsing animations for Android proje

. Android library that integrate sticky section headers in your RecyclerView

recyclerview-stickyheaders Recyclerview-stickyheaders is an Android library that makes it easy to integrate section headers in your RecyclerView. Thes

A view that makes it easy to debug response data.(一个可以方便调试响应数据的视图。)
A view that makes it easy to debug response data.(一个可以方便调试响应数据的视图。)

JSONRecyclerView 该控件可以方便调试响应数据,如下图所示: 控件的样式参考以下这个网站: JSON在线解析解析及格式化验证 项目的GitHub:JSONRecyclerView 项目Demo的GitHub:JSONRecyclerViewDemo 概述 控件是以RecyclerVie

Chips EditText, Token EditText, Bubble EditText, Spannable EditText and etc.. There are many names of this control. Here I develop easy to understand , modify and integrate Chips Edit Text widget for Android
Chips EditText, Token EditText, Bubble EditText, Spannable EditText and etc.. There are many names of this control. Here I develop easy to understand , modify and integrate Chips Edit Text widget for Android

Chips EditText Library Chips EditText, Token EditText, Bubble EditText, Spannable EditText and etc.. There are many names of this control. Here I deve

A couple of sticky header decorations for android's recycler view.
A couple of sticky header decorations for android's recycler view.

DEPRECATION NOTICE This library has not been touched in a very long time and many things have changed in the android ecosystem since then. Updating an

Custom Layout Manager for Recycler View
Custom Layout Manager for Recycler View

Circular Layout Manager Overview A library for Android which essentially contains a Custom Layout Manager for Recycler View which lays out its child v

A couple of sticky header decorations for android's recycler view.
A couple of sticky header decorations for android's recycler view.

DEPRECATION NOTICE This library has not been touched in a very long time and many things have changed in the android ecosystem since then. Updating an

A custom recycler view with shimmer views to indicate that views are loading.
A custom recycler view with shimmer views to indicate that views are loading.

ShimmerRecyclerView Intro A custom recycler view with shimmer views to indicate that views are loading. The recycler view has a built-in adapter to co

Owner
Simform Solutions
Simform Solutions
Android widget with pull to refresh for all the views,and support loadMore for ListView , RecyclerView, GridView and SwipeRefreshLayout.

CommonPullToRefresh Android widget with pull to refresh for all the views,and support loadMore for ListView,RecyclerView,GridView and SwipeRefreshLayo

null 1.1k Nov 10, 2022
Easy to use ListView with pinned sections for Android.

Easy to use ListView with pinned sections for Android 2.1 and higher. Pinned section is a header view which sticks to the top of the list until at lea

Sergej Shafarenka 2.6k Dec 21, 2022
Android library to achieve in an easy way, the behaviour of the home page in the Expedia app, with a pair of auto-scroll circular parallax ListViews.

ListBuddies This library is not maintained anymore and there will be no further releases Android library of a pair of auto-scroll circular parallax Li

JPARDOGO 970 Dec 29, 2022
An easy to use Drag & Drop List for Android. Direct replacement of the android ListView.

DragNDropListView DragNDropListView is a direct replacement for the stock Android ListView. If you know how to use ListView, you already know how to u

null 187 Dec 22, 2022
Horizontal list view for Android which allows variable items widths

Deprecated This widget is now deprecated and it won't be updated anymore. Use RecyclerView instead Horizontal Variable ListView Horizontal ListView fo

Alessandro Crugnola 862 Nov 15, 2022
A small android library for tagging views inside a ScrollView as "sticky" making them stick to the top of the scroll container until a new sticky view comes and takes it's place

StickyScrollViewItems StickyScrollViewItems is a ScrollView subclass that allowed you to mark items inside the ScrollView as sticky. The items marked

Emil Sjölander 1k Jan 7, 2023
This is a very simple library for Android that allows you to stick an header to a scrollable view and easily apply animation to it

StikkyHeader This is a very simple library for Android that allows you to stick an header to a ListView and easily apply animation to it Usage To use

Carlo Marinangeli 847 Dec 30, 2022
An open source Android library that provides a floating group view at the top of the ExpandableListView

FloatingGroupExpandableListView FloatingGroupExpandableListView is a huge name an open source Android library that provides a floating group view (aka

Diego Lima 376 Nov 28, 2022
StackExpandableView - A custom view that resembles the iOS notification group behavior

StackExpandableView - A custom view that resembles the iOS notification group behavior

Fabio Sassu 155 Dec 15, 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