Skip to content

Commit d5f6471

Browse files
lukstbitdavid-allison
authored andcommitted
Hide fields in NoteEditorFragment for image occlusion notetypes
Showing the fields is not needed because we handle the image occlusion with a backend page, desktop app also doesn't show the fields for image occlusion and it's confusing for the users.
1 parent 91edb89 commit d5f6471

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

AnkiDroid/src/main/java/com/ichi2/anki/NoteEditorFragment.kt

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1789,23 +1789,13 @@ class NoteEditorFragment :
17891789
editNoteTypeMode: Boolean,
17901790
) {
17911791
val editLines = fieldState.loadFieldEditLines(type)
1792+
// showing the fields is not needed for image occlusion notetypes as they are handled by the
1793+
// backend page
1794+
fieldsLayoutContainer?.isVisible = !currentNotetypeIsImageOcclusion()
17921795
fieldsLayoutContainer!!.removeAllViews()
17931796
customViewIds.clear()
17941797
imageOcclusionButtonsContainer?.isVisible = currentNotetypeIsImageOcclusion()
17951798

1796-
val indicesToHide = mutableListOf<Int>()
1797-
if (currentNotetypeIsImageOcclusion()) {
1798-
val occlusionTag = "0"
1799-
val imageTag = "1"
1800-
val fields = currentlySelectedNotetype!!.fields
1801-
for ((i, field) in fields.withIndex()) {
1802-
val tag = field.imageOcclusionTag
1803-
if (tag == occlusionTag || tag == imageTag) {
1804-
indicesToHide.add(i)
1805-
}
1806-
}
1807-
}
1808-
18091799
editFields = LinkedList()
18101800

18111801
var previous: FieldEditLine? = null
@@ -1893,7 +1883,6 @@ class NoteEditorFragment :
18931883
toggleStickyButton.contentDescription =
18941884
getString(R.string.note_editor_toggle_sticky, editLineView.name)
18951885

1896-
editLineView.isVisible = i !in indicesToHide
18971886
fieldsLayoutContainer!!.addView(editLineView)
18981887
}
18991888
}

0 commit comments

Comments
 (0)