Skip to content

Commit 9ea6d31

Browse files
author
Parminder Saini
committed
setStatusList dynamic working fixed
1 parent 9b95ec0 commit 9ea6d31

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stepview/src/main/java/params/com/stepview/StatusView.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,11 @@ class StatusView @JvmOverloads constructor(
372372
*/
373373
fun setStatusList(list: List<String>) {
374374
//to make sure original list is not modified convert to mutableList
375-
val input = list.toMutableList().dropLast(stepCount)
375+
val input = list.toMutableList()
376+
if (stepCount > 0 && list.size - stepCount > 0) {
377+
input.dropLast(list.size - stepCount)
378+
}
379+
376380

377381
statusData = (input.map { StatusInfo(it) }).toMutableList()
378382

@@ -638,7 +642,7 @@ class StatusView @JvmOverloads constructor(
638642

639643
val circleAndStatusTextHeight = if (isShowingCurrentStatus()) {
640644
val topRadius = currentStatusRadius
641-
val labelHeightCurrentStatus = if (statusData.size > 0 && currentCountIndex() in 0..statusData.size) {
645+
val labelHeightCurrentStatus = if (statusData.size > 0 && currentCountIndex() in 0..(statusData.size-1)) {
642646
statusData[currentCountIndex()].height
643647
} else {
644648
0.0f

0 commit comments

Comments
 (0)