From 07eca88749ff9d1b23248097b7540b81310ba0c5 Mon Sep 17 00:00:00 2001 From: Hari Srinivasan Date: Thu, 19 Dec 2024 13:48:21 +0530 Subject: [PATCH] Refactoring Visibility to isVisible --- .../ichi2/anki/export/ExportDialogFragment.kt | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt b/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt index 4c4a2d7fa29c..bc823728e3b4 100644 --- a/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt +++ b/AnkiDroid/src/main/java/com/ichi2/anki/export/ExportDialogFragment.kt @@ -166,7 +166,7 @@ class ExportDialogFragment : DialogFragment() { if (selectedDeck != null) { deckSelector.setSelection(findDeckPosition(selectedDeck)) } - loadingIndicator.visibility = View.GONE + loadingIndicator.isVisible = false deckSelector.isEnabled = true } } @@ -291,24 +291,25 @@ class ExportDialogFragment : DialogFragment() { container: View, targetConfig: ExportConfiguration, ) { - // show the legacy checkbox only for collection and apkg exports - ExportConfiguration.entries.forEach { config -> - container.findViewById(config.layoutId).isVisible = - config.layoutId == targetConfig.layoutId - } + // if we export as collection there's no deck/selected items to choose from if (targetConfig.layoutId == R.id.export_extras_collection) { - decksSelectorContainer.visibility = View.GONE - selectedLabel.visibility = View.GONE + decksSelectorContainer.isVisible = false + selectedLabel.isVisible = false } else { if (arguments?.getSerializableCompat(ARG_TYPE) != null) { - decksSelectorContainer.visibility = View.GONE - selectedLabel.visibility = View.VISIBLE + decksSelectorContainer.isVisible = false + selectedLabel.isVisible = true } else { - decksSelectorContainer.visibility = View.VISIBLE - selectedLabel.visibility = View.GONE + decksSelectorContainer.isVisible = true + selectedLabel.isVisible = false } } exportTypeSelector.setSelection(targetConfig.index) + // Show the legacy checkbox for the selected export type + ExportConfiguration.entries.forEach { config -> + container.findViewById(config.layoutId).visibility = + if (config.layoutId == targetConfig.layoutId) View.VISIBLE else View.GONE + } } private fun handleCollectionExport() {