Skip to content

Commit fc903c3

Browse files
Merge pull request #5 from SimformSolutionsPvtLtd/develop
Develop
2 parents 72bd6df + 5535239 commit fc903c3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1557
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Steps to reproduce the behavior:
15+
1. Go to '...'
16+
2. Click on '....'
17+
3. Scroll down to '....'
18+
4. See error
19+
20+
**Expected behavior**
21+
A clear and concise description of what you expected to happen.
22+
23+
**Screenshots**
24+
If applicable, add screenshots to help explain your problem.
25+
26+
**Smartphone (please complete the following information):**
27+
- Device: [e.g. OnePlusNord]
28+
- OS: [e.g. Oreo]
29+
- Version [e.g. 22]
30+
31+
**Additional context**
32+
Add any other context about the problem here.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Is your feature request related to a problem? Please describe.**
11+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12+
13+
**Describe the solution you'd like**
14+
A clear and concise description of what you want to happen.
15+
16+
**Describe alternatives you've considered**
17+
A clear and concise description of any alternative solutions or features you've considered.
18+
19+
**Additional context**
20+
Add any other context or screenshots about the feature request here.

CODE_OF_CONDUCT.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, sex characteristics, gender identity and expression,
9+
level of experience, education, socio-economic status, nationality, personal
10+
appearance, race, religion, or sexual identity and orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
## Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
## Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at [email protected]. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
## Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72+
73+
[homepage]: https://www.contributor-covenant.org
74+
75+
For answers to common questions about this code of conduct, see
76+
https://www.contributor-covenant.org/faq

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Way to contribute
2+
3+
1. Fork the repo and create your branch from `main`.
4+
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)
5+
3. Commit changes to your own branch
6+
4. Make sure your code lints.
7+
5. Push your work back up to your fork.
8+
6. Issue that pull request!

README.md

