Fix NewApi usage
@@ -6,6 +6,7 @@ import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.net.Uri;
+import android.os.Build;
import android.os.Environment;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@@ -109,8 +110,10 @@ public class ImageUtils {
}
if (context instanceof Activity) {
final Activity activity = (Activity) context;
- if (activity.isDestroyed() || activity.isFinishing()) {
- return false;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+ return !activity.isDestroyed() && !activity.isFinishing();
+ } else {
+ return activity.isFinishing();
}
}
return true;
