Skip to content

Commit 437df77

Browse files
GeniusRUSVOLixanov
authored andcommitted
- fix: fix behavior on changing steps
- refactor: added required attribute to activity in AndroidManifest.xml
1 parent c507b16 commit 437df77

3 files changed

Lines changed: 21 additions & 9 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
12-
<activity android:name=".MainActivity">
12+
<activity
13+
android:name=".MainActivity"
14+
android:exported="true">
1315
<intent-filter>
1416
<action android:name="android.intent.action.MAIN"/>
15-
1617
<category android:name="android.intent.category.LAUNCHER"/>
1718
</intent-filter>
1819
</activity>

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ android.nonTransitiveRClass=true
2424

2525
GROUP=io.github.geniusrus
2626
POM_ARTIFACT_ID=multiprogressbar
27-
VERSION_NAME=1.3.1
27+
VERSION_NAME=1.3.2
2828

2929
POM_NAME=MultiProgressBar
3030
POM_DESCRIPTION=Android library for multiple displays of progress like Instagram Stories

multiprogressbar/src/main/java/com/genius/multiprogressbar/MultiProgressBar.kt

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -394,17 +394,28 @@ class MultiProgressBar @JvmOverloads constructor(
394394
val value = animator.animatedValue as Float
395395
isProgressIsRunning = value != maxValue
396396

397-
if ((value / progressPercents).toInt() != displayedStepForListener && value != maxValue) {
397+
val isStepChange = if ((value / progressPercents).toInt() != displayedStepForListener && value != maxValue) {
398398
displayedStepForListener = (value / progressPercents).toInt()
399+
currentAbsoluteProgress = displayedStepForListener * progressPercents.toFloat()
400+
animatedAbsoluteProgress = displayedStepForListener * progressPercents.toFloat()
399401
stepChangeListener?.onProgressStepChange(displayedStepForListener)
402+
true
400403
} else if (value == maxValue) {
404+
currentAbsoluteProgress = maxValue
405+
animatedAbsoluteProgress = maxValue
401406
finishListener?.onProgressFinished()
402-
}
403-
404-
if (isProgressIsRunning) {
405-
currentAbsoluteProgress = value.coerceAtMost(countOfProgressSteps * progressPercents.toFloat())
407+
true
408+
} else false
409+
410+
if (value != maxValue) {
411+
if (!isStepChange) {
412+
currentAbsoluteProgress =
413+
value.coerceAtMost(countOfProgressSteps * progressPercents.toFloat())
414+
}
406415
invalidate()
407-
animatedAbsoluteProgress = value
416+
if (!isStepChange) {
417+
animatedAbsoluteProgress = value
418+
}
408419
} else {
409420
animator.removeAllUpdateListeners()
410421
animatedAbsoluteProgress = 0F

0 commit comments

Comments
 (0)