Skip to content

Commit

Permalink
optional on sdk 26
Browse files Browse the repository at this point in the history
  • Loading branch information
wwww-wwww committed Apr 18, 2024
1 parent 9330084 commit ff869ca
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {
compileSdk = 34

defaultConfig {
minSdk = 26
minSdk = 21

consumerProguardFiles("proguard-rules.txt")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.Bitmap
import android.graphics.Point
import android.graphics.Rect
import android.os.Build
import android.util.Log
import com.davemorrissey.labs.subscaleview.provider.InputProvider
import tachiyomi.decoder.ImageDecoder
Expand Down Expand Up @@ -53,7 +54,9 @@ class Decoder(
*/
override fun decodeRegion(sRect: Rect, sampleSize: Int): Bitmap {
var bitmap = decoder?.decode(sRect, sampleSize)
bitmap = bitmap?.copy(Bitmap.Config.HARDWARE, false)
if (Build.VERSION.SDK_INT >= 26) {
bitmap = bitmap?.copy(Bitmap.Config.HARDWARE, false)
}
return bitmap ?: error("Null region bitmap")
}

Expand Down
2 changes: 1 addition & 1 deletion sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ android {

defaultConfig {
applicationId = "com.davemorrissey.labs.subscaleview.test"
minSdk = 26
minSdk = 21
targetSdk = 34

versionCode = 4
Expand Down

0 comments on commit ff869ca

Please sign in to comment.