fix #1611, removing some portrait related crashes
This commit is contained in:
parent
0d8f4f75ab
commit
0d1db78e90
|
@ -482,13 +482,15 @@ class PhotoFragment : ViewPagerFragment() {
|
|||
setupStripeBottomMargin()
|
||||
|
||||
val coverIndex = getCoverImageIndex(paths)
|
||||
mCurrentPortraitPhotoPath = paths[coverIndex]
|
||||
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
||||
if (coverIndex != -1) {
|
||||
mCurrentPortraitPhotoPath = paths[coverIndex]
|
||||
setupStripeUpListener(adapter, screenWidth, itemWidth)
|
||||
|
||||
mView.photo_portrait_stripe.onGlobalLayout {
|
||||
mView.photo_portrait_stripe.scrollBy((coverIndex - fakeItemsCnt) * itemWidth, 0)
|
||||
adapter.setCurrentPhoto(coverIndex)
|
||||
mView.photo_portrait_stripe_wrapper.beVisible()
|
||||
mView.photo_portrait_stripe.onGlobalLayout {
|
||||
mView.photo_portrait_stripe.scrollBy((coverIndex - fakeItemsCnt) * itemWidth, 0)
|
||||
adapter.setCurrentPhoto(coverIndex)
|
||||
mView.photo_portrait_stripe_wrapper.beVisible()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,9 +245,11 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
for (subdir in subdirs) {
|
||||
val portraitFiles = subdir.listFiles() ?: continue
|
||||
val cover = portraitFiles.firstOrNull { it.name.contains("cover", true) } ?: portraitFiles.first()
|
||||
files.add(cover)
|
||||
covers.add(cover.absolutePath)
|
||||
val cover = portraitFiles.firstOrNull { it.name.contains("cover", true) } ?: portraitFiles.firstOrNull()
|
||||
if (cover != null) {
|
||||
files.add(cover)
|
||||
covers.add(cover.absolutePath)
|
||||
}
|
||||
}
|
||||
|
||||
for (file in files) {
|
||||
|
|
Loading…
Reference in New Issue