Skip to content

Commit

Permalink
Added tools:text, annotations and fixed disappearing checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
Haz3-jolt committed Dec 19, 2024
1 parent 793181d commit e90ba95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.core.os.BundleCompat
import androidx.core.os.bundleOf
import androidx.core.text.HtmlCompat
import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment
import androidx.lifecycle.lifecycleScope
import anki.cards.cardIds
Expand All @@ -48,6 +49,7 @@ import com.ichi2.anki.exportSelectedCards
import com.ichi2.anki.exportSelectedNotes
import com.ichi2.anki.ui.BasicItemSelectedListener
import com.ichi2.anki.utils.getTimestamp
import com.ichi2.annotations.NeedsTest
import com.ichi2.compat.CompatHelper.Companion.getSerializableCompat
import com.ichi2.libanki.DeckId
import com.ichi2.libanki.DeckNameId
Expand Down Expand Up @@ -205,6 +207,9 @@ class ExportDialogFragment : DialogFragment() {
/**
* Initializes the views representing the extra options available when exporting a collection.
*/
@NeedsTest("Checkbox is only available on two selections ")
@NeedsTest("Checkbox defaults to false")
@NeedsTest("Checkbox value is provided to the correct export functions (true/false)")
private fun View.initializeCollectionExportUi() =
with(CollectionManager.TR) {
collectionIncludeMedia =
Expand All @@ -220,6 +225,9 @@ class ExportDialogFragment : DialogFragment() {
/**
* Initializes the views representing the extra options available when exporting an Anki package.
*/
@NeedsTest("Checkbox is only available on two selections ")
@NeedsTest("Checkbox defaults to false")
@NeedsTest("Checkbox value is provided to the correct export functions (true/false)")
private fun View.initializeApkgExportUi() =
with(CollectionManager.TR) {
apkgIncludeMedia =
Expand Down Expand Up @@ -283,11 +291,10 @@ class ExportDialogFragment : DialogFragment() {
container: View,
targetConfig: ExportConfiguration,
) {
// if we export as collection there's no deck/selected items to choose from
if (targetConfig.layoutId == R.id.export_extras_collection || targetConfig.layoutId == R.id.export_extras_apkg) {
collectionExportLegacyCheckbox.visibility = View.VISIBLE
} else {
apkgExportLegacyCheckbox.visibility = View.GONE
// show the legacy checkbox only for collection and apkg exports
ExportConfiguration.entries.forEach { config ->
container.findViewById<View>(config.layoutId).isVisible =
config.layoutId == targetConfig.layoutId
}
if (targetConfig.layoutId == R.id.export_extras_collection) {
decksSelectorContainer.visibility = View.GONE
Expand Down
6 changes: 4 additions & 2 deletions AnkiDroid/src/main/res/layout/dialog_export_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
android:id="@+id/export_legacy_checkbox_collection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false" />
android:checked="false"
tools:text="Support older Anki versions (slower/ larger files)" />
</LinearLayout>


Expand Down Expand Up @@ -75,7 +76,8 @@
android:id="@+id/export_legacy_checkbox_apkg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false" />
android:checked="false"
tools:text="Support older Anki versions (slower/ larger files)" />
</LinearLayout>


Expand Down

0 comments on commit e90ba95

Please sign in to comment.