mirror of
https://github.com/amir1376/ab-download-manager.git
synced 2025-02-20 11:43:24 +08:00
Merge pull request #209 from amir1376/feature/add-auto-show-progress-dialog
add auto show download progress dialog option
This commit is contained in:
commit
c4e608fb6f
@ -534,6 +534,11 @@ class AppComponent(
|
||||
openDownloadDialog(it.downloadItem.id)
|
||||
}
|
||||
}
|
||||
if (it is DownloadManagerEvents.OnJobStarting) {
|
||||
if (appSettings.autoShowDownloadProgressDialog.value) {
|
||||
openDownloadDialog(it.downloadItem.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun openDownloadItem(id: Long) {
|
||||
|
@ -117,6 +117,17 @@ fun showDownloadFinishWindow(settingsStorage: AppSettingsStorage): BooleanConfig
|
||||
)
|
||||
}
|
||||
|
||||
fun autoShowDownloadProgressWindow(settingsStorage: AppSettingsStorage): BooleanConfigurable {
|
||||
return BooleanConfigurable(
|
||||
title = Res.string.settings_show_download_progress_dialog.asStringSource(),
|
||||
description = Res.string.settings_show_download_progress_dialog_description.asStringSource(),
|
||||
backedBy = settingsStorage.autoShowDownloadProgressDialog,
|
||||
describe = {
|
||||
(if (it) Res.string.enabled else Res.string.disabled).asStringSource()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
fun speedLimitConfig(appRepository: AppRepository): SpeedLimitConfigurable {
|
||||
return SpeedLimitConfigurable(
|
||||
title = Res.string.settings_global_speed_limiter.asStringSource(),
|
||||
@ -385,6 +396,7 @@ class SettingsComponent(
|
||||
speedLimitConfig(appRepository),
|
||||
threadCountConfig(appRepository),
|
||||
dynamicPartDownloadConfig(appRepository),
|
||||
autoShowDownloadProgressWindow(appSettings),
|
||||
showDownloadFinishWindow(appSettings),
|
||||
useServerLastModified(appRepository),
|
||||
useSparseFileAllocation(appRepository),
|
||||
|
@ -21,6 +21,7 @@ data class AppSettingsModel(
|
||||
val useServerLastModifiedTime: Boolean = false,
|
||||
val useSparseFileAllocation: Boolean = true,
|
||||
val useAverageSpeed: Boolean = true,
|
||||
val autoShowDownloadProgressDialog: Boolean = true,
|
||||
val showCompletionDialog: Boolean = true,
|
||||
val speedLimit: Long = 0,
|
||||
val autoStartOnBoot: Boolean = true,
|
||||
@ -45,6 +46,7 @@ data class AppSettingsModel(
|
||||
val useServerLastModifiedTime = booleanKeyOf("useServerLastModifiedTime")
|
||||
val useSparseFileAllocation = booleanKeyOf("useSparseFileAllocation")
|
||||
val useAverageSpeed = booleanKeyOf("useAverageSpeed")
|
||||
val autoShowDownloadProgressDialog = booleanKeyOf("autoShowDownloadProgressDialog")
|
||||
val showCompletionDialog = booleanKeyOf("showCompletionDialog")
|
||||
val speedLimit = longKeyOf("speedLimit")
|
||||
val autoStartOnBoot = booleanKeyOf("autoStartOnBoot")
|
||||
@ -68,6 +70,8 @@ data class AppSettingsModel(
|
||||
?: default.useServerLastModifiedTime,
|
||||
useSparseFileAllocation = source.get(Keys.useSparseFileAllocation) ?: default.useSparseFileAllocation,
|
||||
useAverageSpeed = source.get(Keys.useAverageSpeed) ?: default.useAverageSpeed,
|
||||
autoShowDownloadProgressDialog = source.get(Keys.autoShowDownloadProgressDialog)
|
||||
?: default.autoShowDownloadProgressDialog,
|
||||
showCompletionDialog = source.get(Keys.showCompletionDialog)
|
||||
?: default.showCompletionDialog,
|
||||
speedLimit = source.get(Keys.speedLimit) ?: default.speedLimit,
|
||||
@ -90,6 +94,7 @@ data class AppSettingsModel(
|
||||
put(Keys.useServerLastModifiedTime, focus.useServerLastModifiedTime)
|
||||
put(Keys.useSparseFileAllocation, focus.useSparseFileAllocation)
|
||||
put(Keys.useAverageSpeed, focus.useAverageSpeed)
|
||||
put(Keys.autoShowDownloadProgressDialog, focus.autoShowDownloadProgressDialog)
|
||||
put(Keys.showCompletionDialog, focus.showCompletionDialog)
|
||||
put(Keys.speedLimit, focus.speedLimit)
|
||||
put(Keys.autoStartOnBoot, focus.autoStartOnBoot)
|
||||
@ -115,6 +120,7 @@ class AppSettingsStorage(
|
||||
val useServerLastModifiedTime = from(AppSettingsModel.useServerLastModifiedTime)
|
||||
val useSparseFileAllocation = from(AppSettingsModel.useSparseFileAllocation)
|
||||
val useAverageSpeed = from(AppSettingsModel.useAverageSpeed)
|
||||
val autoShowDownloadProgressDialog = from(AppSettingsModel.autoShowDownloadProgressDialog)
|
||||
val showCompletionDialog = from(AppSettingsModel.showCompletionDialog)
|
||||
val speedLimit = from(AppSettingsModel.speedLimit)
|
||||
val autoStartOnBoot = from(AppSettingsModel.autoStartOnBoot)
|
||||
|
@ -208,6 +208,8 @@ settings_dynamic_part_creation=Dynamic part creation
|
||||
settings_dynamic_part_creation_description=When a part is finished create another part by splitting other parts to improve download speed
|
||||
settings_show_completion_dialog=Show Download Completion dialog
|
||||
settings_show_completion_dialog_description=Automatically show "Download Completion" dialog when a download finished
|
||||
settings_show_download_progress_dialog=Show Download Progress dialog
|
||||
settings_show_download_progress_dialog_description=Automatically show "Download Progress" dialog when a download started
|
||||
download_item_settings_speed_limit=Speed Limit
|
||||
download_item_settings_speed_limit_description=Limit download speed for this item
|
||||
download_item_settings_show_completion_dialog=Show Completion dialog
|
||||
|
Loading…
x
Reference in New Issue
Block a user