android / android-ktx

A set of Kotlin extensions for Android app development.
https://android.github.io/android-ktx/core-ktx/
7.47k stars 563 forks source link

Extension method for checking if the bitmap is empty #568

Open kevalpatel2106 opened 6 years ago

kevalpatel2106 commented 6 years ago

I think it would be great if bitmap has an extension for checking if the bitmap is empty or not based on the byte count.

if (bitmap.isEmpty()){
   // Did not read bitmap correctly.
}
JakeWharton commented 6 years ago

Why based on byte count and not size?

kevalpatel2106 commented 6 years ago

I didn't use size because createBitmap doesn't allow to set the bitmap dimensions to zero. So there is no point of checking the size of the bitmap to see if the bitmap is of 0 * 0 size.