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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 82 additions and 50 deletions

View File

@ -236,6 +236,8 @@ object PreferenceKeys {
const val skipPreMigration = "skip_pre_migration" const val skipPreMigration = "skip_pre_migration"
const val hideNotFoundMigration = "hide_not_found_migration"
const val eh_showSyncIntro = "eh_show_sync_intro" const val eh_showSyncIntro = "eh_show_sync_intro"
const val eh_readOnlySync = "eh_sync_read_only" const val eh_readOnlySync = "eh_sync_read_only"

View File

@ -356,6 +356,8 @@ class PreferencesHelper(val context: Context) {
fun skipPreMigration() = flowPrefs.getBoolean(Keys.skipPreMigration, false) 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 isHentaiEnabled() = flowPrefs.getBoolean(Keys.eh_is_hentai_enabled, true)
fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false) fun enableExhentai() = flowPrefs.getBoolean(Keys.eh_enableExHentai, false)

View File

@ -39,6 +39,7 @@ class MigrationBottomSheetDialog(activity: Activity, private val listener: Start
binding.fab.setOnClickListener { binding.fab.setOnClickListener {
preferences.skipPreMigration().set(binding.skipStep.isChecked) preferences.skipPreMigration().set(binding.skipStep.isChecked)
preferences.hideNotFoundMigration().set(binding.HideNotFoundManga.isChecked)
listener.startMigration( listener.startMigration(
if (binding.useSmartSearch.isChecked && binding.extraSearchParamText.text.isNotBlank()) { if (binding.useSmartSearch.isChecked && binding.extraSearchParamText.text.isNotBlank()) {
binding.extraSearchParamText.toString() binding.extraSearchParamText.toString()
@ -72,6 +73,7 @@ class MigrationBottomSheetDialog(activity: Activity, private val listener: Start
binding.sourceGroup.bindToPreference(preferences.useSourceWithMost()) binding.sourceGroup.bindToPreference(preferences.useSourceWithMost())
binding.skipStep.isChecked = preferences.skipPreMigration().get() binding.skipStep.isChecked = preferences.skipPreMigration().get()
binding.HideNotFoundManga.isChecked = preferences.hideNotFoundMigration().get()
binding.skipStep.setOnCheckedChangeListener { _, isChecked -> binding.skipStep.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) { if (isChecked) {
(listener as? Controller)?.activity?.toast( (listener as? Controller)?.activity?.toast(

View File

@ -312,7 +312,9 @@ class MigrationListController(bundle: Bundle? = null) :
) )
) )
} }
router.popCurrentController() if (adapter?.hideNotFound == false) {
router.popCurrentController()
}
} }
} }

View File

@ -23,6 +23,8 @@ class MigrationProcessAdapter(
val menuItemListener: MigrationProcessInterface = controller val menuItemListener: MigrationProcessInterface = controller
val hideNotFound = preferences.hideNotFoundMigration().get()
override fun updateDataSet(items: List<MigrationProcessItem>?) { override fun updateDataSet(items: List<MigrationProcessItem>?) {
this.items = items.orEmpty() this.items = items.orEmpty()
super.updateDataSet(items) super.updateDataSet(items)

View File

@ -113,9 +113,13 @@ class MigrationProcessHolder(
} }
.launchIn(adapter.controller.viewScope) .launchIn(adapter.controller.viewScope)
} else { } else {
binding.migrationMangaCardTo.loadingGroup.isVisible = false if (adapter.hideNotFound) {
binding.migrationMangaCardTo.title.text = view.context.applicationContext adapter.removeManga(bindingAdapterPosition)
.getString(R.string.no_alternatives_found) } else {
binding.migrationMangaCardTo.loadingGroup.isVisible = false
binding.migrationMangaCardTo.title.text = view.context.applicationContext
.getString(R.string.no_alternatives_found)
}
} }
binding.migrationMenu.isVisible = true binding.migrationMenu.isVisible = true
binding.skipManga.isVisible = false binding.skipManga.isVisible = false

View File

@ -24,67 +24,72 @@
android:id="@+id/data_label" android:id="@+id/data_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="6dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/data_to_include_in_migration" android:text="@string/data_to_include_in_migration"
android:textAppearance="@style/TextAppearance.Medium.Body2" android:textAppearance="@style/TextAppearance.Medium.Body2"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<CheckBox <HorizontalScrollView
android:id="@+id/mig_chapters" android:id="@+id/migration_data_scrollView"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:checked="true" android:scrollbars="none"
android:text="@string/chapters"
app:layout_constraintStart_toStartOf="@+id/data_label"
app:layout_constraintTop_toBottomOf="@+id/data_label" />
<CheckBox
android:id="@+id/mig_categories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/categories"
app:layout_constraintBottom_toBottomOf="@+id/mig_chapters"
app:layout_constraintStart_toEndOf="@+id/mig_chapters"
app:layout_constraintTop_toTopOf="@+id/mig_chapters" />
<CheckBox
android:id="@+id/mig_tracking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/track"
app:layout_constraintBottom_toBottomOf="@+id/mig_categories"
app:layout_constraintStart_toEndOf="@+id/mig_categories"
app:layout_constraintTop_toTopOf="@+id/mig_categories" />
<CheckBox
android:id="@+id/mig_extra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/log_extra"
app:layout_constraintBottom_toBottomOf="@+id/mig_tracking"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintStart_toEndOf="@+id/mig_tracking" app:layout_constraintTop_toBottomOf="@+id/data_label">
app:layout_constraintTop_toTopOf="@+id/mig_tracking" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<CheckBox
android:id="@+id/mig_chapters"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/chapters" />
<CheckBox
android:id="@+id/mig_categories"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/categories" />
<CheckBox
android:id="@+id/mig_tracking"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/track" />
<CheckBox
android:id="@+id/mig_extra"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:checked="true"
android:text="@string/log_extra" />
</LinearLayout>
</HorizontalScrollView>
<TextView <TextView
android:id="@+id/options_label" android:id="@+id/options_label"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:text="@string/action_settings" android:text="@string/action_settings"
android:textAppearance="@style/TextAppearance.Medium.Body2" android:textAppearance="@style/TextAppearance.Medium.Body2"
app:layout_constraintStart_toStartOf="@+id/mig_chapters" app:layout_constraintStart_toStartOf="@+id/migration_data_scrollView"
app:layout_constraintTop_toBottomOf="@+id/mig_chapters" /> app:layout_constraintTop_toBottomOf="@+id/migration_data_scrollView" />
<RadioGroup <RadioGroup
android:id="@+id/sourceGroup" android:id="@+id/sourceGroup"
@ -154,18 +159,30 @@
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:text="@string/skip_this_step_next_time" android:text="@string/skip_this_step_next_time"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/extra_search_param" app:layout_constraintEnd_toEndOf="@+id/extra_search_param"
app:layout_constraintStart_toStartOf="@+id/extra_search_param" app:layout_constraintStart_toStartOf="@+id/extra_search_param"
app:layout_constraintTop_toBottomOf="@+id/extra_search_param_text" /> app:layout_constraintTop_toBottomOf="@+id/extra_search_param_text" />
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/Hide_not_found_manga"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:text="@string/hide_not_found_manga"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/skip_step"
app:layout_constraintStart_toStartOf="@+id/skip_step"
app:layout_constraintTop_toBottomOf="@+id/skip_step" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/fab" android:id="@+id/fab"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minWidth="0dp" android:layout_marginTop="16dp"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:minWidth="0dp"
android:text="@string/action_migrate" android:text="@string/action_migrate"
app:icon="@drawable/ic_arrow_forward_24dp" app:icon="@drawable/ic_arrow_forward_24dp"
app:layout_anchor="@id/constraintLayout" app:layout_anchor="@id/constraintLayout"

View File

@ -404,6 +404,7 @@
<string name="use_most_chapters">Use source with the most chapters (slower)</string> <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="use_first_source">Use first source with alternative</string>
<string name="skip_this_step_next_time">Skip this step next time</string> <string name="skip_this_step_next_time">Skip this step next time</string>
<string name="hide_not_found_manga">Hide not found manga</string>
<string name="search_parameter">Search parameter (e.g. language:english)</string> <string name="search_parameter">Search parameter (e.g. language:english)</string>
<string name="latest_">Latest: %1$s</string> <string name="latest_">Latest: %1$s</string>
<string name="migrating_to">migrating to</string> <string name="migrating_to">migrating to</string>