SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views

Overview

SSJetpackComposeSwipeableView

SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views. You can use this in your lazyColumns or can add a simple view which contains swipe to edit/delete functionality.

Kotlin Version Platform API

Features

  • Simple and easy to use.
  • Customize according to your needs.
  • Use wherever you want.
  • Get proper swipe callback events.

🎬 Preview

Swipe Left Swipe Right Swipe Left + Right

Installation

  • Add it in your root build.gradle at the end of repositories:

     allprojects {
     	repositories {
     		...
     		maven { url 'https://jitpack.io' }
     	}
     }
  • Add the dependency in your app's build.gradle file

     dependencies {
            implementation 'com.github.SimformSolutionsPvtLtd:SSJetpackComposeSwipeableView:1.0.1'
     }

How to Use and Customization

  1. Wherever you want to add swipeable view
    SwipeAbleItemView(
            // Triplet(Icon, TintColor, Id) Pass the icon with the tint color which you want to display in left side view, Id will be used to identify onClick Events.
            leftViewIcons = arrayListOf(Pair(Icons.Filled.Edit, "btnEditLeft"), Pair(Icons.Filled.Delete, "btnDeleteLeft")),
            // Triplet(Icon, TintColor, Id) Pass the icon with the tint color which you want to display in right side view, Id will be used to identify onClick Events.
            rightViewIcons = arrayListOf(Pair(Icons.Filled.Edit, "btnEditRight")),
            // Position of the item normally required only when used with lazyColumns to identify the index of the item.
            position = 0,
            // Swipe direction it can be Left or Right or Both (Left + Right).
            swipeDirection = swipeDirection ?: SwipeDirection.BOTH,
            // Perform any action when swipeable view is clicked. It provides the position(Index of the item) as well as id to identify which item clicked incase of multiple items.
            onClick = { // Pair(Position, Id)
                Toast.makeText(context, "${it.second} clicked. Position :- ${it.first}", Toast.LENGTH_SHORT)
                    .show()
            },
            // Width for the left side of the view which will be shown when swiped.
            leftViewWidth = 70.dp,
            // Width for the right side of the view which will be shown when swiped.
            rightViewWidth = 70.dp,
            // Height for the swipeable view.
            height = 60.dp,
            // Background color for left view.
            leftViewBackgroundColor = Primary,
            // Background color for right view.
            rightViewBackgroundColor = Primary,
            // Corner radius for swipeable view.
            cornerRadius = 4.dp,
            // Space between left swipeable view and your main content view.
            leftSpace = 10.dp,
            // Space between right swipeable view and your main content view.
            rightSpace = 10.dp,
            // fractionalThreshold for the swipe
            fractionalThreshold = 0.3f
        ) {
           // Your main view comes here.
        }

All Attributes


Attribute Description Default
leftViewIcons Triplet(Icon, TintColor, Id) Pass the icon with the tint color which you want to display in left side view, Id will be used to identify onClick Events. None
rightViewIcons Triplet(Icon, TintColor, Id) Pass the icon with the tint color which you want to display in right side view, Id will be used to identify onClick Events. None
position Position of the item normally required only when used with lazyColumns to identify the index of the item. 0
swipeDirection Swipe direction it can be Left or Right or Both (Left + Right). None
onClick Perform any action when swipeable view is clicked. It provides a Pair(Position, Id) where the position is index of the item and id to identify which item clicked incase of multiple items. None
leftViewWidth Width for the left side of the view which will be shown when swiped. 70.dp
rightViewWidth Width for the right side of the view which will be shown when swiped. 70.dp
height Height for the swipeable view. 70.dp
cornerRadius Corner radius to be applied to the button. 0.dp
leftSpace Space between left swipeable view and your main content view. 0.dp
rightSpace Space between right swipeable view and your main content view. 0.dp
fractionalThreshold It is used to resolve the elevation for this button in different. 0.3f
content Add your actual view here. none

Our JetPackCompose Sample

SSComposeCookBook : A Collection of major Jetpack compose UI components which are commonly used.

Our JetPackCompose Libraries

SSJetPackComposeProgressButton : SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive.

Find this library 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

This project is licensed under the MIT License - see the LICENSE file for details

You might also like...
Easy zoom in with drag support for Jetpack Compose
Easy zoom in with drag support for Jetpack Compose

ComposeZoomableImage Jetpack Compose Zoomable Image Android Library Easy zoom in with drag support for Jetpack Compose Demo Setup Add Jitpack maven {

Copy of https://github.com/joreilly/MortyComposeKMM to support Android & JVM with Jetpack Compose Multiplatform
Copy of https://github.com/joreilly/MortyComposeKMM to support Android & JVM with Jetpack Compose Multiplatform

Rick&Morty with Compose Multiplatform (Android/Desktop) A copycat of https://github.com/joreilly/MortyComposeKMM to support Android & JVM with Jetpack

🔥 Supports AndroidX and Android-Support

RePluginX 本 Repo 是对 Qihoo360 RePlugin 的完善、增强。 Q: 为什么有这个 Repo? A: 因工作项目需要 使用 & 定制,但官方已经很久没有维护(难道是太稳定了?),且 issue 也没有怎么处理,提交官方 pr 怕是要等到天荒地老,时间紧、任务重,我还是自己

Based on LinearProgressIndicator, support thumb and progress animation
Based on LinearProgressIndicator, support thumb and progress animation

compose-progressIndicator This Library is designed to improve the LinearProgressIndicator provided by Jetpack Compose. Beside the base functionality p

🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.
🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, and Fresco.

Landscapist 🍂 Jetpack Compose image loading library which can fetch and display network images using Glide, Coil, Fresco Usecase You can see the use

About-icons - Android library to easily give credit if using icons which require attribution

Android About Icons Library About this project Features How to use Planned improvements Screenshots Contribute Apps using this library License About t

Jetpack Compose app which generates random names
Jetpack Compose app which generates random names

Compose-Your-Name? A Jetpack Compose App Meme App for knowing you nick name Inspiration You recently might have seen this meme on Instagram, I also di

Android app which shows the information on animes and their characters
Android app which shows the information on animes and their characters

Anime-app Android app which shows the information on animes and their characters Requirements To try out this app, you need to use Android Studio Arct

Simple Jetpack Compose demo app which is developed with CoinGecko API and modern android technologies.
Simple Jetpack Compose demo app which is developed with CoinGecko API and modern android technologies.

CoinBox CoinBox is a multi module small currency tracker app which is developed with Jetpack Compose. This demo app used coingecko.com API to fetch da

Releases(1.0.1)
Owner
Simform Solutions
Simform Solutions
Compose-html - An Android library which provides HTML support for Jetpack Compose texts

HtmlCompose An Android library which provides HTML support for Jetpack Compose t

iRewardHealth 43 Dec 29, 2022
Flippable - A Jetpack Compose utility library to create flipping Composable views with 2 sides

?? Flippable A Jetpack Compose utility library to create flipping Composable views with 2 sides. Built with ❤︎ by Wajahat Karim and contributors Demo

Wajahat Karim 298 Dec 23, 2022
Small code generating library for safe Jetpack Compose navigation with no boilerplate.

Compose Destinations A KSP library to use alongside compose navigation. It reduces boilerplate code and is less error-prone since passing arguments be

Rafael Costa 1.9k Jan 5, 2023
Kapture - A small library for Jetpack Compose to capture Composable content to Android Bitmap

kapture A small utility library for Jetpack Compose to capture Composable conten

Kaustubh Patange 10 Dec 9, 2022
View Navigator is a tool that allows you to inspect and validate all the views of a screen individually.

?? View Navigator View Navigator is a tool that allows you to inspect and validate all the views of a screen individually, highlighting the margins an

Marcelo Alban 5 Nov 29, 2022
Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Android’s modern toolkit for building native UI. Here is a small example to get started.

Jetpack Compose Sample Description This repository is to get started with new Jetpack Compose Toolkit for Android. By using Jetpack Compose you no nee

Simform Solutions 39 Nov 10, 2022
Small Android project demonstrating some navigation components for Jetpack Compose.

Small Android project demonstrating some navigation components for Jetpack Compose. Created this for presenting about this topic for a GDG meetup.

Parshav 3 Sep 15, 2021
Make your device sip only small amounts of battery when not in use.

trickle Make your device sip only small amounts of battery when not in use. What Automatically place your device into battery-saver mode when the scre

pyamsoft 3 Dec 21, 2022
A specific release of the Jacoco library provide coverage support for Jetpack Compose

This project depends on a specific release of the Jacoco library, which has been updated to provide coverage support for Jetpack Compose. This release is available on GitHub, and requires the use of the GitHub Apache Maven Package Repository

Pawnies - AR Chess 12 Aug 7, 2022
Provides a callback for when a @Composible is shown to the user

Compose-Shown Provides a callback for when a @Composible is shown to the user. This can be useful for 'pageview' analytics. It will re-fire when the a

Evan Tatarka 42 Dec 16, 2022