Lines changed: 122 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,122 @@
1-
# SSJetpackComposeSwipeToDelete
1+
![](/gif/banner.png)
2+
# SSJetpackComposeSwipeableView
3+
### 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.
4+
5+
[![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)
6+
7+
# Features
8+
- Simple and easy to use.
9+
- Customize according to your needs.
10+
- Use wherever you want.
11+
- Get proper swipe callback events.
12+
13+
# 🎬 Preview
14+
15+
| Swipe Left | Swipe Right | Swipe Left + Right |
16+
| -- | -- | -- |
17+
| <img src="/gif/swipeleft.gif" height="500px"/> | <img src="/gif/swiperight.gif" height="500px"/>| <img src="/gif/swipeboth.gif" height="500px"/>
18+
19+
## Installation
20+
1. Add it in your root build.gradle at the end of repositories:
21+
22+
```groovy
23+
allprojects {
24+
repositories {
25+
...
26+
maven { url 'https://jitpack.io' }
27+
}
28+
}
29+
```
30+
31+
* Add the dependency in your app's build.gradle file
32+
33+
```groovy
34+
dependencies {
35+
implementation 'com.github.SimformSolutionsPvtLtd:SSJetpackComposeSwipeableView:1.x.x'
36+
}
37+
```
38+
39+
## How to Use and Customization
40+
1. Wherever you want to add swipeable view
41+
```groovy
42+
SwipeAbleItemView(
43+
// 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.
44+
leftViewIcons = arrayListOf(Pair(Icons.Filled.Edit, "btnEditLeft"), Pair(Icons.Filled.Delete, "btnDeleteLeft")),
45+
// 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.
46+
rightViewIcons = arrayListOf(Pair(Icons.Filled.Edit, "btnEditRight")),
47+
// Position of the item normally required only when used with lazyColumns to identify the index of the item.
48+
position = 0,
49+
// Swipe direction it can be Left or Right or Both (Left + Right).
50+
swipeDirection = swipeDirection ?: SwipeDirection.BOTH,
51+
// 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.
52+
onClick = { // Pair(Position, Id)
53+
Toast.makeText(context, "${it.second} clicked. Position :- ${it.first}", Toast.LENGTH_SHORT)
54+
.show()
55+
},
56+
// Width for the left side of the view which will be shown when swiped.
57+
leftViewWidth = 70.dp,
58+
// Width for the right side of the view which will be shown when swiped.
59+
rightViewWidth = 70.dp,
60+
// Height for the swipeable view.
61+
height = 60.dp,
62+
// Background color for left view.
63+
leftViewBackgroundColor = Primary,
64+
// Background color for right view.
65+
rightViewBackgroundColor = Primary,
66+
// Corner radius for swipeable view.
67+
cornerRadius = 4.dp,
68+
// Space between left swipeable view and your main content view.
69+
leftSpace = 10.dp,
70+
// Space between right swipeable view and your main content view.
71+
rightSpace = 10.dp,
72+
// fractionalThreshold for the swipe
73+
fractionalThreshold = 0.3f
74+
) {
75+
// Your main view comes here.
76+
}
77+
```
78+
79+
### All Attributes
80+
------------------------
81+
82+
| Attribute | Description | Default |
83+
| --- | --- | --- |
84+
| `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 |
85+
| `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 |
86+
| `position` | Position of the item normally required only when used with lazyColumns to identify the index of the item. | `0` |
87+
| `swipeDirection` | Swipe direction it can be Left or Right or Both (Left + Right). | None |
88+
| `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 |
89+
| `leftViewWidth` | Width for the left side of the view which will be shown when swiped. | `70.dp` |
90+
| `rightViewWidth` | Width for the right side of the view which will be shown when swiped. | `70.dp` |
91+
| `height` | Height for the swipeable view. | `70.dp` |
92+
| `cornerRadius` | Corner radius to be applied to the button. | `0.dp` |
93+
| `leftSpace` | Space between left swipeable view and your main content view. | `0.dp` |
94+
| `rightSpace` | Space between right swipeable view and your main content view. | `0.dp` |
95+
| `fractionalThreshold` | It is used to resolve the elevation for this button in different. | `0.3f` |
96+
| `content` | Add your actual view here. | none |
97+
98+
## Our JetPackCompose Sample
99+
[SSComposeCookBook](https://github.com/SimformSolutionsPvtLtd/SSComposeCookBook) : A Collection of major Jetpack compose UI components which are commonly used.
100+
101+
## Our JetPackCompose Libraries
102+
[SSJetPackComposeProgressButton](https://github.com/SimformSolutionsPvtLtd/SSJetPackComposeProgressButton) : SSJetPackComposeProgressButton is an elegant button with a different loading animations which makes your app attractive.
103+
104+
## Find this library useful? ❤️
105+
Support it by joining __[stargazers]__ for this repository.⭐
106+
107+
## How to Contribute🤝
108+
109+
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪
110+
Check out our __[Contributing Guide]__ for ideas on contributing.
111+
112+
## Bugs and Feedback
113+
For bugs, feature requests, and discussion please use __[GitHub Issues]__.
114+
115+
### LICENSE
116+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
117+
118+
[//]: # (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)
119+
[stargazers]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/stargazers>
120+
[Contributing Guide]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/blob/main/CONTRIBUTING.md>
121+
[GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/issues>
122+
[LICENSE]: <https://github.com/SimformSolutionsPvtLtd/SSJetpackComposeSwipeableView/blob/main/LICENSE>

app/build.gradle

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdk 31
8+
9+
defaultConfig {
10+
applicationId "com.example.ssjetpackcomposeswipeableview"
11+
minSdk 21
12+
targetSdk 31
13+
versionCode 1
14+
versionName "1.0"
15+
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17+
vectorDrawables {
18+
useSupportLibrary true
19+
}
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26+
}
27+
}
28+
compileOptions {
29+
sourceCompatibility JavaVersion.VERSION_1_8
30+
targetCompatibility JavaVersion.VERSION_1_8
31+
}
32+
kotlinOptions {
33+
jvmTarget = '1.8'
34+
useIR = true
35+
}
36+
buildFeatures {
37+
compose true
38+
}
39+
composeOptions {
40+
kotlinCompilerExtensionVersion '1.1.0-rc01'
41+
kotlinCompilerVersion '1.5.31'
42+
}
43+
packagingOptions {
44+
resources {
45+
excludes += '/META-INF/{AL2.0,LGPL2.1}'
46+
}
47+
}
48+
}
49+
50+
dependencies {
51+
52+
implementation 'androidx.core:core-ktx:1.7.0'
53+
implementation 'androidx.appcompat:appcompat:1.4.0'
54+
implementation 'com.google.android.material:material:1.4.0'
55+
implementation "androidx.compose.ui:ui:$compose_version"
56+
implementation "androidx.compose.material:material:$compose_version"
57+
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
58+
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
59+
implementation 'androidx.activity:activity-compose:1.4.0'
60+
implementation project(path: ':ssjetpackcomposeswipeableview')
61+
testImplementation 'junit:junit:4.+'
62+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
63+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
64+
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
65+
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
66+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile

app/src/main/AndroidManifest.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="com.example.ssjetpackcomposeswipeableview">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.SSJetpackComposeSwipeAbleView">
12+
<activity
13+
android:name="com.example.ssjetpackcomposeswipeableview.ui.MainActivity"
14+
android:exported="true"
15+
android:label="@string/app_name"
16+
android:theme="@style/Theme.SSJetpackComposeSwipeAbleView.NoActionBar">
17+
<intent-filter>
18+
<action android:name="android.intent.action.MAIN" />
19+
20+
<category android:name="android.intent.category.LAUNCHER" />
21+
</intent-filter>
22+
</activity>
23+
<activity
24+
android:name="com.example.ssjetpackcomposeswipeableview.ui.SwipeAbleViewActivity"/>
25+
</application>
26+
27+
</manifest>

0 commit comments

Comments
 (0)