minor code style updates
This commit is contained in:
parent
2a76929312
commit
bfad77b597
|
@ -123,14 +123,12 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun degreesForRotation(orientation: Int): Int {
|
private fun degreesForRotation(orientation: Int) = when (orientation) {
|
||||||
return when (orientation) {
|
|
||||||
8 -> 270
|
8 -> 270
|
||||||
3 -> 180
|
3 -> 180
|
||||||
6 -> 90
|
6 -> 90
|
||||||
else -> 0
|
else -> 0
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private fun rotateViaMatrix(original: Bitmap, orientation: Int): Bitmap {
|
private fun rotateViaMatrix(original: Bitmap, orientation: Int): Bitmap {
|
||||||
val degrees = degreesForRotation(orientation).toFloat()
|
val degrees = degreesForRotation(orientation).toFloat()
|
||||||
|
@ -176,9 +174,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
.load(medium.path)
|
.load(medium.path)
|
||||||
.apply(options)
|
.apply(options)
|
||||||
.listener(object : RequestListener<Bitmap> {
|
.listener(object : RequestListener<Bitmap> {
|
||||||
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
|
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Bitmap>?, isFirstResource: Boolean) = false
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||||
if (isFragmentVisible)
|
if (isFragmentVisible)
|
||||||
|
|
Loading…
Reference in New Issue