Allow disabling download speed check
This commit is contained in:
1 parent
a1a204d0d5
commit
83085d5f9a
2 files changed
+5
-4
No files matched your search
@@ -104,7 +104,9 @@ suspend inline fun <R> timeoutBySpeed(
|
||||
}
|
||||
}
|
||||
|
||||
fun speedLevelToSpeed(level: Int) = 2f.pow(level).roundToInt()
|
||||
const val MIN_SPEED_LEVEL = 3
|
||||
|
||||
fun speedLevelToSpeed(level: Int) = if (level == MIN_SPEED_LEVEL) 0 else 2f.pow(level).roundToInt()
|
||||
|
||||
inline fun <T, R> MutableObjectIntMap<T>.fold(initial: R, operation: (acc: R, T, Int) -> R): R {
|
||||
var accumulator = initial
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.hippo.ehviewer.download.DownloadManager
|
||||
import com.hippo.ehviewer.download.downloadDir
|
||||
import com.hippo.ehviewer.download.downloadLocation
|
||||
import com.hippo.ehviewer.spider.COMIC_INFO_FILE
|
||||
import com.hippo.ehviewer.spider.MIN_SPEED_LEVEL
|
||||
import com.hippo.ehviewer.spider.SpiderDen
|
||||
import com.hippo.ehviewer.spider.SpiderQueen.Companion.SPIDER_INFO_FILENAME
|
||||
import com.hippo.ehviewer.spider.readComicInfo
|
||||
@@ -193,14 +194,12 @@ fun AnimatedVisibilityScope.DownloadScreen(navigator: DestinationsNavigator) = S
|
||||
IntSliderPreference(
|
||||
maxValue = 10,
|
||||
minValue = 2,
|
||||
step = 7,
|
||||
title = stringResource(id = R.string.settings_download_connection_timeout),
|
||||
state = Settings.connTimeout.asMutableState(),
|
||||
)
|
||||
IntSliderPreference(
|
||||
maxValue = 10,
|
||||
minValue = 4,
|
||||
step = 5,
|
||||
minValue = MIN_SPEED_LEVEL,
|
||||
title = stringResource(id = R.string.settings_download_timeout_speed),
|
||||
state = Settings.timeoutSpeed.asMutableState(),
|
||||
display = ::speedLevelToSpeed,
|
||||
|
||||
Reference in new issue
Block a user