mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
catch exceptions at trying to display fullscreen photos
This commit is contained in:
parent
8b37560ed4
commit
eed7be0f40
1 changed files with 13 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
package com.simplemobiletools.gallery.activities
|
package com.simplemobiletools.gallery.activities
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.database.Cursor
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
|
@ -63,13 +64,19 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
}
|
}
|
||||||
|
|
||||||
val proj = arrayOf(MediaStore.Images.Media.TITLE)
|
val proj = arrayOf(MediaStore.Images.Media.TITLE)
|
||||||
val cursor = contentResolver.query(mUri, proj, null, null, null)
|
var cursor: Cursor? = null
|
||||||
if (cursor != null && cursor.count != 0) {
|
try {
|
||||||
val columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE)
|
cursor = contentResolver.query(mUri, proj, null, null, null)
|
||||||
cursor.moveToFirst()
|
if (cursor != null && cursor.count != 0) {
|
||||||
title = cursor.getString(columnIndex)
|
val columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE)
|
||||||
|
cursor.moveToFirst()
|
||||||
|
title = cursor.getString(columnIndex)
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
title = mMedium?.name ?: ""
|
||||||
|
} finally {
|
||||||
|
cursor?.close()
|
||||||
}
|
}
|
||||||
cursor?.close()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
|
Loading…
Reference in a new issue