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

Overview

StackExpandableView

A custom view that resembles the iOS notification group behavior

device-2021-03-07-190110

Requirements

  • A project configured with the AndroidX
  • SDK 16 and and higher

Install

Download via Gradle:

Add this to the project build.gradle file:

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

And then add the dependency to the module build.gradle file:

dependencies {
        implementation 'com.github.fabiosassu:StackExpandableView:latest_version'
}

Where the latest_version is the value from Download badge.

Usage

Simple usage

All you need to do is to define a StackExpandableView item inside your layout:

">
 <it.fabiosassu.stackexpandableview.StackExpandableView
            android:id="@+id/horizontalStack"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            app:orientation="horizontal"
            app:animationDuration="1000"
            app:shownElements="5"
            app:parallaxOffset="8dp"/>

You can customize some aspects of this view:

  • the orientation parameter is be used to specify the direction of the expansion It can be either vertical or horizontal. By default is vertical.
  • the animationDuration parameter is used to define the duration of the animation in milliseconds. By default, is 300 milliseconds.
  • the shownElements parameter is used to define how many elements we want to be shown. By default, is 3 elements.
  • the parallaxOffset parameter is used to define the spacing between the underlying objects in dp. By default, is 8dp.

At runtime, you can set/add/remove a list of Views using the related methods

// this is used to set the list of Views
binding.horizontalStack.setWidgets(listOf<LinearLayout>())
// this is used to add a View to the existing one
binding.verticalStack.addWidget(LinearLayout(context))
// this is used to remove a View from the stack
binding.verticalStack.removeWidget(LinearLayout(context))

It is important that all the views that are added to the StackExpandableView have an id set (fo example using ViewCompat.generateViewId()), because it is used to order the views internally and also to look for the view when removeWidget() is called.

