Skip to content

Commit

Permalink
Merge pull request #4 from NickM-27/master
Browse files Browse the repository at this point in the history
Support API 30
  • Loading branch information
lincollincol authored Dec 24, 2020
2 parents b22b225 + 6810746 commit e26f27e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions heifconverter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
compileSdkVersion 30
buildToolsVersion "29.0.3"

defaultConfig {
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ object HeifConverter{
bitmap = when (fromDataType) {
InputDataType.FILE -> {
when(Build.VERSION.SDK_INT) {
Build.VERSION_CODES.Q -> BitmapFactory.decodeFile(pathToHeicFile)
Build.VERSION_CODES.Q, Build.VERSION_CODES.R -> BitmapFactory.decodeFile(pathToHeicFile)
else -> HeifReader.decodeFile(pathToHeicFile)
}
}
InputDataType.URL -> {
when(Build.VERSION.SDK_INT) {
Build.VERSION_CODES.Q -> {
Build.VERSION_CODES.Q, Build.VERSION_CODES.R -> {
// Download image
val url = URL(url)
val connection = url
Expand All @@ -156,19 +156,19 @@ object HeifConverter{
}
InputDataType.RESOURCES -> {
when(Build.VERSION.SDK_INT) {
Build.VERSION_CODES.Q -> BitmapFactory.decodeResource(context.resources, resId!!)
Build.VERSION_CODES.Q, Build.VERSION_CODES.R -> BitmapFactory.decodeResource(context.resources, resId!!)
else -> HeifReader.decodeResource(context.resources, resId!!)
}
}
InputDataType.INPUT_STREAM -> {
when(Build.VERSION.SDK_INT) {
Build.VERSION_CODES.Q -> BitmapFactory.decodeStream(inputStream!!)
Build.VERSION_CODES.Q, Build.VERSION_CODES.R -> BitmapFactory.decodeStream(inputStream!!)
else -> HeifReader.decodeStream(inputStream!!)
}
}
InputDataType.BYTE_ARRAY -> {
when(Build.VERSION.SDK_INT) {
Build.VERSION_CODES.Q -> BitmapFactory.decodeByteArray(
Build.VERSION_CODES.Q, Build.VERSION_CODES.R -> BitmapFactory.decodeByteArray(
byteArray!!,
0,
byteArray!!.size,
Expand Down

0 comments on commit e26f27e

Please sign in to comment.