mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 13:08:00 +01:00
wrap whole picasso loading in a try/catch block
This commit is contained in:
parent
c708f183e2
commit
99f4a65dc1
1 changed files with 19 additions and 15 deletions
|
@ -267,25 +267,29 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
var pathToLoad = if (medium.path.startsWith("content://")) medium.path else "file://${medium.path}"
|
var pathToLoad = if (medium.path.startsWith("content://")) medium.path else "file://${medium.path}"
|
||||||
pathToLoad = pathToLoad.replace("%", "%25").replace("#", "%23")
|
pathToLoad = pathToLoad.replace("%", "%25").replace("#", "%23")
|
||||||
val picasso = Picasso.get()
|
|
||||||
.load(pathToLoad)
|
|
||||||
.centerInside()
|
|
||||||
.resize(targetWidth, targetHeight)
|
|
||||||
|
|
||||||
if (degrees != 0) {
|
try {
|
||||||
picasso.rotate(degrees.toFloat())
|
val picasso = Picasso.get()
|
||||||
}
|
.load(pathToLoad)
|
||||||
|
.centerInside()
|
||||||
|
.resize(targetWidth, targetHeight)
|
||||||
|
|
||||||
picasso.into(view.photo_view, object : Callback {
|
if (degrees != 0) {
|
||||||
override fun onSuccess() {
|
picasso.rotate(degrees.toFloat())
|
||||||
view.photo_view.isZoomable = degrees != 0 || context?.config?.allowZoomingImages == false
|
|
||||||
if (isFragmentVisible && degrees == 0) {
|
|
||||||
scheduleZoomableView()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onError(e: Exception) {}
|
picasso.into(view.photo_view, object : Callback {
|
||||||
})
|
override fun onSuccess() {
|
||||||
|
view.photo_view.isZoomable = degrees != 0 || context?.config?.allowZoomingImages == false
|
||||||
|
if (isFragmentVisible && degrees == 0) {
|
||||||
|
scheduleZoomableView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Exception) {}
|
||||||
|
})
|
||||||
|
} catch (ignored: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun openPanorama() {
|
private fun openPanorama() {
|
||||||
|
|
Loading…
Reference in a new issue