coil-kt / coil

Image loading for Android and Compose Multiplatform.
https://coil-kt.github.io/coil/
Apache License 2.0
10.73k stars 651 forks source link

Replace imported SDK_INT constants with actual numbers #236

Closed consp1racy closed 4 years ago

consp1racy commented 4 years ago

Some of my favorite candidates for fix are in RealBitmapPool:

if (SDK_INT >= O) {
    configs += Bitmap.Config.RGBA_F16
}

require(SDK_INT < O || config != Bitmap.Config.HARDWARE) { "Cannot create a mutable hardware Bitmap." }

Using actual API level values will promote readability, i.e. nobody will have to ponder for minutes why the hell do we check whether SDK_INT is less than, greater than or equal to zero.

See https://twitter.com/jakewharton/status/1049421501559128065 for discussion. Main points:

mario commented 4 years ago

@colinrtwhite taking this over.

colinrtwhite commented 4 years ago

@mario Thanks, but I'd hold off for the moment (still debating if we should make this change). I generally agree that using numbers is more consistent, however Build.VERSION_CODES seems like the standard.

mario commented 4 years ago

@colinrtwhite sounds good.