Skip to content

Commit dfe7afb

Browse files
Now the app shows the max speed correctly
1 parent a784058 commit dfe7afb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/src/main/kotlin/com/d4rk/netprobe/ui/speedtest/SpeedTestViewModel.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ class SpeedTestViewModel(application: Application) : AndroidViewModel(applicatio
6060
ping.value = getPing()
6161
wifiStrength.value =
6262
getWifiStrength(getApplication()).toString()
63-
maxSpeed.value = maxOf(
64-
maxSpeed.value?.toFloatOrNull() ?: 0f,
65-
downloadSpeed.floatValue
66-
).toString()
6763
}
6864
}
6965

@@ -78,6 +74,12 @@ class SpeedTestViewModel(application: Application) : AndroidViewModel(applicatio
7874
} else {
7975
scanProgresses.add(scanProgress)
8076
}
77+
val currentSpeed = calculateSpeed(currentBytes, startTime)
78+
downloadSpeed.floatValue = currentSpeed
79+
maxSpeed.value = "%.1f".format(maxOf(
80+
maxSpeed.value?.toFloatOrNull() ?: 0f,
81+
currentSpeed
82+
))
8183
downloadSpeed.floatValue = calculateSpeed(currentBytes, startTime)
8284
}
8385
}

0 commit comments

Comments
 (0)