mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-29 19:27:59 +01:00
fix #1611, removing some portrait related crashes
This commit is contained in:
parent
0d8f4f75ab
commit
0d1db78e90
2 changed files with 13 additions and 9 deletions
|
@ -482,6 +482,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
setupStripeBottomMargin()
|
setupStripeBottomMargin()
|
||||||
|
|
||||||
val coverIndex = getCoverImageIndex(paths)
|
val coverIndex = getCoverImageIndex(paths)
|
||||||
|
if (coverIndex != -1) {
|
||||||
mCurrentPortraitPhotoPath = paths[coverIndex]
|
mCurrentPortraitPhotoPath = paths[coverIndex]
|
||||||
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
||||||
|
|
||||||
|
@ -492,6 +493,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun fillPhotoPaths(files: ArrayList<File>, fakeItemsCnt: Int): ArrayList<String> {
|
private fun fillPhotoPaths(files: ArrayList<File>, fakeItemsCnt: Int): ArrayList<String> {
|
||||||
val paths = ArrayList<String>()
|
val paths = ArrayList<String>()
|
||||||
|
|
|
@ -245,10 +245,12 @@ 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()
|
||||||
|
if (cover != null) {
|
||||||
files.add(cover)
|
files.add(cover)
|
||||||
covers.add(cover.absolutePath)
|
covers.add(cover.absolutePath)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (file in files) {
|
for (file in files) {
|
||||||
if (shouldStop) {
|
if (shouldStop) {
|
||||||
|
|
Loading…
Reference in a new issue