Skip to content

Commit 2db058d

Browse files
Merge pull request #2 from SimformSolutionsPvtLtd/develop
SSPullToRefresh
2 parents dbb0efb + a5bbc15 commit 2db058d

File tree

94 files changed

+2850
-1
lines changed

Some content is hidden

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

94 files changed

+2850
-1
lines changed

.DS_Store

6 KB
Binary file not shown.

.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
.gradle/
22+
build/
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Proguard folder generated by Eclipse
28+
proguard/
29+
30+
# Log Files
31+
*.log
32+
33+
# Android Studio Navigation editor temp files
34+
.navigation/
35+
36+
# Android Studio captures folder
37+
captures/
38+
39+
# IntelliJ
40+
*.iml
41+
.idea/workspace.xml
42+
.idea/tasks.xml
43+
.idea/gradle.xml
44+
.idea/assetWizardSettings.xml
45+
.idea/dictionaries
46+
.idea/libraries
47+
.idea/jarRepositories.xml
48+
# Android Studio 3 in .gitignore file.
49+
.idea/caches
50+
.idea/modules.xml
51+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
52+
.idea/navEditor.xml
53+
54+
# Keystore files
55+
# Uncomment the following lines if you do not want to check your keystore files in.
56+
#*.jks
57+
#*.keystore
58+
59+
# External native build folder generated in Android Studio 2.2 and later
60+
.externalNativeBuild
61+
.cxx/
62+
63+
# Google Services (e.g. APIs or Firebase)
64+
# google-services.json
65+
66+
# Freeline
67+
freeline.py
68+
freeline/
69+
freeline_project_description.json
70+
71+
# fastlane
72+
fastlane/report.xml
73+
fastlane/Preview.html
74+
fastlane/screenshots
75+
fastlane/test_output
76+
fastlane/readme.md
77+
78+
# Version control
79+
vcs.xml
80+
81+
# lint
82+
lint/intermediates/
83+
lint/generated/
84+
lint/outputs/
85+
lint/tmp/
86+
# lint/reports/
87+
88+
# Android Profiling
89+
*.hprof

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/.name

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/compiler.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 174 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,175 @@
11
# SSPullToRefresh
2-
SSPullToRefresh
2+
## Pull to Refresh with custom animations
3+
4+
[![Build Status](https://travis-ci.org/joemccann/dillinger.svg?branch=master)][git-repo-url]
5+
6+
SSPullToRefresh uses lottie animations to render high quality animations on pull refresh.
7+
8+
## Features
9+
10+
- simple and easy to use ( no complex animations to deal with )
11+
- customize the animation view by providing you own ( need to subclass SSAnimationView )
12+
- import lottie jason in assets folder and apply animation ( as simple as that )
13+
- customize repeateMode, repeateCount and Interpolators on different points of animations
14+
15+
# 🎬 Preview
16+
17+
| Default refreshView | customize animation |
18+
|--|--|
19+
| ![](default_view.gif) | ![](custom_anim.gif) |
20+
21+
# How it works:
22+
23+
1. Gradle Dependency
24+
25+
- Add the JitPack repository to your project's build.gradle file
26+
27+
```groovy
28+
allprojects {
29+
repositories {
30+
...
31+
maven { url 'https://jitpack.io' }
32+
}
33+
}
34+
```
35+
- Add the dependency in your app's build.gradle file
36+
37+
```groovy
38+
dependencies {
39+
implementation 'com.github.SimformSolutionsPvtLtd:SSPullToRefresh:1.0'
40+
}
41+
```
42+
2. Wrap your refreshing view ( RecyclerView, listView etc..) with SSPullToRefreshLayout
43+
```xml
44+
<com.simform.refresh.SSPullToRefreshLayout
45+
android:id="@+id/ssPullRefresh"
46+
android:layout_width="match_parent"
47+
android:layout_height="match_parent"
48+
app:layout_constraintBottom_toBottomOf="parent"
49+
app:layout_constraintEnd_toEndOf="parent"
50+
app:layout_constraintStart_toStartOf="parent"
51+
app:layout_constraintTop_toTopOf="parent">
52+
53+
<androidx.recyclerview.widget.RecyclerView
54+
android:id="@+id/rv"
55+
android:layout_width="match_parent"
56+
android:layout_height="wrap_content"
57+
app:layout_constraintBottom_toBottomOf="parent"
58+
app:layout_constraintEnd_toEndOf="parent"
59+
app:layout_constraintStart_toStartOf="parent"
60+
app:layout_constraintTop_toTopOf="parent" />
61+
62+
</com.simform.refresh.SSPullToRefreshLayout>
63+
```
64+
3. Set OnRefreshListener on SSPullToRefreshLayout and you are good to go 👍
65+
```kotlin
66+
ssPullRefresh.setOnRefreshListener(object : SSPullToRefreshLayout.OnRefreshListener {
67+
override fun onRefresh() {
68+
// This is demo code to perform
69+
GlobalScope.launch {
70+
delay(3000)
71+
ssPullRefresh.setRefreshing(false) // This line stops layout refreshing
72+
MainScope().launch {
73+
Toast.makeText(this@MainActivity,"Refresh Complete",Toast.LENGTH_SHORT).show()
74+
}
75+
}
76+
}
77+
})
78+
```
79+
80+
# To customize SSPullToRefreshLayout:
81+
82+
* To customize SSPullToRefreshLayout, you can set a different lottie animation of your choice
83+
* you need to have .json file of you lottie animations in assets forlder of you app module
84+
85+
![](asset_folder.png)
86+
87+
```kotlin
88+
ssPullRefresh.setLottieAnimation("lottie_isometric-plane.json")
89+
```
90+
* To customize repeadtMode and repeatCount of animation.
91+
```kotlin
92+
ssPullRefresh.setRepeatMode(SSPullToRefreshLayout.RepeatMode.REPEAT)
93+
ssPullRefresh.setRepeatCount(SSPullToRefreshLayout.RepeatCount.INFINITE)
94+
```
95+
* To change refresh style.
96+
```kotlin
97+
ssPullRefresh.setRefreshStyle(SSPullToRefreshLayout.RefreshStyle.NORMAL)
98+
```
99+
* To customize the whole refresh view you need to inherit SSAnimationView for your custom class and override the methods needed
100+
```kotlin
101+
class MytAnimationView(context: Context): SSAnimationView(context) {
102+
103+
override fun reset() {
104+
cancelAnimation()
105+
playAnimation()
106+
}
107+
108+
override fun refreshing() {
109+
}
110+
111+
override fun refreshComplete() {
112+
cancelAnimation()
113+
}
114+
115+
override fun pullToRefresh() {
116+
playAnimation()
117+
}
118+
119+
override fun releaseToRefresh() {
120+
}
121+
122+
override fun pullProgress(pullDistance: Float, pullProgress: Float) {
123+
}
124+
}
125+
```
126+
* Provide you CustomView by setRefreshView() method
127+
```kotlin
128+
ssPullRefresh.setRefreshView(
129+
MytAnimationView(this),
130+
ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,300)
131+
)
132+
```
133+
* You can aslo provide only view without parameters, in that case refreshView will take MATCH_PARENT,70 width,hight respectively
134+
```kotlin
135+
ssPullRefresh.setRefreshView(MytAnimationView(this))
136+
```
137+
138+
# Other Library used:
139+
* [Lottie][lottie-repo-url]
140+
141+
## Find this library useful? ❤️
142+
Support it by joining __[stargazers]__ for this repository.⭐
143+
144+
## 🤝 How to Contribute
145+
146+
Whether you're helping us fix bugs, improve the docs, or a feature request, we'd love to have you! 💪
147+
148+
Check out our __[Contributing Guide]__ for ideas on contributing.
149+
150+
## Bugs and Feedback
151+
152+
For bugs, feature requests, and discussion please use __[GitHub Issues]__.
153+
154+
## License
155+
156+
```
157+
Copyright 2021 Simform Solutions
158+
159+
Licensed under the Apache License, Version 2.0 (the "License");
160+
you may not use this file except in compliance with the License.
161+
You may obtain a copy of the License at
162+
http://www.apache.org/licenses/LICENSE-2.0
163+
Unless required by applicable law or agreed to in writing, software
164+
distributed under the License is distributed on an "AS IS" BASIS,
165+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166+
See the License for the specific language governing permissions and limitations under the License.
167+
```
168+
169+
[//]: # (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)
170+
171+
[git-repo-url]: <https://github.com/SimformSolutionsPvtLtd/SSPullToRefresh.git>
172+
[lottie-repo-url]: <https://github.com/airbnb/lottie-android.git>
173+
[stargazers]: <https://www.google.com/>
174+
[Contributing Guide]: <https://www.google.com/>
175+
[GitHub Issues]: <https://github.com/SimformSolutionsPvtLtd/SSPullToRefresh/issues>

app/.DS_Store

6 KB
Binary file not shown.

app/.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
.gradle/
22+
build/
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Proguard folder generated by Eclipse
28+
proguard/
29+
30+
# Log Files
31+
*.log
32+
33+
# Android Studio Navigation editor temp files
34+
.navigation/
35+
36+
# Android Studio captures folder
37+
captures/
38+
39+
# IntelliJ
40+
*.iml
41+
.idea/workspace.xml
42+
.idea/tasks.xml
43+
.idea/gradle.xml
44+
.idea/assetWizardSettings.xml
45+
.idea/dictionaries
46+
.idea/libraries
47+
.idea/jarRepositories.xml
48+
# Android Studio 3 in .gitignore file.
49+
.idea/caches
50+
.idea/modules.xml
51+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
52+
.idea/navEditor.xml
53+
54+
# Keystore files
55+
# Uncomment the following lines if you do not want to check your keystore files in.
56+
#*.jks
57+
#*.keystore
58+
59+
# External native build folder generated in Android Studio 2.2 and later
60+
.externalNativeBuild
61+
.cxx/
62+
63+
# Google Services (e.g. APIs or Firebase)
64+
# google-services.json
65+
66+
# Freeline
67+
freeline.py
68+
freeline/
69+
freeline_project_description.json
70+
71+
# fastlane
72+
fastlane/report.xml
73+
fastlane/Preview.html
74+
fastlane/screenshots
75+
fastlane/test_output
76+
fastlane/readme.md
77+
78+
# Version control
79+
vcs.xml
80+
81+
# lint
82+
lint/intermediates/
83+
lint/generated/
84+
lint/outputs/
85+
lint/tmp/
86+
# lint/reports/
87+
88+
# Android Profiling
89+
*.hprof

0 commit comments

Comments
 (0)