From 77affabf0d7b802dae8a44321bd0b59fad835ebf Mon Sep 17 00:00:00 2001 From: Thibault Malbranche Date: Mon, 1 May 2023 22:55:35 +0200 Subject: [PATCH] fix(android): bump blurview and use default setupWith (#541) --- android/build.gradle | 2 +- .../blurview/BlurViewManagerImpl.java | 22 ++++--------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 4bd9c81f..c3fa67ee 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -138,5 +138,5 @@ dependencies { implementation "com.facebook.react:react-native:+" // From node_modules - implementation 'com.github.Dimezis:BlurView:version-2.0.2' + implementation 'com.github.Dimezis:BlurView:version-2.0.3' } diff --git a/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java b/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java index 47030e59..44443134 100644 --- a/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java +++ b/android/src/main/java/com/reactnativecommunity/blurview/BlurViewManagerImpl.java @@ -1,14 +1,9 @@ package com.reactnativecommunity.blurview; -import android.graphics.drawable.Drawable; -import android.os.Build; import android.view.View; -import android.view.ViewGroup; import com.facebook.react.uimanager.ThemedReactContext; import eightbitlab.com.blurview.BlurView; -import eightbitlab.com.blurview.RenderEffectBlur; -import eightbitlab.com.blurview.RenderScriptBlur; import java.util.Objects; import javax.annotation.Nonnull; @@ -27,19 +22,10 @@ class BlurViewManagerImpl { .requireNonNull(ctx.getCurrentActivity()) .getWindow() .getDecorView(); - ViewGroup rootView = decorView.findViewById(android.R.id.content); - Drawable windowBackground = decorView.getBackground(); - if (Build.VERSION.SDK_INT >= 31) { - blurView - .setupWith(rootView, new RenderEffectBlur()) - .setFrameClearDrawable(windowBackground) - .setBlurRadius(defaultRadius); - } else { - blurView - .setupWith(rootView, new RenderScriptBlur(ctx)) - .setFrameClearDrawable(windowBackground) - .setBlurRadius(defaultRadius); - } + blurView + .setupWith(decorView.findViewById(android.R.id.content)) + .setFrameClearDrawable(decorView.getBackground()) + .setBlurRadius(defaultRadius); return blurView; }