mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
some autoformat changes
This commit is contained in:
parent
72428f56db
commit
6096dab7c9
1 changed files with 33 additions and 31 deletions
|
@ -43,7 +43,9 @@ import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity
|
import com.simplemobiletools.gallery.pro.activities.PanoramaPhotoActivity
|
||||||
import com.simplemobiletools.gallery.pro.activities.PhotoActivity
|
import com.simplemobiletools.gallery.pro.activities.PhotoActivity
|
||||||
import com.simplemobiletools.gallery.pro.adapters.PortraitPhotosAdapter
|
import com.simplemobiletools.gallery.pro.adapters.PortraitPhotosAdapter
|
||||||
import com.simplemobiletools.gallery.pro.extensions.*
|
import com.simplemobiletools.gallery.pro.extensions.config
|
||||||
|
import com.simplemobiletools.gallery.pro.extensions.saveRotatedImageToFile
|
||||||
|
import com.simplemobiletools.gallery.pro.extensions.sendFakeClick
|
||||||
import com.simplemobiletools.gallery.pro.helpers.*
|
import com.simplemobiletools.gallery.pro.helpers.*
|
||||||
import com.simplemobiletools.gallery.pro.models.Medium
|
import com.simplemobiletools.gallery.pro.models.Medium
|
||||||
import com.simplemobiletools.gallery.pro.svg.SvgSoftwareLayerSetter
|
import com.simplemobiletools.gallery.pro.svg.SvgSoftwareLayerSetter
|
||||||
|
@ -66,8 +68,8 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
// devices with good displays, but the rest of the hardware not good enough for them
|
// devices with good displays, but the rest of the hardware not good enough for them
|
||||||
private val WEIRD_DEVICES = arrayListOf(
|
private val WEIRD_DEVICES = arrayListOf(
|
||||||
"motorola xt1685",
|
"motorola xt1685",
|
||||||
"google nexus 5x"
|
"google nexus 5x"
|
||||||
)
|
)
|
||||||
|
|
||||||
var mCurrentRotationDegrees = 0
|
var mCurrentRotationDegrees = 0
|
||||||
|
@ -379,20 +381,20 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
private fun loadSVG() {
|
private fun loadSVG() {
|
||||||
Glide.with(context!!)
|
Glide.with(context!!)
|
||||||
.`as`(PictureDrawable::class.java)
|
.`as`(PictureDrawable::class.java)
|
||||||
.listener(SvgSoftwareLayerSetter())
|
.listener(SvgSoftwareLayerSetter())
|
||||||
.load(mMedium.path)
|
.load(mMedium.path)
|
||||||
.into(mView.gestures_view)
|
.into(mView.gestures_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadBitmap(addZoomableView: Boolean = true) {
|
private fun loadBitmap(addZoomableView: Boolean = true) {
|
||||||
val priority = if (mIsFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL
|
val priority = if (mIsFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL
|
||||||
val options = RequestOptions()
|
val options = RequestOptions()
|
||||||
.signature(getFilePathToShow().getFileSignature())
|
.signature(getFilePathToShow().getFileSignature())
|
||||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
.format(DecodeFormat.PREFER_ARGB_8888)
|
||||||
.priority(priority)
|
.priority(priority)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
|
||||||
.fitCenter()
|
.fitCenter()
|
||||||
|
|
||||||
if (mCurrentRotationDegrees != 0) {
|
if (mCurrentRotationDegrees != 0) {
|
||||||
options.transform(Rotate(mCurrentRotationDegrees))
|
options.transform(Rotate(mCurrentRotationDegrees))
|
||||||
|
@ -404,24 +406,24 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
Glide.with(context!!)
|
Glide.with(context!!)
|
||||||
.load(getFilePathToShow())
|
.load(getFilePathToShow())
|
||||||
.apply(options)
|
.apply(options)
|
||||||
.listener(object : RequestListener<Drawable> {
|
.listener(object : RequestListener<Drawable> {
|
||||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
|
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
|
||||||
if (activity != null && !activity!!.isDestroyed && !activity!!.isFinishing) {
|
if (activity != null && !activity!!.isDestroyed && !activity!!.isFinishing) {
|
||||||
tryLoadingWithPicasso(addZoomableView)
|
tryLoadingWithPicasso(addZoomableView)
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
override fun onResourceReady(resource: Drawable?, model: Any?, target: Target<Drawable>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||||
mView.gestures_view.controller.settings.isZoomEnabled = mMedium.isRaw() || mCurrentRotationDegrees != 0 || context?.config?.allowZoomingImages == false
|
mView.gestures_view.controller.settings.isZoomEnabled = mMedium.isRaw() || mCurrentRotationDegrees != 0 || context?.config?.allowZoomingImages == false
|
||||||
if (mIsFragmentVisible && addZoomableView) {
|
if (mIsFragmentVisible && addZoomableView) {
|
||||||
scheduleZoomableView()
|
scheduleZoomableView()
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}).into(mView.gestures_view)
|
return false
|
||||||
|
}
|
||||||
|
}).into(mView.gestures_view)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun tryLoadingWithPicasso(addZoomableView: Boolean) {
|
private fun tryLoadingWithPicasso(addZoomableView: Boolean) {
|
||||||
|
@ -430,10 +432,10 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val picasso = Picasso.get()
|
val picasso = Picasso.get()
|
||||||
.load(pathToLoad)
|
.load(pathToLoad)
|
||||||
.centerInside()
|
.centerInside()
|
||||||
.stableKey(mMedium.path.getFileKey())
|
.stableKey(mMedium.path.getFileKey())
|
||||||
.resize(mScreenWidth, mScreenHeight)
|
.resize(mScreenWidth, mScreenHeight)
|
||||||
|
|
||||||
if (mCurrentRotationDegrees != 0) {
|
if (mCurrentRotationDegrees != 0) {
|
||||||
picasso.rotate(mCurrentRotationDegrees.toFloat())
|
picasso.rotate(mCurrentRotationDegrees.toFloat())
|
||||||
|
|
Loading…
Reference in a new issue