├── .gitignore
├── .idea
├── .gitignore
├── RkProgressButton.iml
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── compiler.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
├── modules.xml
├── runConfigurations.xml
├── vcs.xml
└── workspace.xml
├── ProgressButton
├── .gitignore
├── build.gradle
├── consumer-rules.pro
├── drawable-v24
│ └── ic_launcher_foreground.xml
├── drawable
│ ├── btn_drawable.xml
│ ├── error_image.xml
│ ├── ic_done_img.xml
│ └── ic_launcher_background.xml
├── proguard-rules.pro
└── src
│ ├── androidTest
│ ├── java
│ │ └── com
│ │ │ └── rk
│ │ │ └── progressbutton
│ │ │ └── ExampleInstrumentedTest.kt
│ └── res
│ │ └── values
│ │ └── colors.xml
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── rk
│ │ │ └── progressbutton
│ │ │ └── RkProgressButton.kt
│ └── res
│ │ ├── drawable
│ │ ├── btn_drawable.xml
│ │ ├── error_image.xml
│ │ └── ic_done_img.xml
│ │ ├── layout
│ │ └── rk_progress.xml
│ │ ├── values
│ │ ├── attrs.xml
│ │ └── colors.xml
│ │ └── xml
│ │ └── rk_progress_scene.xml
│ └── test
│ └── java
│ └── com
│ └── rk
│ └── progressbutton
│ └── ExampleUnitTest.kt
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── rk
│ │ └── progressbutton
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── rk
│ │ │ └── progressbutton
│ │ │ └── MainActivity.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── btn_bg.xml
│ │ ├── ic_done_icon.xml
│ │ ├── ic_error_icon.xml
│ │ └── ic_launcher_background.xml
│ │ ├── font
│ │ ├── bold.TTF
│ │ └── medium.TTF
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── values-night
│ │ └── themes.xml
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── com
│ └── rk
│ └── progressbutton
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/RkProgressButton.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | xmlns:android
18 |
19 | ^$
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | xmlns:.*
29 |
30 | ^$
31 |
32 |
33 | BY_NAME
34 |
35 |
36 |
37 |
38 |
39 |
40 | .*:id
41 |
42 | http://schemas.android.com/apk/res/android
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | .*:name
52 |
53 | http://schemas.android.com/apk/res/android
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | name
63 |
64 | ^$
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | style
74 |
75 | ^$
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | .*
85 |
86 | ^$
87 |
88 |
89 | BY_NAME
90 |
91 |
92 |
93 |
94 |
95 |
96 | .*
97 |
98 | http://schemas.android.com/apk/res/android
99 |
100 |
101 | ANDROID_ATTRIBUTE_ORDER
102 |
103 |
104 |
105 |
106 |
107 |
108 | .*
109 |
110 | .*
111 |
112 |
113 | BY_NAME
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/workspace.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 | 1618746391137
184 |
185 |
186 | 1618746391137
187 |
188 |
189 | 1618764946591
190 |
191 |
192 |
193 | 1618764946592
194 |
195 |
196 | 1618766202671
197 |
198 |
199 |
200 | 1618766202671
201 |
202 |
203 | 1618766353014
204 |
205 |
206 |
207 | 1618766353014
208 |
209 |
210 | 1618768263682
211 |
212 |
213 |
214 | 1618768263682
215 |
216 |
217 | 1618768671781
218 |
219 |
220 |
221 | 1618768671781
222 |
223 |
224 | 1618769786860
225 |
226 |
227 |
228 | 1618769786860
229 |
230 |
231 | 1618769962218
232 |
233 |
234 |
235 | 1618769962218
236 |
237 |
238 | 1618770175190
239 |
240 |
241 |
242 | 1618770175190
243 |
244 |
245 | 1618855977000
246 |
247 |
248 |
249 | 1618855977000
250 |
251 |
252 | 1619024589030
253 |
254 |
255 |
256 | 1619024589031
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 | file://$PROJECT_DIR$/app/src/main/java/com/rk/progressbutton/MainActivity.kt
346 | 9
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
--------------------------------------------------------------------------------
/ProgressButton/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/ProgressButton/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.library'
3 | id 'kotlin-android'
4 | id 'kotlin-kapt'
5 | id 'kotlin-android-extensions'
6 | }
7 |
8 | android {
9 | compileSdkVersion 30
10 | buildToolsVersion "30.0.3"
11 |
12 | defaultConfig {
13 | minSdkVersion 21
14 | targetSdkVersion 30
15 | versionCode 1
16 | versionName "1.0"
17 |
18 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
19 | consumerProguardFiles "consumer-rules.pro"
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 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
40 | implementation 'androidx.core:core-ktx:1.3.2'
41 | implementation 'androidx.appcompat:appcompat:1.2.0'
42 | implementation 'com.google.android.material:material:1.3.0'
43 | testImplementation 'junit:junit:4.+'
44 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
45 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
46 | }
--------------------------------------------------------------------------------
/ProgressButton/consumer-rules.pro:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/ProgressButton/consumer-rules.pro
--------------------------------------------------------------------------------
/ProgressButton/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/ProgressButton/drawable/btn_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
9 |
10 |
--------------------------------------------------------------------------------
/ProgressButton/drawable/error_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
14 |
--------------------------------------------------------------------------------
/ProgressButton/drawable/ic_done_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/ProgressButton/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/ProgressButton/proguard-rules.pro:
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------
/ProgressButton/src/androidTest/java/com/rk/progressbutton/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.rk.progressbutton.test", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/ProgressButton/src/androidTest/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #F44336
11 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/java/com/rk/progressbutton/RkProgressButton.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import android.content.Context
4 | import android.content.res.ColorStateList
5 | import android.graphics.drawable.Drawable
6 | import android.os.Handler
7 | import android.os.Looper
8 | import android.util.AttributeSet
9 | import android.view.LayoutInflater
10 | import android.view.View
11 | import android.widget.LinearLayout
12 | import androidx.appcompat.content.res.AppCompatResources.getDrawable
13 | import androidx.core.content.res.ResourcesCompat
14 | import androidx.core.widget.ImageViewCompat
15 | import kotlinx.android.synthetic.main.rk_progress.view.*
16 | import kotlin.math.roundToInt
17 |
18 |
19 | /**
20 | * Created by Rahul Kansara (Rk) on 18-Apr-21, rahul.kansara10@gmail.com
21 | */
22 | open class RkProgressButton(context: Context, attrs: AttributeSet?, defStyleAttr: Int) :
23 | LinearLayout(context, attrs, defStyleAttr) {
24 |
25 | init {
26 | initUi(attrs)
27 | }
28 |
29 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0) {
30 | initUi(attrs)
31 | }
32 |
33 | constructor(context: Context) : this(context, null, 0) {
34 | initUi(null)
35 | }
36 |
37 |
38 | private fun initUi(attrs: AttributeSet?) {
39 | val view = LayoutInflater.from(context).inflate(R.layout.rk_progress, this, true)
40 | // setOnClickListener(this)
41 |
42 | buttonImage?.let {
43 | buttonCons?.setImageDrawable(it)
44 | }
45 |
46 | backgroungColor?.let {
47 | if (it != -1) {
48 | ImageViewCompat.setImageTintList(buttonCons, ColorStateList.valueOf(it))
49 | ImageViewCompat.setImageTintList(buttonCons2, ColorStateList.valueOf(it))
50 | }
51 | }
52 |
53 |
54 |
55 |
56 | progressColor?.let {
57 | if (it != -1) {
58 | progressBar2.indeterminateTintList = ColorStateList.valueOf(it)
59 | }
60 | }
61 |
62 | doneColor?.let {
63 | if (it != -1) {
64 | shapeableImageView6.imageTintList = ColorStateList.valueOf(it)
65 | }
66 | }
67 |
68 | textColor?.let {
69 | if (it != -1) {
70 | appCompatTextView.setTextColor(ColorStateList.valueOf(it))
71 | }
72 | }
73 |
74 | customHeight?.let {
75 | if (it != -1f) {
76 | buttonCons.minimumHeight = it.roundToInt()
77 | }
78 | }
79 |
80 | fontFamily?.let {
81 | if (it > 0) {
82 | appCompatTextView.setTypeface(ResourcesCompat.getFont(getContext(), it));
83 | }
84 | }
85 |
86 |
87 |
88 | appCompatTextView?.text = btnText
89 |
90 | clickView!!.setOnClickListener {
91 | if (isClicable) {
92 | event?.onClick(it)
93 | }
94 | }
95 |
96 | inItAttribute(attrs)
97 |
98 | }
99 |
100 | private fun inItAttribute(attrs: AttributeSet?) {
101 | val attrsArray =
102 | context.obtainStyledAttributes(attrs, R.styleable.RkProgressButton, 0, 0)
103 | try {
104 | attrsArray.getDrawable(R.styleable.RkProgressButton_doneDrawable)?.let {
105 | doneImage = it
106 | }
107 |
108 | attrsArray.getDrawable(R.styleable.RkProgressButton_errorDrawable).let {
109 | errorImage = it
110 | }
111 |
112 | attrsArray.getColor(R.styleable.RkProgressButton_buttonColor, -1).let {
113 | backgroungColor = it
114 | }
115 |
116 | attrsArray.getColor(R.styleable.RkProgressButton_buttonSucessColor, -1).let {
117 | bgSucessColor = it
118 | }
119 |
120 | attrsArray.getColor(R.styleable.RkProgressButton_buttonErrorColor, -1).let {
121 | bgErrorColor = it
122 | }
123 |
124 | attrsArray.getColor(R.styleable.RkProgressButton_progressColor, -1).let {
125 | progressColor = it
126 | }
127 | attrsArray.getColor(R.styleable.RkProgressButton_doneColor, -1).let {
128 | doneColor = it
129 | }
130 |
131 | attrsArray.getString(R.styleable.RkProgressButton_buttonText)?.let {
132 | btnText = it
133 | appCompatTextView?.text = btnText
134 | }
135 |
136 | attrsArray.getString(R.styleable.RkProgressButton_buttonErrorText)?.let {
137 | errorText = it
138 | }
139 |
140 | attrsArray.getColor(R.styleable.RkProgressButton_textColor, -1)?.let {
141 | textColor = it
142 | }
143 |
144 | attrsArray.getDimension(R.styleable.RkProgressButton_customHeight, -1f)?.let {
145 | customHeight = it
146 | }
147 |
148 | attrsArray.getString(R.styleable.RkProgressButton_successText)?.let {
149 | successText = it
150 | }
151 |
152 | attrsArray.getResourceId(R.styleable.RkProgressButton_customFont, -1)?.let {
153 | fontFamily = it
154 | }
155 |
156 | attrsArray.getDrawable(R.styleable.RkProgressButton_buttonDrawable)?.let {
157 | buttonImage = it
158 | }
159 |
160 |
161 | } finally {
162 | attrsArray.recycle()
163 | }
164 | }
165 |
166 | var isClicable = true
167 | var doneImage: Drawable? = null
168 | var buttonImage: Drawable? = null
169 | var errorImage: Drawable? = null
170 |
171 | var backgroungColor: Int? = null
172 | var bgSucessColor: Int? = null
173 | var bgErrorColor: Int? = null
174 |
175 | var doneColor: Int? = null
176 | var progressColor: Int? = null
177 | var textColor: Int? = null
178 | var customHeight: Float? = null
179 |
180 | var event: View.OnClickListener? = null
181 | var currentId: Int = R.id.start
182 | var btnText: String? = null
183 | var successText: String? = null
184 | var errorText: String? = null
185 |
186 | var fontFamily: Int? = null
187 |
188 |
189 | fun setOnProgressClickListener(eventq: View.OnClickListener) {
190 | event = eventq
191 | }
192 |
193 |
194 | interface ProgressButtonClickListner {
195 | fun onClick(var1: View?)
196 | }
197 |
198 |
199 | fun progressAnimation() {
200 | backgroungColor?.let {
201 | if (it != -1) {
202 | ImageViewCompat.setImageTintList(buttonCons, ColorStateList.valueOf(it))
203 | ImageViewCompat.setImageTintList(buttonCons2, ColorStateList.valueOf(it))
204 | }
205 | }
206 |
207 | isClicable = false
208 | mainLay!!.setTransition(R.id.start, R.id.end)
209 | mainLay!!.transitionToEnd()
210 | currentId = R.id.end
211 | }
212 |
213 | fun doneAnimation() {
214 | if (doneImage == null) {
215 | doneImage = getDrawable(context, R.drawable.ic_done_img)
216 | }
217 |
218 | btnText?.let {
219 | appCompatTextView?.text = it
220 | }
221 |
222 | successText?.let {
223 | appCompatTextView?.text = it
224 | }
225 |
226 | backgroungColor?.let {
227 | if (it != -1) {
228 | ImageViewCompat.setImageTintList(buttonCons, ColorStateList.valueOf(it))
229 | }
230 | }
231 |
232 | bgSucessColor?.let {
233 | if (it != -1) {
234 | ImageViewCompat.setImageTintList(buttonCons, ColorStateList.valueOf(it))
235 | }
236 | }
237 |
238 |
239 |
240 |
241 | shapeableImageView6?.setImageDrawable(doneImage)
242 |
243 | mainLay!!.setTransition(currentId, R.id.done)
244 | mainLay!!.transitionToEnd()
245 | currentId = R.id.done
246 | Handler(Looper.getMainLooper()).postDelayed({
247 | mainLay!!.setTransition(R.id.done, R.id.start)
248 | mainLay!!.transitionToEnd()
249 | isClicable = true
250 | }, 1500)
251 | }
252 |
253 | fun errorAnimation() {
254 | if (errorImage == null) {
255 | errorImage = getDrawable(context, R.drawable.error_image)
256 | }
257 |
258 |
259 | bgErrorColor?.let {
260 | if (it != -1) {
261 | ImageViewCompat.setImageTintList(buttonCons, ColorStateList.valueOf(it))
262 | ImageViewCompat.setImageTintList(buttonCons2, ColorStateList.valueOf(it))
263 | }
264 | }
265 |
266 | errorText?.let {
267 | appCompatTextView.text = it
268 | }
269 |
270 | shapeableImageView6?.setImageDrawable(errorImage)
271 | mainLay!!.setTransition(currentId, R.id.done)
272 | mainLay!!.transitionToEnd()
273 | currentId = R.id.done
274 | Handler(Looper.getMainLooper()).postDelayed({
275 | mainLay!!.setTransition(R.id.done, R.id.start)
276 | mainLay!!.transitionToEnd()
277 | currentId = R.id.start
278 | isClicable = true
279 | }, 1500)
280 | }
281 |
282 |
283 | fun stopAnimation() {
284 | btnText?.let {
285 | appCompatTextView.text = it
286 | }
287 |
288 | mainLay!!.setTransition(currentId, R.id.start)
289 | mainLay!!.transitionToEnd()
290 | currentId = R.id.start
291 | isClicable = true
292 | }
293 | }
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/drawable/btn_drawable.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/drawable/error_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
14 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/drawable/ic_done_img.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/layout/rk_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
16 |
26 |
27 |
43 |
44 |
45 |
46 |
54 |
55 |
71 |
72 |
73 |
74 |
75 |
85 |
86 |
87 |
99 |
100 |
114 |
115 |
125 |
126 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFF
4 | #F44336
5 |
--------------------------------------------------------------------------------
/ProgressButton/src/main/res/xml/rk_progress_scene.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
15 |
16 |
17 |
18 |
27 |
36 |
46 |
55 |
56 |
57 |
58 |
59 |
68 |
69 |
77 |
78 |
88 |
97 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
120 |
121 |
130 |
140 |
149 |
158 |
159 |
160 |
161 |
162 |
--------------------------------------------------------------------------------
/ProgressButton/src/test/java/com/rk/progressbutton/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 | # Android Animated Progress Button
5 | ##
6 |
7 | Animated Progress Loding Button with multiple functionality.
8 |
9 | - Loading Animation
10 | - Error Animation
11 | - Success Animation
12 |
13 |
14 | ## Features
15 | - Custom Button Drawable
16 | - Custom Button Color
17 | - Custom Progress Color
18 | - Custom Success Icon
19 | - Custom Error Icon
20 | - Custom Button Success Color
21 | - Custom Button Error Color
22 | - Change Text Color
23 | - Custom Font Style
24 |
25 | - No Additional Code Required
26 | - Fully Customizable
27 | - Easy to Implement
28 |
29 | ## Code Sample
30 | - Xml
31 |
32 | ```sh
33 |
46 | ```
47 |
48 | * Start Progress Animation
49 | ```sh
50 | progressButton.progressAnimation()
51 | ```
52 | * Success Animation
53 | ```sh
54 | progressButton.doneAnimation()
55 | ```
56 | * Error Animation
57 | ```sh
58 | progressButton.errorAnimation()
59 | ```
60 | * Stop Animation
61 | ```sh
62 | progressButton.stopAnimation()
63 | ```
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 | ## Gradle dependency
72 |
73 | ```sh
74 | dependencies {
75 | implementation 'com.github.smartrk:ProgressButton:1.4'
76 | }
77 | ```
78 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | id 'kotlin-kapt'
5 | id 'kotlin-android-extensions'
6 |
7 | }
8 |
9 | android {
10 | compileSdkVersion 30
11 | buildToolsVersion "30.0.3"
12 |
13 | defaultConfig {
14 | applicationId "com.rk.progressbutton"
15 | minSdkVersion 21
16 | targetSdkVersion 30
17 | versionCode 1
18 | versionName "1.0"
19 |
20 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
21 | }
22 |
23 | buildTypes {
24 | release {
25 | minifyEnabled false
26 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
27 | }
28 | }
29 | compileOptions {
30 | sourceCompatibility JavaVersion.VERSION_1_8
31 | targetCompatibility JavaVersion.VERSION_1_8
32 | }
33 | kotlinOptions {
34 | jvmTarget = '1.8'
35 | }
36 | }
37 |
38 | dependencies {
39 |
40 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
41 | implementation 'androidx.core:core-ktx:1.3.2'
42 | implementation 'androidx.appcompat:appcompat:1.2.0'
43 | implementation 'com.google.android.material:material:1.3.0'
44 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
45 | implementation project(path: ':ProgressButton')
46 | testImplementation 'junit:junit:4.+'
47 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
48 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
49 |
50 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
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/androidTest/java/com/rk/progressbutton/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.rk.progressbutton", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/com/rk/progressbutton/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import android.os.Handler
6 | import android.os.Looper
7 | import android.view.View
8 | import kotlinx.android.synthetic.main.activity_main.*
9 |
10 | class MainActivity : AppCompatActivity() {
11 | var defultState = false
12 | var defult2State = false
13 | var changeColorState = false
14 | var iconState = false
15 | var heightState = false
16 | var customeDrawableButtonState = false
17 | override fun onCreate(savedInstanceState: Bundle?) {
18 | super.onCreate(savedInstanceState)
19 | setContentView(R.layout.activity_main)
20 |
21 | defultBtn.setOnProgressClickListener({
22 | defultState = !defultState
23 | perfomDefultBtn(defultState, defultBtn)
24 | })
25 |
26 | defult2Btn.setOnProgressClickListener({
27 | defult2State = !defult2State
28 | perfomDefultBtn(defult2State, defult2Btn)
29 | })
30 |
31 | changeColorBtn.setOnProgressClickListener({
32 | changeColorState = !changeColorState
33 | perfomDefultBtn(changeColorState, changeColorBtn)
34 | })
35 |
36 | iconBtn.setOnProgressClickListener({
37 | iconState = !iconState
38 | perfomDefultBtn(iconState, iconBtn)
39 | })
40 |
41 | heightBtn.setOnProgressClickListener({
42 | heightState = !heightState
43 | perfomDefultBtn(heightState, heightBtn)
44 | })
45 |
46 | customeDrawableButton.setOnProgressClickListener({
47 | customeDrawableButtonState = !customeDrawableButtonState
48 | perfomDefultBtn(customeDrawableButtonState, customeDrawableButton)
49 | })
50 |
51 |
52 |
53 | }
54 |
55 |
56 | private fun perfomDefultBtn(state: Boolean, btn: RkProgressButton) {
57 | if (state) {
58 | btn.progressAnimation()
59 | Handler(Looper.getMainLooper()).postDelayed({
60 | btn.errorAnimation()
61 | }, 2000)
62 | } else {
63 | btn.progressAnimation()
64 | Handler(Looper.getMainLooper()).postDelayed({
65 | btn.doneAnimation()
66 | }, 2000)
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_done_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
14 |
17 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_error_icon.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
11 |
14 |
17 |
20 |
23 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/font/bold.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/font/bold.TTF
--------------------------------------------------------------------------------
/app/src/main/res/font/medium.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/font/medium.TTF
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
22 |
23 |
24 |
29 |
30 |
33 |
34 |
35 |
44 |
45 |
48 |
49 |
58 |
59 |
62 |
63 |
73 |
74 |
77 |
78 |
91 |
92 |
95 |
96 |
97 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #F44336
4 | #F44336
5 | #F44336
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #F44336
11 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | RkProgressButton
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/test/java/com/rk/progressbutton/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.rk.progressbutton
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = "1.4.31"
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath "com.android.tools.build:gradle:4.1.3"
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 |
12 | // NOTE: Do not place your application dependencies here; they belong
13 | // in the individual module build.gradle files
14 | }
15 | }
16 |
17 | allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | }
22 | }
23 |
24 | task clean(type: Delete) {
25 | delete rootProject.buildDir
26 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smartrk/AndroidLoadingButton/886ebe431bb9443632874d3ab5118be2e458cfa8/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Apr 18 17:16:37 IST 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':ProgressButton'
2 | include ':app'
3 | rootProject.name = "RkProgressButton"
--------------------------------------------------------------------------------