-
Notifications
You must be signed in to change notification settings - Fork 21
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 #2 from SimformSolutionsPvtLtd/develop
SSPullToRefresh
- Loading branch information
Showing
94 changed files
with
2,850 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,89 @@ | ||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
# Uncomment the following line in case you need and you don't have the release build type files in your app | ||
# release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/jarRepositories.xml | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
.cxx/ | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
# google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Version control | ||
vcs.xml | ||
|
||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ | ||
|
||
# Android Profiling | ||
*.hprof |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,2 +1,175 @@ | ||
# SSPullToRefresh | ||
SSPullToRefresh | ||
## Pull to Refresh with custom animations | ||
|
||
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)][git-repo-url] | ||
|
||
SSPullToRefresh uses lottie animations to render high quality animations on pull refresh. | ||
|
||
## Features | ||
|
||
- simple and easy to use ( no complex animations to deal with ) | ||
- customize the animation view by providing you own ( need to subclass SSAnimationView ) | ||
- import lottie jason in assets folder and apply animation ( as simple as that ) | ||
- customize repeateMode, repeateCount and Interpolators on different points of animations | ||
|
||
# 🎬 Preview | ||
|
||
| Default refreshView | customize animation | | ||
|--|--| | ||
| ![](default_view.gif) | ![](custom_anim.gif) | | ||
|
||
# How it works: | ||
|
||
1. Gradle Dependency | ||
|
||
- Add the JitPack repository to your project's build.gradle file | ||
|
||
```groovy | ||
allprojects { | ||
repositories { | ||
... | ||
maven { url 'https://jitpack.io' } | ||
} | ||
} | ||
``` | ||
- Add the dependency in your app's build.gradle file | ||
|
||
```groovy | ||
dependencies { | ||
implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.0' | ||
} | ||
``` | ||
2. Wrap your refreshing view ( RecyclerView, listView etc..) with SSPullToRefreshLayout | ||
```xml | ||
<com.simform.refresh.SSPullToRefreshLayout | ||
android:id="@+id/ssPullRefresh" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"> | ||
|
||
<androidx.recyclerview.widget.RecyclerView | ||
android:id="@+id/rv" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
</com.simform.refresh.SSPullToRefreshLayout> | ||
``` | ||
3. Set OnRefreshListener on SSPullToRefreshLayout and you are good to go 👍 | ||
```kotlin | ||
ssPullRefresh.setOnRefreshListener(object : SSPullToRefreshLayout.OnRefreshListener { | ||
override fun onRefresh() { | ||
// This is demo code to perform | ||
GlobalScope.launch { | ||
delay(3000) | ||
ssPullRefresh.setRefreshing(false) // This line stops layout refreshing | ||
MainScope().launch { | ||
Toast.makeText(this@MainActivity,"Refresh Complete",Toast.LENGTH_SHORT).show() | ||
} | ||
} | ||
} | ||
}) | ||
``` | ||
|
||
# To customize SSPullToRefreshLayout: | ||
|
||
* To customize SSPullToRefreshLayout, you can set a different lottie animation of your choice | ||
* you need to have .json file of you lottie animations in assets forlder of you app module | ||
|
||
![](asset_folder.png) | ||
|
||
```kotlin | ||
ssPullRefresh.setLottieAnimation("lottie_isometric-plane.json") | ||
``` | ||
* To customize repeadtMode and repeatCount of animation. | ||
```kotlin | ||
ssPullRefresh.setRepeatMode(SSPullToRefreshLayout.RepeatMode.REPEAT) | ||
ssPullRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE) | ||
``` | ||
* To change refresh style. | ||
```kotlin | ||
ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.NORMAL) | ||
``` | ||
* To customize the whole refresh view you need to inherit SSAnimationView for your custom class and override the methods needed | ||
```kotlin | ||
class MytAnimationView(context: Context): SSAnimationView(context) { | ||
|
||
override fun reset() { | ||
cancelAnimation() | ||
playAnimation() | ||
} | ||
|
||
override fun refreshing() { | ||
} | ||
|
||
override fun refreshComplete() { | ||
cancelAnimation() | ||
} | ||
|
||
override fun pullToRefresh() { | ||
playAnimation() | ||
} | ||
|
||
override fun releaseToRefresh() { | ||
} | ||
|
||
override fun pullProgress(pullDistance: Float, pullProgress: Float) { | ||
} | ||
} | ||
``` | ||
* Provide you CustomView by setRefreshView() method | ||
```kotlin | ||
ssPullRefresh.setRefreshView( | ||
MytAnimationView(this), | ||
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,300) | ||
) | ||
``` | ||
* You can aslo provide only view without parameters, in that case refreshView will take MATCH_PARENT,70 width,hight respectively | ||
```kotlin | ||
ssPullRefresh.setRefreshView(MytAnimationView(this)) | ||
``` | ||
|
||
# Other Library used: | ||
* [Lottie][lottie-repo-url] | ||
|
||
## 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 | ||
|
||
``` | ||
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. | ||
``` | ||
|
||
[//]: # (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) | ||
|
||
[git-repo-url]: <https://github.com/SimformSolutionsPvtLtd/SSPullToRefresh.git> | ||
[lottie-repo-url]: <https://github.com/airbnb/lottie-android.git> | ||
[stargazers]: <https://www.google.com/> | ||
[Contributing Guide]: <https://www.google.com/> | ||
[GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/SSPullToRefresh/issues> |
Binary file not shown.
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,89 @@ | ||
# Built application files | ||
*.apk | ||
*.aar | ||
*.ap_ | ||
*.aab | ||
|
||
# Files for the ART/Dalvik VM | ||
*.dex | ||
|
||
# Java class files | ||
*.class | ||
|
||
# Generated files | ||
bin/ | ||
gen/ | ||
out/ | ||
# Uncomment the following line in case you need and you don't have the release build type files in your app | ||
# release/ | ||
|
||
# Gradle files | ||
.gradle/ | ||
build/ | ||
|
||
# Local configuration file (sdk path, etc) | ||
local.properties | ||
|
||
# Proguard folder generated by Eclipse | ||
proguard/ | ||
|
||
# Log Files | ||
*.log | ||
|
||
# Android Studio Navigation editor temp files | ||
.navigation/ | ||
|
||
# Android Studio captures folder | ||
captures/ | ||
|
||
# IntelliJ | ||
*.iml | ||
.idea/workspace.xml | ||
.idea/tasks.xml | ||
.idea/gradle.xml | ||
.idea/assetWizardSettings.xml | ||
.idea/dictionaries | ||
.idea/libraries | ||
.idea/jarRepositories.xml | ||
# Android Studio 3 in .gitignore file. | ||
.idea/caches | ||
.idea/modules.xml | ||
# Comment next line if keeping position of elements in Navigation Editor is relevant for you | ||
.idea/navEditor.xml | ||
|
||
# Keystore files | ||
# Uncomment the following lines if you do not want to check your keystore files in. | ||
#*.jks | ||
#*.keystore | ||
|
||
# External native build folder generated in Android Studio 2.2 and later | ||
.externalNativeBuild | ||
.cxx/ | ||
|
||
# Google Services (e.g. APIs or Firebase) | ||
# google-services.json | ||
|
||
# Freeline | ||
freeline.py | ||
freeline/ | ||
freeline_project_description.json | ||
|
||
# fastlane | ||
fastlane/report.xml | ||
fastlane/Preview.html | ||
fastlane/screenshots | ||
fastlane/test_output | ||
fastlane/readme.md | ||
|
||
# Version control | ||
vcs.xml | ||
|
||
# lint | ||
lint/intermediates/ | ||
lint/generated/ | ||
lint/outputs/ | ||
lint/tmp/ | ||
# lint/reports/ | ||
|
||
# Android Profiling | ||
*.hprof |
Oops, something went wrong.