Skip to content

Commit

Permalink
hide fragment when deck is empty
Browse files Browse the repository at this point in the history
This commit ensure that NoteEditor frame will be hide is the deck is
empty
  • Loading branch information
SanjaySargam committed Aug 14, 2024
1 parent 25cfc15 commit 6b01657
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions AnkiDroid/src/main/java/com/ichi2/anki/CardBrowser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1497,8 +1497,17 @@ open class CardBrowser :
private fun redrawAfterSearch() {
Timber.i("CardBrowser:: Completed searchCards() Successfully")
updateList()
currentCardId = viewModel.cards[0].id
loadNoteEditorFragmentIfFragmented(editNoteLauncher)
// Check whether deck is empty or not
val isDeckEmpty = viewModel.rowCount == 0
// Hide note editor frame if deck is empty
noteEditorFrame?.visibility = if (!isDeckEmpty) {
currentCardId = viewModel.cards[0].id
loadNoteEditorFragmentIfFragmented(editNoteLauncher)
View.VISIBLE
} else {
invalidateOptionsMenu()
View.GONE
}
/*check whether mSearchView is initialized as it is lateinit property.*/
if (searchView == null || searchView!!.isIconified) {
restoreScrollPositionIfRequested()
Expand Down

0 comments on commit 6b01657

Please sign in to comment.