minor code style updates

This commit is contained in:
tibbi 2017-09-01 15:17:11 +02:00
parent 2a76929312
commit bfad77b597
1 changed files with 6 additions and 10 deletions

View File

@ -123,13 +123,11 @@ 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 {
@ -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)