mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
fix #1611, removing some portrait related crashes
This commit is contained in:
@ -482,13 +482,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||||||
setupStripeBottomMargin()
|
setupStripeBottomMargin()
|
||||||
|
|
||||||
val coverIndex = getCoverImageIndex(paths)
|
val coverIndex = getCoverImageIndex(paths)
|
||||||
mCurrentPortraitPhotoPath = paths[coverIndex]
|
if (coverIndex != -1) {
|
||||||
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
mCurrentPortraitPhotoPath = paths[coverIndex]
|
||||||
|
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
||||||
|
|
||||||
mView.photo_portrait_stripe.onGlobalLayout {
|
mView.photo_portrait_stripe.onGlobalLayout {
|
||||||
mView.photo_portrait_stripe.scrollBy((coverIndex - fakeItemsCnt) * itemWidth, 0)
|
mView.photo_portrait_stripe.scrollBy((coverIndex - fakeItemsCnt) * itemWidth, 0)
|
||||||
adapter.setCurrentPhoto(coverIndex)
|
adapter.setCurrentPhoto(coverIndex)
|
||||||
mView.photo_portrait_stripe_wrapper.beVisible()
|
mView.photo_portrait_stripe_wrapper.beVisible()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,9 +245,11 @@ class MediaFetcher(val context: Context) {
|
|||||||
|
|
||||||
for (subdir in subdirs) {
|
for (subdir in subdirs) {
|
||||||
val portraitFiles = subdir.listFiles() ?: continue
|
val portraitFiles = subdir.listFiles() ?: continue
|
||||||
val cover = portraitFiles.firstOrNull { it.name.contains("cover", true) } ?: portraitFiles.first()
|
val cover = portraitFiles.firstOrNull { it.name.contains("cover", true) } ?: portraitFiles.firstOrNull()
|
||||||
files.add(cover)
|
if (cover != null) {
|
||||||
covers.add(cover.absolutePath)
|
files.add(cover)
|
||||||
|
covers.add(cover.absolutePath)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
|
Reference in New Issue
Block a user