Comments
  • App crash when using lib in multiple instances

    App crash when using lib in multiple instances

    Used this in two activities and I see below crash
    on 2.1.0 or 2.1.1 constraintlayout

    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'androidx.constraintlayout.motion.widget.MotionScene$Transition androidx.constraintlayout.motion.widget.MotionScene.getTransitionById(int)' on a null object reference at androidx.constraintlayout.motion.widget.MotionLayout.getTransition(MotionLayout.java:4717) at it.fabiosassu.stackexpandableview.StackExpandableView.rebuildTransition(StackExpandableView.kt:127) 2021-11-07 13:09:51.223 3064-3064/? E/AndroidRuntime: at it.fabiosassu.stackexpandableview.StackExpandableView.redraw(StackExpandableView.kt:123) at it.fabiosassu.stackexpandableview.StackExpandableView.setOrientation(StackExpandableView.kt:24) at it.fabiosassu.stackexpandableview.StackExpandableView.init(StackExpandableView.kt:67) at it.fabiosassu.stackexpandableview.StackExpandableView.(StackExpandableView.kt:43)

    opened by skybind2020 1
  • View Dimension In Collapsed State. (#9)

    View Dimension In Collapsed State. (#9)

    • fixed an issue that could cause the view to display greater cards in collapsed mode.
    • project cleaning.
    • updated library version to 1.0.2.
    • turned sample textview into material button.
    • updated dependencies.
    opened by fabiosassu 0
  • View Dimension In Collapsed State.

    View Dimension In Collapsed State.

    • fixed an issue that could cause the view to display greater cards in collapsed mode.
    • project cleaning.
    • updated library version to 1.0.2.
    • turned sample textview into material button.
    • updated dependencies.
    opened by fabiosassu 0
  • MotionLayout 2.1.1 Support

    MotionLayout 2.1.1 Support

    • removed unused test classes and dependencies.
    • updated dependencies and gradle version to the latest one.
    • defined scene at runtime instead of xml to avoid NPE.
    opened by fabiosassu 0
  • Can this component be used as a recyclerview item?

    Can this component be used as a recyclerview item?

    I am getting this behaviour where when the item goes out of the screen, and comes back, the stacked cards are no longer appear as a stacked. https://drive.google.com/file/d/1MEbMvQXRn9jDNTpbDgzQFtBF78LyczrL/view?usp=sharing

    opened by jayeshbabuav 1
Releases(1.0.2)
  • 1.0.2(Dec 6, 2021)

    • fixed an issue that could cause the view to display greater cards in collapsed mode.
    • project cleaning.
    • updated library version to 1.0.2.
    • turned sample textview into material button.
    • updated dependencies.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Nov 14, 2021)

    • removed unused test classes and dependencies.
    • updated dependencies and gradle version to the latest one.
    • defined scene at runtime instead of xml to avoid NPE.
    Source code(tar.gz)
    Source code(zip)
Owner
Fabio Sassu
Fabio Sassu
A tiling scrollview to display large picture (similar to iOS "CATiledLayer")

Project is not maintained right now. Please see the note at the end of this file. Introduction This Android widget aims to provide a scalable way to d

Sebastian Roth 245 Nov 25, 2022
An Android custom ListView and ScrollView with pull to zoom-in.

PullZoomView An Android custom ListView and ScrollView with pull to zoom-in. Features Set ZoomView enable Add HeaderView Custom ZoomView Parallax or N

Frank-Zhu 2.3k Dec 26, 2022
android custom listview,with interaction pattern load more and pull to refresh to load data dinamically

The first thing that i have to say is render thanks to johannilsson because all the part of pull to refresh listview is based in the code of his repos

Fabian Leon 447 Nov 15, 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
Expandable Recyclerview makes it easy to integrate nested recycler view...🔨 📝

SSExpandableRecyclerView Expandable Recyclerview make it easy to integrate nested recyclerview Features Simple and easy to use ( no complex adapter re

Simform Solutions 52 Nov 1, 2022
A powerful tool (iOS & Android) that focuses on mobile operation behavior!

DiDiPrism,中文名:小桔棱镜,是一款专注于移动端操作行为的工具,涵盖APP操作回放、操作检测、以及数据可视化能力。我们在整个方案的实现过程中沉淀出了一套技术框架,希望可以逐步开源出来帮助更多人,同时也希望棱镜在大家的合力下能够更快的成长。 它有哪些亮点? 零入侵 业务代码无需任何适配。 高可

DiDi 1.6k Dec 22, 2022
Pull Notification 0.8 0.0 Java Notification TO GO

Full FCM Push/Pull Notification Featured In : Index Overview Features Prerequisites Usage Notes License Overview FCM push/pull notification is a libra

null 15 May 25, 2020
Floating Notification for Android app - Facebook ChatHeads Notification system

FloatingView (Application Demo on Play Store) DEPRECATED SEE FloatingView Floating View for Android app - Facebook ChatHeads Notification system This

Fernandez Anthony 530 Nov 17, 2022
Floating Notification for Android app - Facebook ChatHeads Notification system

FloatingView (Application Demo on Play Store) DEPRECATED SEE FloatingView Floating View for Android app - Facebook ChatHeads Notification system This

Fernandez Anthony 530 Nov 17, 2022
Optimize notification icons for ColorOS and adapt to native notification icon specifications

Optimize notification icons for ColorOS and adapt to native notification icon specifications

Fankesyooni 23 Jan 4, 2023
*** WARNING: This library is no longer maintained *** An easy way to add a simple 'swipe-and-do-something' behavior to your `RecyclerView` items. Just like in Gmail or Inbox apps.

SwipeToAction An easy way to add a simple 'swipe-and-do-something' behavior to your RecyclerView items. Just like in Gmail or Inbox apps. Integration

Victor Calvello 223 Nov 16, 2022
A Paging GridView with the same behavior as PagingListView.

PagingGridView PagingGridView has the ability to add more items on it like PagingListView does. Basically is a GridView with the ability to add more i

Nicolas Jafelle 279 Dec 29, 2022
A snapping fling behavior for Jetpack Compose

Snapper is a library which brings snapping to the Compose scrolling layouts (currently only LazyColumn and LazyRow). Check out the website for more in

Chris Banes 445 Dec 16, 2022
The behavior of Couchbase Lite C when attempting to connect to a Sync Gateway

This demo demonstrates the behavior of Couchbase Lite C when attempting to connect to a Sync Gateway, while the process has various numbers of file de

Gabriel Terwesten 0 Nov 29, 2021
An Android library supports badge notification like iOS in Samsung, LG, Sony and HTC launchers.

ShortcutBadger: The ShortcutBadger makes your Android App show the count of unread messages as a badge on your App shortcut! Supported launchers: Sony

Leo Lin 7.2k Dec 30, 2022
Remote Notification Manager for Kotlin Multiplatform Mobile iOS and android

Remote Notification Manager for Kotlin Multiplatform Mobile Features Super easy to use APNs and FCM in one interface Dramatically reduce code to write

LINE 24 Dec 10, 2022
Arc Layout is a view group with which you can add a arc-shaped container in your layout.

ArcLayout Arc Layout is a view group with which you can add a arc-shaped container in your layout. Two main variables are the direction and the curvat

Ali Rezaiyan 32 Aug 17, 2022