migrate IOUtils to Kotlin (#2763)
* migrate `IOUtils` to Kotlin * Fix ktlint * change functions inside IOUtils to extension function
This commit is contained in:
parent
07b314266c
commit
c0a06f7188
6 changed files with 77 additions and 81 deletions
|
|
@ -75,7 +75,7 @@ fun getImageSquarePixels(contentResolver: ContentResolver, uri: Uri): Long {
|
|||
options.inJustDecodeBounds = true
|
||||
BitmapFactory.decodeStream(input, null, options)
|
||||
|
||||
IOUtils.closeQuietly(input)
|
||||
input.closeQuietly()
|
||||
|
||||
return (options.outWidth * options.outHeight).toLong()
|
||||
}
|
||||
|
|
@ -158,11 +158,11 @@ fun getImageOrientation(uri: Uri, contentResolver: ContentResolver): Int {
|
|||
exifInterface = ExifInterface(inputStream)
|
||||
} catch (e: IOException) {
|
||||
Log.w(TAG, e)
|
||||
IOUtils.closeQuietly(inputStream)
|
||||
inputStream.closeQuietly()
|
||||
return ExifInterface.ORIENTATION_UNDEFINED
|
||||
}
|
||||
val orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL)
|
||||
IOUtils.closeQuietly(inputStream)
|
||||
inputStream.closeQuietly()
|
||||
return orientation
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue