-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from SimformSolutionsPvtLtd/develop
Develop
- Loading branch information
Showing
49 changed files
with
1,557 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
name: Bug report | ||
about: Create a report to help us improve | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Smartphone (please complete the following information):** | ||
- Device: [e.g. OnePlusNord] | ||
- OS: [e.g. Oreo] | ||
- Version [e.g. 22] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
name: Feature request | ||
about: Suggest an idea for this project | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, sex characteristics, gender identity and expression, | ||
level of experience, education, socio-economic status, nationality, personal | ||
appearance, race, religion, or sexual identity and orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at mohammed.h@simformsolutions.com. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html | ||
|
||
[homepage]: https://www.contributor-covenant.org | ||
|
||
For answers to common questions about this code of conduct, see | ||
https://www.contributor-covenant.org/faq |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Way to contribute | ||
|
||
1. Fork the repo and create your branch from `main`. | ||
2. Clone the project to your own machine. (Please have a look at [**Readme.md**](https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeToDelete/blob/main/README.md) to understand how to run this project on your machine) | ||
3. Commit changes to your own branch | ||
4. Make sure your code lints. | ||
5. Push your work back up to your fork. | ||
6. Issue that pull request! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,122 @@ | ||
# SSJetpackComposeSwipeToDelete | ||
![](/gif/banner.png) | ||
# 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](https://img.shields.io/badge/Kotlin-v1.6.0-blue.svg)](https://kotlinlang.org) [![Platform](https://img.shields.io/badge/Platform-Android-green.svg?style=flat)](https://www.android.com/) [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21) | ||
|
||
# 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 | | ||
| -- | -- | -- | | ||
| <img src="/gif/swipeleft.gif" height="500px"/> | <img src="/gif/swiperight.gif" height="500px"/>| <img src="/gif/swipeboth.gif" height="500px"/> | ||
|
||
## Installation | ||
1. Add it in your root build.gradle at the end of repositories: | ||
|
||
```groovy | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
|
||
* Add the dependency in your app's build.gradle file | ||
|
||
```groovy | ||
dependencies { | ||
implementation 'com.github.SimformSolutionsPvtLtd:SSJetpackComposeSwipeableView:1.x.x' | ||
} | ||
``` | ||
|
||
## How to Use and Customization | ||
1. Wherever you want to add swipeable view | ||
```groovy | ||
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](https://github.com/SimformSolutionsPvtLtd/SSComposeCookBook) : A Collection of major Jetpack compose UI components which are commonly used. | ||
|
||
## Our JetPackCompose Libraries | ||
[SSJetPackComposeProgressButton](https://github.com/SimformSolutionsPvtLtd/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](LICENSE) file for details | ||
|
||
[//]: # (These are reference links used in the body of this note and get stripped out when the markdown processor does its job. There is no need to format nicely because it shouldn't be seen. Thanks SO - http://stackoverflow.com/questions/4823468/store-comments-in-markdown-syntax) | ||
[stargazers]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/stargazers> | ||
[Contributing Guide]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/blob/main/CONTRIBUTING.md> | ||
[GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/issues> | ||
[LICENSE]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/blob/main/LICENSE> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
} | ||
|
||
android { | ||
compileSdk 31 | ||
|
||
defaultConfig { | ||
applicationId "com.example.ssjetpackcomposeswipeableview" | ||
minSdk 21 | ||
targetSdk 31 | ||
versionCode 1 | ||
versionName "1.0" | ||
|
||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | ||
vectorDrawables { | ||
useSupportLibrary true | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = '1.8' | ||
useIR = true | ||
} | ||
buildFeatures { | ||
compose true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion '1.1.0-rc01' | ||
kotlinCompilerVersion '1.5.31' | ||
} | ||
packagingOptions { | ||
resources { | ||
excludes += '/META-INF/{AL2.0,LGPL2.1}' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation 'androidx.core:core-ktx:1.7.0' | ||
implementation 'androidx.appcompat:appcompat:1.4.0' | ||
implementation 'com.google.android.material:material:1.4.0' | ||
implementation "androidx.compose.ui:ui:$compose_version" | ||
implementation "androidx.compose.material:material:$compose_version" | ||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version" | ||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0' | ||
implementation 'androidx.activity:activity-compose:1.4.0' | ||
implementation project(path: ':ssjetpackcomposeswipeableview') | ||
testImplementation 'junit:junit:4.+' | ||
androidTestImplementation 'androidx.test.ext:junit:1.1.3' | ||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' | ||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version" | ||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Add project specific ProGuard rules here. | ||
# You can control the set of applied configuration files using the | ||
# proguardFiles setting in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} | ||
|
||
# Uncomment this to preserve the line number information for | ||
# debugging stack traces. | ||
#-keepattributes SourceFile,LineNumberTable | ||
|
||
# If you keep the line number information, uncomment this to | ||
# hide the original source file name. | ||
#-renamesourcefileattribute SourceFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.ssjetpackcomposeswipeableview"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:roundIcon="@mipmap/ic_launcher_round" | ||
android:supportsRtl="true" | ||
android:theme="@style/Theme.SSJetpackComposeSwipeAbleView"> | ||
<activity | ||
android:name="com.example.ssjetpackcomposeswipeableview.ui.MainActivity" | ||
android:exported="true" | ||
android:label="@string/app_name" | ||
android:theme="@style/Theme.SSJetpackComposeSwipeAbleView.NoActionBar"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.example.ssjetpackcomposeswipeableview.ui.SwipeAbleViewActivity"/> | ||
</application> | ||
|
||
</manifest> |
Oops, something went wrong.