Show download progress in MoreController
This commit is contained in:
parent
6a3cd0054b
commit
1972cc25a9
2 changed files with 21 additions and 0 deletions
|
@ -5,6 +5,7 @@ import android.util.AttributeSet
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceScreen
|
import androidx.preference.PreferenceScreen
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
|
import eu.kanade.tachiyomi.data.download.DownloadManager
|
||||||
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
import eu.kanade.tachiyomi.ui.base.controller.NoToolbarElevationController
|
||||||
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
import eu.kanade.tachiyomi.ui.base.controller.RootController
|
||||||
|
@ -25,12 +26,15 @@ import eu.kanade.tachiyomi.util.preference.titleRes
|
||||||
import eu.kanade.tachiyomi.util.system.getResourceColor
|
import eu.kanade.tachiyomi.util.system.getResourceColor
|
||||||
import eu.kanade.tachiyomi.util.system.openInBrowser
|
import eu.kanade.tachiyomi.util.system.openInBrowser
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
class MoreController :
|
class MoreController :
|
||||||
SettingsController(),
|
SettingsController(),
|
||||||
RootController,
|
RootController,
|
||||||
NoToolbarElevationController {
|
NoToolbarElevationController {
|
||||||
|
|
||||||
|
private val downloadManager: DownloadManager by injectLazy()
|
||||||
|
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) = with(screen) {
|
||||||
titleRes = R.string.label_more
|
titleRes = R.string.label_more
|
||||||
|
|
||||||
|
@ -49,6 +53,19 @@ class MoreController :
|
||||||
preferenceCategory {
|
preferenceCategory {
|
||||||
preference {
|
preference {
|
||||||
titleRes = R.string.label_download_queue
|
titleRes = R.string.label_download_queue
|
||||||
|
|
||||||
|
if (downloadManager.queue.isNotEmpty()) {
|
||||||
|
downloadManager.queue.getUpdatedObservable()
|
||||||
|
.doOnNext {
|
||||||
|
summary = if (it.isNullOrEmpty()) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
resources?.getQuantityString(R.plurals.download_queue_summary, it.size, it.size)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.subscribe()
|
||||||
|
}
|
||||||
|
|
||||||
iconRes = R.drawable.ic_file_download_black_24dp
|
iconRes = R.drawable.ic_file_download_black_24dp
|
||||||
iconTint = tintColor
|
iconTint = tintColor
|
||||||
onClick {
|
onClick {
|
||||||
|
|
|
@ -366,6 +366,10 @@
|
||||||
<!-- More -->
|
<!-- More -->
|
||||||
<string name="label_downloaded_only">Downloaded only</string>
|
<string name="label_downloaded_only">Downloaded only</string>
|
||||||
<string name="downloaded_only_summary">Filters all manga in your library</string>
|
<string name="downloaded_only_summary">Filters all manga in your library</string>
|
||||||
|
<plurals name="download_queue_summary">
|
||||||
|
<item quantity="one">1 remaining</item>
|
||||||
|
<item quantity="other">%1$s remaining</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
|
|
||||||
<!-- Login dialog -->
|
<!-- Login dialog -->
|
||||||
|
|
Reference in a new issue