use rgb_555 decoding for jpgs
This commit is contained in:
parent
0c63ff1794
commit
a397006529
2 changed files with 16 additions and 8 deletions
|
@ -32,7 +32,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.simplemobiletools:commons:2.16.4'
|
compile 'com.simplemobiletools:commons:2.16.6'
|
||||||
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
|
||||||
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
|
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.1'
|
||||||
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
compile 'com.bignerdranch.android:recyclerview-multiselect:0.2'
|
||||||
|
|
|
@ -160,14 +160,15 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
if (degrees == 0f) {
|
if (degrees == 0f) {
|
||||||
val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth
|
val targetWidth = if (ViewPagerActivity.screenWidth == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenWidth
|
||||||
val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight
|
val targetHeight = if (ViewPagerActivity.screenHeight == 0) Target.SIZE_ORIGINAL else ViewPagerActivity.screenHeight
|
||||||
|
|
||||||
Glide.with(this)
|
Glide.with(this)
|
||||||
.load(medium.path)
|
.load(medium.path)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
.format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.override(targetWidth, targetHeight)
|
.override(targetWidth, targetHeight)
|
||||||
.listener(object : RequestListener<String, Bitmap> {
|
.listener(object : RequestListener<String, Bitmap> {
|
||||||
override fun onException(e: java.lang.Exception?, model: String?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
|
override fun onException(e: Exception?, model: String?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +183,6 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
.load(medium.path)
|
.load(medium.path)
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.transform(GlideRotateTransformation(context, degrees))
|
.transform(GlideRotateTransformation(context, degrees))
|
||||||
.format(DecodeFormat.PREFER_ARGB_8888)
|
|
||||||
.thumbnail(0.2f)
|
.thumbnail(0.2f)
|
||||||
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
.diskCacheStrategy(DiskCacheStrategy.NONE)
|
||||||
.into(view.photo_view)
|
.into(view.photo_view)
|
||||||
|
@ -205,26 +205,34 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
background = ColorDrawable(context.config.backgroundColor)
|
background = ColorDrawable(context.config.backgroundColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onTileLoadError(p0: java.lang.Exception?) {
|
override fun onTileLoadError(e: Exception?) {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewReleased() {
|
override fun onPreviewReleased() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onImageLoadError(p0: java.lang.Exception?) {
|
override fun onImageLoadError(e: Exception?) {
|
||||||
background = ColorDrawable(Color.TRANSPARENT)
|
background = ColorDrawable(Color.TRANSPARENT)
|
||||||
|
|
||||||
|
beGone()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPreviewLoadError(p0: java.lang.Exception?) {
|
override fun onPreviewLoadError(e: Exception?) {
|
||||||
background = ColorDrawable(Color.TRANSPARENT)
|
background = ColorDrawable(Color.TRANSPARENT)
|
||||||
|
beGone()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
|
super.onDestroyView()
|
||||||
|
Glide.clear(view.photo_view)
|
||||||
|
}
|
||||||
|
|
||||||
fun rotateImageViewBy(degrees: Float) {
|
fun rotateImageViewBy(degrees: Float) {
|
||||||
view.subsampling_view.visibility = View.GONE
|
view.subsampling_view.beGone()
|
||||||
loadBitmap(degrees)
|
loadBitmap(degrees)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue