Bug fix on last image deletion

This commit is contained in:
Matéo Duparc 2020-10-23 13:33:53 +02:00
parent e5413653d0
commit 4378c962fc
2 changed files with 18 additions and 5 deletions

View File

@ -124,6 +124,17 @@ class ImageViewer: FileViewerActivity() {
} }
wasMapped = true wasMapped = true
} }
if (mappedImages.size == 0){ //can happen on deleting images
ColoredAlertDialogBuilder(this)
.keepFullScreen()
.setTitle(R.string.error)
.setCancelable(false)
.setPositiveButton(R.string.ok) { _, _ ->
goBackToExplorer()
}
.setMessage(R.string.no_more_images)
.show()
} else {
currentMappedImageIndex = if (deltaX < 0){ currentMappedImageIndex = if (deltaX < 0){
MiscUtils.incrementIndex(currentMappedImageIndex, mappedImages) MiscUtils.incrementIndex(currentMappedImageIndex, mappedImages)
} else { } else {
@ -132,6 +143,7 @@ class ImageViewer: FileViewerActivity() {
filePath = mappedImages[currentMappedImageIndex].fullPath filePath = mappedImages[currentMappedImageIndex].fullPath
loadImage() loadImage()
} }
}
fun onClickDelete(view: View) { fun onClickDelete(view: View) {
ColoredAlertDialogBuilder(this) ColoredAlertDialogBuilder(this)

View File

@ -179,4 +179,5 @@
<string name="error_cipher_null">Error cipher is null</string> <string name="error_cipher_null">Error cipher is null</string>
<string name="key_permanently_invalidated_exception">KeyPermanentlyInvalidatedException</string> <string name="key_permanently_invalidated_exception">KeyPermanentlyInvalidatedException</string>
<string name="key_permanently_invalidated_exception_msg">It looks like you have added a new fingerprint. Saved passwords hash have become unusable.</string> <string name="key_permanently_invalidated_exception_msg">It looks like you have added a new fingerprint. Saved passwords hash have become unusable.</string>
<string name="no_more_images">No more images found.</string>
</resources> </resources>