Skip to content

Commit

Permalink
Enhanced the Tab closed snackBar behavior. Now, when the user click…
Browse files Browse the repository at this point in the history
…s the `UNDO` button to restore a tab, we disable the snackBar's "UNDO" button to prevent subsequent clicks. This prevents the addition of multiple tabs if the `UNDO` button is clicked multiple times, as this type of restored tab leads to unexpected behavior see below video.
  • Loading branch information
MohitMaliDeveloper authored and kelson42 committed Apr 16, 2024
1 parent 1b8343b commit 9f1b0cf
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,10 @@ abstract class CoreReaderFragment :
snackBarRoot?.let {
it.bringToFront()
Snackbar.make(it, R.string.tab_closed, Snackbar.LENGTH_LONG)
.setAction(R.string.undo) { restoreDeletedTab(index) }.show()
.setAction(R.string.undo) { undoButton ->
undoButton.isEnabled = false
restoreDeletedTab(index)
}.show()

Check warning on line 1221 in core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/java/org/kiwix/kiwixmobile/core/main/CoreReaderFragment.kt#L1218-L1221

Added lines #L1218 - L1221 were not covered by tests
}
openHomeScreen()
}
Expand Down

0 comments on commit 9f1b0cf

Please sign in to comment.