Add Migrate button marginTop and implement Hide not found manga for mass migration (#372)

* Add Migrate button marginTop and implement Hide not found manga in mass migration

* if else change

* move variable to adapter

* horizontal scroll view for checkboxes in migration_bottom_sheet.xml
This commit is contained in:
simakover
2021-06-29 09:06:55 +05:00
committed by GitHub
parent 1cf48b3ab7
commit c123df4637
8 changed files with 82 additions and 50 deletions
@@ -236,6 +236,8 @@ object PreferenceKeys {
const val skipPreMigration = "skip_pre_migration"
const val hideNotFoundMigration = "hide_not_found_migration"
const val eh_showSyncIntro = "eh_show_sync_intro"
const val eh_readOnlySync = "eh_sync_read_only"
@@ -356,6 +356,8 @@ class PreferencesHelper(val context: Context) {
fun skipPreMigration() = flowPrefs.getBoolean(Keys.skipPreMigration, false)
fun hideNotFoundMigration() = flowPrefs.getBoolean(Keys.hideNotFoundMigration, false)
fun isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false)
@@ -39,6 +39,7 @@ class MigrationBottomSheetDialog(activity: Activity, private val listener: Start
binding.fab.setOnClickListener {
preferences.skipPreMigration().set(binding.skipStep.isChecked)
preferences.hideNotFoundMigration().set(binding.HideNotFoundManga.isChecked)
listener.startMigration(
if (binding.useSmartSearch.isChecked && binding.extraSearchParamText.text.isNotBlank()) {
binding.extraSearchParamText.toString()
@@ -72,6 +73,7 @@ class MigrationBottomSheetDialog(activity: Activity, private val listener: Start
binding.sourceGroup.bindToPreference(preferences.useSourceWithMost())
binding.skipStep.isChecked = preferences.skipPreMigration().get()
binding.HideNotFoundManga.isChecked = preferences.hideNotFoundMigration().get()
binding.skipStep.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
(listener as? Controller)?.activity?.toast(
@@ -312,7 +312,9 @@ class MigrationListController(bundle: Bundle? = null) :
)
)
}
router.popCurrentController()
if (adapter?.hideNotFound == false) {
router.popCurrentController()
}
}
}
@@ -23,6 +23,8 @@ class MigrationProcessAdapter(
val menuItemListener: MigrationProcessInterface = controller
val hideNotFound = preferences.hideNotFoundMigration().get()
override fun updateDataSet(items: List<MigrationProcessItem>?) {
this.items = items.orEmpty()
super.updateDataSet(items)
@@ -113,9 +113,13 @@ class MigrationProcessHolder(
}
.launchIn(adapter.controller.viewScope)
} else {
binding.migrationMangaCardTo.loadingGroup.isVisible = false
binding.migrationMangaCardTo.title.text = view.context.applicationContext
.getString(R.string.no_alternatives_found)
if (adapter.hideNotFound) {
adapter.removeManga(bindingAdapterPosition)
} else {
binding.migrationMangaCardTo.loadingGroup.isVisible = false
binding.migrationMangaCardTo.title.text = view.context.applicationContext
.getString(R.string.no_alternatives_found)
}
}
binding.migrationMenu.isVisible = true
binding.skipManga.isVisible = false