mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Migrations now shows how many manual migrations were made after skipping the rest
(cherry picked from commit bac01c98073dbee6c09144b6ebc55b6a0d56d0da)
This commit is contained in:
		| @@ -17,7 +17,6 @@ import com.afollestad.materialdialogs.MaterialDialog | ||||
| import eu.kanade.tachiyomi.R | ||||
| import eu.kanade.tachiyomi.data.database.DatabaseHelper | ||||
| import eu.kanade.tachiyomi.data.database.models.Manga | ||||
| import eu.kanade.tachiyomi.data.database.models.MangaImpl | ||||
| import eu.kanade.tachiyomi.data.preference.PreferencesHelper | ||||
| import eu.kanade.tachiyomi.data.preference.getOrDefault | ||||
| import eu.kanade.tachiyomi.smartsearch.SmartSearchEngine | ||||
| @@ -57,8 +56,6 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), | ||||
|         setHasOptionsMenu(true) | ||||
|     } | ||||
|  | ||||
|     private var titleText = "Migrate manga" | ||||
|  | ||||
|     private var adapter: MigrationProcessAdapter? = null | ||||
|  | ||||
|     override val coroutineContext: CoroutineContext = Job() + Dispatchers.Default | ||||
| @@ -74,13 +71,14 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), | ||||
|     private var migrationsJob: Job? = null | ||||
|     private var migratingManga: MutableList<MigratingManga>? = null | ||||
|     private var selectedPosition: Int? = null | ||||
|     private var manaulMigrations = 0 | ||||
|  | ||||
|     override fun inflateView(inflater: LayoutInflater, container: ViewGroup): View { | ||||
|         return inflater.inflate(R.layout.migration_list_controller, container, false) | ||||
|     } | ||||
|  | ||||
|     override fun getTitle(): String { | ||||
|         return titleText | ||||
|     override fun getTitle(): String? { | ||||
|         return resources?.getString(R.string.migration) | ||||
|     } | ||||
|  | ||||
|     override fun onViewCreated(view: View) { | ||||
| @@ -269,7 +267,16 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), | ||||
|  | ||||
|     override fun noMigration() { | ||||
|         launchUI { | ||||
|             activity?.toast(R.string.no_migrations) | ||||
|             val res = resources | ||||
|             if (res != null) { | ||||
|                 activity?.toast( | ||||
|                     res.getString( | ||||
|                         R.string.x_migrations, | ||||
|                         if (manaulMigrations == 0) res.getString(R.string.no) | ||||
|                         else "$manaulMigrations" | ||||
|                     ) | ||||
|                 ) | ||||
|             } | ||||
|             router.popCurrentController() | ||||
|         } | ||||
|     } | ||||
| @@ -287,8 +294,14 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), | ||||
|                 } | ||||
|             } | ||||
|             R.id.action_skip -> adapter?.removeManga(position) | ||||
|             R.id.action_migrate_now -> adapter?.migrateManga(position, false) | ||||
|             R.id.action_copy_now -> adapter?.migrateManga(position, true) | ||||
|             R.id.action_migrate_now -> { | ||||
|                 adapter?.migrateManga(position, false) | ||||
|                 manaulMigrations++ | ||||
|             } | ||||
|             R.id.action_copy_now -> { | ||||
|                 adapter?.migrateManga(position, true) | ||||
|                 manaulMigrations++ | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -375,12 +388,12 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle), | ||||
|     } | ||||
|  | ||||
|     override fun onOptionsItemSelected(item: MenuItem): Boolean { | ||||
|         val itemsCount = adapter?.itemCount ?: 0 | ||||
|         val mangasSkipped = adapter?.mangasSkipped() ?: 0 | ||||
|         val totalManga = adapter?.itemCount ?: 0 | ||||
|         val mangaSkipped = adapter?.mangasSkipped() ?: 0 | ||||
|         when (item.itemId) { | ||||
|             R.id.action_copy_manga -> MigrationMangaDialog(this, true, itemsCount, mangasSkipped) | ||||
|             R.id.action_copy_manga -> MigrationMangaDialog(this, true, totalManga, mangaSkipped) | ||||
|                 .showDialog(router) | ||||
|             R.id.action_migrate_manga -> MigrationMangaDialog(this, false, itemsCount, mangasSkipped) | ||||
|             R.id.action_migrate_manga -> MigrationMangaDialog(this, false, totalManga, mangaSkipped) | ||||
|                 .showDialog(router) | ||||
|             else -> return super.onOptionsItemSelected(item) | ||||
|         } | ||||
|   | ||||
| @@ -16,7 +16,6 @@ import eu.kanade.tachiyomi.util.preference.onChange | ||||
| import eu.kanade.tachiyomi.util.preference.onClick | ||||
| import eu.kanade.tachiyomi.util.preference.preference | ||||
| import eu.kanade.tachiyomi.util.preference.preferenceCategory | ||||
| import eu.kanade.tachiyomi.util.preference.summaryRes | ||||
| import eu.kanade.tachiyomi.util.preference.switchPreference | ||||
| import eu.kanade.tachiyomi.util.preference.titleRes | ||||
| import eu.kanade.tachiyomi.util.system.LocaleHelper | ||||
| @@ -192,16 +191,6 @@ class SettingsGeneralController : SettingsController() { | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources() | ||||
|                 .getOrDefault().isNotEmpty()) { | ||||
|             switchPreference { | ||||
|                 key = Keys.skipPreMigration | ||||
|                 titleRes = R.string.pref_skip_pre_migration | ||||
|                 summaryRes = R.string.pref_skip_pre_migration_summary | ||||
|                 defaultValue = false | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         // --> EXH | ||||
|         switchPreference { | ||||
|             key = Keys.eh_expandFilters | ||||
|   | ||||
| @@ -210,6 +210,15 @@ class SettingsLibraryController : SettingsController() { | ||||
|                     true | ||||
|                 } | ||||
|             } | ||||
|             if (preferences.skipPreMigration().getOrDefault() || preferences.migrationSources() | ||||
|                     .getOrDefault().isNotEmpty()) { | ||||
|                 switchPreference { | ||||
|                     key = Keys.skipPreMigration | ||||
|                     titleRes = R.string.pref_skip_pre_migration | ||||
|                     summaryRes = R.string.pref_skip_pre_migration_summary | ||||
|                     defaultValue = false | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -21,8 +21,8 @@ | ||||
|     <string name="label_categories">Categories</string> | ||||
|     <string name="label_backup">Backup</string> | ||||
|     <string name="label_migration">Source migration</string> | ||||
|     <string name="label_reorganize_by">Re-order</string> | ||||
|     <string name="label_alpha_reverse">Alphabetically (descending)</string> | ||||
|     <string name="label_reorganize_by">Reorder</string> | ||||
|     <string name="label_alpha_reverse">Alpha. (descending)</string> | ||||
|     <string name="label_hide_title">Hide title</string> | ||||
|     <string name="label_show_title">Show title</string> | ||||
|     <string name="label_extensions">Extensions</string> | ||||
| @@ -48,8 +48,8 @@ | ||||
|     <string name="action_sort_latest_chapter">Latest chapter</string> | ||||
|     <string name="action_sort_drag_and_drop">Drag & Drop</string> | ||||
|     <string name="action_search">Search</string> | ||||
|     <string name="action_skip_manga">Don\'t migrate</string> | ||||
|     <string name="action_global_search">Global search</string> | ||||
|     <string name="action_skip_manga">Skip manga</string> | ||||
|     <string name="action_select_all">Select all</string> | ||||
|     <string name="action_select_inverse">Select inverse</string> | ||||
|     <string name="action_mark_as_read">Mark as read</string> | ||||
| @@ -488,10 +488,11 @@ | ||||
|     <string name="download_unread">Unread</string> | ||||
|     <string name="confirm_delete_chapters">Are you sure you want to delete the selected chapters?</string> | ||||
|     <string name="invalid_download_dir">Invalid download location</string> | ||||
|     <string name="confirm_migration">Migrate %1$d%2$s mangas?</string> | ||||
|     <string name="confirm_copy">Copy %1$d%2$s mangas?</string> | ||||
|     <string name="confirm_migration">Migrate %1$d%2$s manga?</string> | ||||
|     <string name="confirm_copy">Copy %1$d%2$s manga?</string> | ||||
|     <string name="skipping_x">(skipping %1$d)</string> | ||||
|     <string name="no_migrations">No manga migrated</string> | ||||
|     <string name="x_migrations">%1$s manga migrated</string> | ||||
|     <string name="no">No</string> | ||||
|     <string name="error_fetching_migration">No chapters found, this manga cannot be used for | ||||
|         migration</string> | ||||
|     <string name="no_alternatives_found">No Alternatives Found</string> | ||||
| @@ -571,6 +572,7 @@ | ||||
|     <string name="migrate">Migrate</string> | ||||
|     <string name="copy">Copy</string> | ||||
|     <string name="migrating">Migrating…</string> | ||||
|     <string name="migration">Migration</string> | ||||
|     <string name="latest_x">Latest: %1$s</string> | ||||
|  | ||||
|     <!-- Downloads activity and service --> | ||||
| @@ -667,7 +669,7 @@ | ||||
|     <string name="use_most_chapters">Use source with the most chapters (slower)</string> | ||||
|     <string name="use_first_source">Use first source with alternative</string> | ||||
|     <string name="skip_this_step_next_time">Skip this step next time</string> | ||||
|     <string name="pre_migration_skip_toast">To show this screen again, go to Settings -> General.</string> | ||||
|     <string name="pre_migration_skip_toast">To show this screen again, go to Settings -> Library.</string> | ||||
|  | ||||
|     <!-- EXH --> | ||||
|     <string name="label_login">Login</string> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user