From d6e49be26894acfad71b529562e3fd12e5a5d2e5 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 20 Apr 2020 23:10:10 -0400 Subject: [PATCH] Remove some progress dialogs --- .../ui/manga/chapter/ChaptersController.kt | 8 --- .../manga/chapter/DeletingChaptersDialog.kt | 26 ---------- .../recent/updates/DeletingChaptersDialog.kt | 26 ---------- .../ui/recent/updates/UpdatesController.kt | 11 ---- .../ui/setting/SettingsAdvancedController.kt | 52 +++---------------- app/src/main/res/values/strings.xml | 1 - 6 files changed, 6 insertions(+), 118 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/DeletingChaptersDialog.kt delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/DeletingChaptersDialog.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt index 47b22fa18..2b188b3bc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/chapter/ChaptersController.kt @@ -24,7 +24,6 @@ import eu.kanade.tachiyomi.data.database.models.Manga import eu.kanade.tachiyomi.data.download.model.Download import eu.kanade.tachiyomi.databinding.ChaptersControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController -import eu.kanade.tachiyomi.ui.base.controller.popControllerWithTag import eu.kanade.tachiyomi.ui.manga.MangaController import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.util.lang.launchInUI @@ -504,12 +503,10 @@ class ChaptersController : NucleusController) { if (chapters.isEmpty()) return - DeletingChaptersDialog().showDialog(router) presenter.deleteChapters(chapters) } fun onChaptersDeleted(chapters: List) { - dismissDeletingDialog() // this is needed so the downloaded text gets removed from the item chapters.forEach { adapter?.updateItem(it) @@ -518,14 +515,9 @@ class ChaptersController : NucleusController) { - DeletingChaptersDialog().showDialog(router) presenter.deleteChapters(chaptersToDelete) } @@ -286,7 +284,6 @@ class UpdatesController : NucleusController if (chapterCache.removeFileFromCache(file.name)) { @@ -129,50 +124,15 @@ class SettingsAdvancedController : SettingsController() { } .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) - .subscribe({ - ctrl.setProgress(deletedFiles) - }, { + .doOnError { activity?.toast(R.string.cache_delete_error) - }, { - ctrl.finish() + } + .doOnCompleted { activity?.toast(resources?.getString(R.string.cache_deleted, deletedFiles)) findPreference(CLEAR_CACHE_KEY)?.summary = - resources?.getString(R.string.used_cache, chapterCache.readableSize) - }) - } - - class DeletingFilesDialogController : DialogController() { - - var total = 0 - - private var materialDialog: MaterialDialog? = null - - override fun onCreateDialog(savedViewState: Bundle?): Dialog { - return MaterialDialog.Builder(activity!!) - .title(R.string.deleting) - .progress(false, total, true) - .cancelable(false) - .build() - .also { materialDialog = it } - } - - override fun onDestroyView(view: View) { - super.onDestroyView(view) - materialDialog = null - } - - override fun onRestoreInstanceState(savedInstanceState: Bundle) { - super.onRestoreInstanceState(savedInstanceState) - finish() - } - - fun setProgress(deletedFiles: Int) { - materialDialog?.setProgress(deletedFiles) - } - - fun finish() { - router.popController(this) - } + resources?.getString(R.string.used_cache, chapterCache.readableSize) + } + .subscribe() } class ClearDatabaseDialogController : DialogController() { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 46548af6a..7c2293040 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -112,7 +112,6 @@ Refresh - Deleting… Loading…