1
0
mirror of https://github.com/wasabeef/glide-transformations.git synced 2025-06-28 20:35:54 +08:00

refactor support rs (#142)

This commit is contained in:
Daichi Furiya 2018-11-16 18:01:01 +09:00 committed by GitHub
parent 3aa8e53c6a
commit 2e2846d354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 8 deletions

View File

@ -6,6 +6,9 @@ android {
defaultConfig {
minSdkVersion MIN_SDK_VERSION as int
targetSdkVersion TARGET_SDK_VERSION as int
renderscriptTargetApi TARGET_SDK_VERSION as int
renderscriptSupportModeEnabled true
}
}

View File

@ -21,7 +21,6 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.renderscript.RSRuntimeException;
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
@ -29,6 +28,7 @@ import java.security.MessageDigest;
import androidx.annotation.NonNull;
import jp.wasabeef.glide.transformations.internal.FastBlur;
import jp.wasabeef.glide.transformations.internal.RSBlur;
import jp.wasabeef.glide.transformations.internal.SupportRSBlur;
public class SupportRSBlurTransformation extends BitmapTransformation {
@ -76,7 +76,9 @@ public class SupportRSBlurTransformation extends BitmapTransformation {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
try {
bitmap = SupportRSBlur.blur(context, bitmap, radius);
} catch (RSRuntimeException e) {
} catch (NoClassDefFoundError e) {
bitmap = RSBlur.blur(context, bitmap, radius);
} catch (RuntimeException e) {
bitmap = FastBlur.blur(bitmap, radius, true);
}
} else {

View File

@ -26,7 +26,6 @@ import android.renderscript.ScriptIntrinsicBlur;
* limitations under the License.
*/
@Deprecated
public class RSBlur {
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)

View File

@ -4,11 +4,12 @@ import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RSRuntimeException;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import androidx.renderscript.Allocation;
import androidx.renderscript.Element;
import androidx.renderscript.RSRuntimeException;
import androidx.renderscript.RenderScript;
import androidx.renderscript.ScriptIntrinsicBlur;
/**
* Copyright (C) 2018 Wasabeef