Git Product home page Git Product logo

realtimeblurview's People

Contributors

mmin18 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

realtimeblurview's Issues

DialogFragment views are ignored, the view behind the dialog is blurred and bleeds through

I opened up a DialogFragment and tried to blur a portion of it. Instead of seeing that portion blurred, I instead see through to a blurred version of what is behind the dialog.

I fixed it with a hack (note that all code is Kotlin):

class RealtimeBlurViewForDialogs(
    context: Context?,
    attrs: AttributeSet? = null,
    private val decorView: View?
): RealtimeBlurView(context, attrs) {
    override fun getActivityDecorView(): View = decorView ?: super.getActivityDecorView()
}

Usage inside my DialogFragment:

val blurView = RealtimeBlurViewForDialogs(context, null, dialog.window?.decorView).apply {
    id = View.generateViewId()
    setBlurRadius(50f)
    setOverlayColor(Color.TRANSPARENT)
}

// add blurView where you want in your View hierarchy

I think the underlying issue is that when we detect and set mDifferentRoot, we should use the new root as the DecorView instead of the initial root. By using the DecorView of the dialog instead of the parent Activity, which my hack does, the problem is resolved.

blur item List

Helllo,
when i scroll list i has error in Android 5.0

.NullPointerException: Attempt to invoke virtual method 'void android.support.v8.renderscript.Allocation.copyFrom(android.graphics.Bitmap)' on a null object reference
at com.github.mmin18.widget.RealtimeBlurView.blur(RealtimeBlurView.java:206)
at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:249)

Eclipse

How to use this with Eclipse

renderscriptTargetApi 19
renderscriptSupportModeEnabled true

Home Fragment will not show any more when back

使用遇到问题,请教一下作者:

项目目前使用的是 单 Activity 架构,所有页面均在 Fragment 中实现。

我在 MainFragment 的底栏使用了这个 blurView,在 MainFragment 去往 二级页面,并返回的时候,Main 页面不再显示任何内容。用手滑动屏幕,会看到内容隐约在闪烁,松开手则什么也不能看见。

看 Profiler,一切似乎正常,没有什么波动。看 logcat,也没有什么错误信息。

NullPointerException

Got that NPE lately from crash report (device Samsung with API 24)

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v8.renderscript.Allocation.copyFrom(android.graphics.Bitmap)' on a null object reference
com.github.mmin18.widget.RealtimeBlurView.blur (RealtimeBlurView.java:206)
com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw (RealtimeBlurView.java:249)
android.view.ViewTreeObserver.dispatchOnPreDraw (ViewTreeObserver.java:1013)
android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:2506)
android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1515)
android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7091)
android.view.Choreographer$CallbackRecord.run (Choreographer.java:927)
android.view.Choreographer.doCallbacks (Choreographer.java:702)
android.view.Choreographer.doFrame (Choreographer.java:638)
android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:913)
android.os.Handler.handleCallback (Handler.java:751)
android.os.Handler.dispatchMessage (Handler.java:95)
android.os.Looper.loop (Looper.java:154)
android.app.ActivityThread.main (ActivityThread.java:6682)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1520)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1410)

Failed to sync with Gradle

Gradle doesn't find com.github.mmin18:realtimeblurview:1.0.4

Error:Could not find com.github.mmin18:realtimeblurview:1.0.4.
Required by:
    myapp-android:app:unspecified
<a href="searchInBuildFiles">Search in build.gradle files</a>

I also tried com.github.mmin18:realtimeblurview:library:1.0.4 but it's not working either.

BUG

When android:layout_marginTop="-45dp" is set, the partial blur effect of the status bar is invalid

<com.github.mmin18.widget.RealtimeBlurView
    android:id="@+id/blur"
    android:layout_width="match_parent"
    **android:layout_marginTop="-45dp"**
    app:realtimeOverlayColor="#00000000"
    app:realtimeBlurRadius="50dp"
    android:layout_height="match_parent"/>

Use ObjectAnimator and BlurView together then UI frames drop a lot.

Activity has one BlurView. I show some Views by using ObjectAnimator. Frames drop too many.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/colors">

    <com.github.mmin18.widget.RealtimeBlurView
        android:id="@+id/blurView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:visibility="gone"
        app:realtimeBlurRadius="10dp"
        app:realtimeOverlayColor="#BB000000" />

    <Button
        android:id="@+id/source"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="30dp"
        android:background="@drawable/shape_circle"
        android:text=""
        android:textSize="50sp" />

</RelativeLayout>
private void doExpandAnim() {
    blurView.setVisibility(View.VISIBLE);

    PropertyValuesHolder z1 = PropertyValuesHolder.ofFloat("alpha", 0, 1);
    ObjectAnimator z = ObjectAnimator.ofPropertyValuesHolder(blurView, z1);
    z.setInterpolator(new LinearInterpolator());
    z.setDuration(350);

    PropertyValuesHolder c1 = PropertyValuesHolder.ofFloat("rotation", 0, 360 + 45);
    ObjectAnimator c = ObjectAnimator.ofPropertyValuesHolder(source, c1);
    c.setDuration(350);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(z, c);
    animatorSet.start();
}

private void doCollapseAnim() {
    PropertyValuesHolder z1 = PropertyValuesHolder.ofFloat("alpha", 1, 0);
    ObjectAnimator z = ObjectAnimator.ofPropertyValuesHolder(blurView, z1);
    z.setInterpolator(new LinearInterpolator());
    z.setDuration(350);
    z.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            blurView.setVisibility(View.GONE);
        }
    });

    PropertyValuesHolder c1 = PropertyValuesHolder.ofFloat("rotation", 360 + 45, 0);
    ObjectAnimator c = ObjectAnimator.ofPropertyValuesHolder(source, c1);
    c.setDuration(350);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.playTogether(z, c);
    animatorSet.start();
}

Video

If i have a video the blur doesnt work

Context doesn't extend Activity

On ViewTreeObserver.OnPreDrawListener.onPreDraw getContext() doesn't return an Activity but a ContextThemeWrapper. Activity extends ContextThemeWrapper. In my app I use only one activity and then handle fragments through back stack.

At line 194 View decor = ((Activity) getContext()).getWindow().getDecorView(); an exception is being thrown java.lang.ClassCastException: android.support.v7.view.ContextThemeWrapper cannot be cast to android.app.Activity.

It seems more appropriate to replace it with this View decor = ((Activity) ((ContextThemeWrapper) getContext()).getBaseContext()).getWindow().getDecorView();

BlurView is not working in signed-release apk

Hi,

Thanks for this useful component. It works in debug mode as expected but i cannot get the blurview work in signed release apk. Is there any configuration for release mode? Any proguard rules?

SIGNED RELEASE APK

release

DEBUG APK

debug

Thanks in advance...

NPE on a null object reference

classpath 'com.android.tools.build:gradle:3.0.1'

defaultConfig {
        renderscriptTargetApi 25
        renderscriptSupportModeEnabled true
}
buildToolsVersion = '27.0.3'
minSdkVersion = 21
targetSdkVersion = 25
compileSdkVersion = 27

This happend after i upgrade to gradle 3.0

Below Stacktrace

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v8.renderscript.Allocation.copyFrom(android.graphics.Bitmap)' on a null object reference
at com.github.mmin18.widget.RealtimeBlurView.blur(RealtimeBlurView.java:206)
at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:249)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2082)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1134)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6050)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:860)
at android.view.Choreographer.doCallbacks(Choreographer.java:672)
at android.view.Choreographer.doFrame(Choreographer.java:608)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:846)
at android.os.Handler.handleCallback(Handler.java:742)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:5527)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:739)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)

java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps

api 28,how fix the bug ?
java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps
at android.graphics.BaseCanvas.onHwBitmapInSwMode(BaseCanvas.java:550)
at android.graphics.BaseCanvas.throwIfHwBitmapInSwMode(BaseCanvas.java:557)
at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:69)
at android.graphics.BaseCanvas.drawBitmap(BaseCanvas.java:127)
at android.graphics.Canvas.drawBitmap(Canvas.java:1504)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
at android.widget.ImageView.onDraw(ImageView.java:1342)
at android.view.View.draw(View.java:20207)
at android.view.View.draw(View.java:20077)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20075)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.view.View.draw(View.java:20210)
at com.android.internal.policy.DecorView.draw(DecorView.java:780)
at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:265)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1049)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2475)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7185)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
at android.view.Choreographer.doCallbacks(Choreographer.java:761)
at android.view.Choreographer.doFrame(Choreographer.java:696)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:879)

windowShowWallpaper

Is it possible to make it work with windowShowWallpaper to blur the wallpaper? This creates a really cool effect. Tried using the WallpaperManager method but didn't work with live wallpapers and didn't really crop as the launcher cropped it.

The blur view will show part when execute scale animator

The layout is very sample:

<FrameLayout
        android:id="@+id/save_pic"
        android:layout_width="match_parent"
        android:layout_height="match_parent">


        <ImageView
            android:id="@+id/pic_holder"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="centerCrop"
            android:src="@mipmap/share_pic_1" />


        <com.github.mmin18.widget.RealtimeBlurView
            android:id="@+id/blur_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:realtimeBlurRadius="10dp"
            app:realtimeOverlayColor="#4DFFFFFF" />
</FrameLayout>

Then, I want to the framelayout execute a scale animator.

View savePic  = findViewById(R.id.save_pic);
savePic.animate().scaleX(0.8f).scaleY(0.8f).start();

Finally,I found the bottom and right part of the layout had no blur effect.

AndroidX app crashed on older Android versions using the library V1.2

I've just updated the library to V1.2 and it still crashes on older Android versions.
Tested on Emulator and phone with Android 5.1.1.
This issue seems to be caused by a bug in androidx.renderscript library itself, as reported in this issue tracker:
https://issuetracker.google.com/issues/119582492

App Config

buildToolsVersion '28.0.3'
defaultConfig {
       minSdkVersion 19
       targetSdkVersion 28
       renderscriptTargetApi 19             // Crashed regardless of adding this config or not
       renderscriptSupportModeEnabled true
   }
Last Exception Backtrace
--
0 | androidx.renderscript.RSRuntimeException: Error loading RS jni library: java.lang.UnsatisfiedLinkError: JNI_ERR returned from JNI_OnLoad in "/data/app/<packagename>-2/lib/arm64/librsjni_androidx.so" Support lib API: 2301
1 | at androidx.renderscript.RenderScript.internalCreate(RenderScript.java:1414)
2 | at androidx.renderscript.RenderScript.create(RenderScript.java:1599)
3 | at androidx.renderscript.RenderScript.create(RenderScript.java:1549)
4 | at androidx.renderscript.RenderScript.create(RenderScript.java:1525)
5 | at androidx.renderscript.RenderScript.create(RenderScript.java:1512)
6 | at com.github.mmin18.widget.AndroidXBlurImpl.prepare(AndroidXBlurImpl.java:20)
7 | at com.github.mmin18.widget.RealtimeBlurView.prepare(RealtimeBlurView.java:186)
8 | at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:206)
9 | at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
10 | at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2144)
11 | at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1189)
12 | at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6243)
13 | at android.view.Choreographer$CallbackRecord.run(Choreographer.java:773)
14 | at android.view.Choreographer.doCallbacks(Choreographer.java:586)
15 | at android.view.Choreographer.doFrame(Choreographer.java:556)
16 | at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:759)
17 | at android.os.Handler.handleCallback(Handler.java:739)
18 | at android.os.Handler.dispatchMessage(Handler.java:95)
19 | at android.os.Looper.loop(Looper.java:160)
20 | at android.app.ActivityThread.main(ActivityThread.java:5541)
21 | at java.lang.reflect.Method.invoke(Native Method)
22 | at java.lang.reflect.Method.invoke(Method.java:372)
23 | at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:964)
24 | at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:759)

关于性能

之前用过500px-android-blur
发现模糊损耗的时间大约小于5ms
大部分时间消耗在了重复绘制上,有时候超过16ms,造成丢帧:
mBlurredView.draw(mBlurringCanvas)
而且还有一个使用上的不便,比如滑动ListView的时候需要监听滑动事件,然后调用mBlurredView.postInvalidate()来重新绘制背景。

看了你的项目,使用了ViewTreeObserver.OnPreDrawListener,这样是不是就避免了第二个问题(不需要调用mBlurredView.postInvalidate()来重新绘制背景),
但是对于第一个问题,其中也需要绘制到canvas上,是不是也会造成丢帧。

我的buildToolsVersion 是28了

java.lang.RuntimeException: Error loading RS jni library, Upgrade buildToolsVersion="24.0.2" or higher may solve this issue
at com.github.mmin18.widget.RealtimeBlurView.prepare(RealtimeBlurView.java:151)
at com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw(RealtimeBlurView.java:222)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2402)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1439)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6899)

Crashes with App converted to AndroidX on older versions of Android

After converting an App to AndroidX it started to crash on Android 5 devices. Regrettably there is no traceback since this happens in the native part. However, the crashes stopped after I removed RealtimeBlurView from the app.

W/linker: librsjni_androidx.so: unused DT entry: type 0x6000000f arg 0xaf80
    librsjni_androidx.so: unused DT entry: type 0x60000010 arg 0x1d
    librsjni_androidx.so: unused DT entry: type 0x6ffffef5 arg 0xad5c
    librsjni_androidx.so: unused DT entry: type 0x6ffffffe arg 0xad1c
    librsjni_androidx.so: unused DT entry: type 0x6fffffff arg 0x2

    --------- beginning of crash
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 3862 (app.id.here)

In this particular case it would be possible to just use vanilla RenderScript instead of the one in support library. Others suggest this solution as well.

Thus it would be great if this library would come in multiple flavors vanilla, supportlib and maybe androidx as well in the future.

Numerous errors on import

Imported both library and sample modules but now gradle fails to build. I tried using suggested strings from readme but following strings cause sync to fail misarably.

    compileSdkVersion rootProject.ext.compileSdkVersion
    buildToolsVersion rootProject.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion

    lintOptions {
        abortOnError rootProject.ext.lintAbortOnError
    }

    compileOptions {
        sourceCompatibility rootProject.ext.sourceCompatibility
        targetCompatibility rootProject.ext.targetCompatibility
    }

I don't even know why it is different from readme strings. Maybe sample was an extra that is not required?

Window上面没效果

WindowManager上面无效,猜测是无法获取当前activity导致的,有修改方案吗

a demo bug

I can't operate the two button after I double click the SLIDE ANIM button

Blur not working when I rotate the device

As the title says, when I rotate the device the blur disappears completely and the background of the previous activity becomes totally visible, how do I resolve that?

The blur not work when the activity's window is translucent.

AndroidManifest.xml

<activity
    android:name=".MineActivity"
    android:theme="@style/translucentActivity" />

styles.xml

<style name="translucentActivity" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowAnimationStyle">@style/Animation.AppCompat.Dialog</item>
</style>

activity_mine.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.github.mmin18.widget.RealtimeBlurView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:realtimeBlurRadius="10dp"
        app:realtimeOverlayColor="@color/blackOpaque70" />
<RelativeLayout />

Canvas: trying to use a recycled bitmap android.graphics.Bitmap@3b51abf

1 android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1271)
2 android.graphics.Canvas.drawBitmap(Canvas.java:1415)
3 android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
4 android.widget.ImageView.onDraw(ImageView.java:1268)
5 android.view.View.draw(View.java:17320)
6 android.view.View.draw(View.java:17218)
7 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
8 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
9 android.view.View.draw(View.java:17213)
10 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
11 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
12 android.view.View.draw(View.java:17213)
13 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
14 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
15 android.view.View.draw(View.java:17213)
16 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
17 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
18 android.view.View.draw(View.java:17213)
19 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
20 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
21 android.view.View.draw(View.java:17213)
22 android.view.ViewGroup.drawChild(ViewGroup.java:3900)
23 android.view.ViewGroup.dispatchDraw(ViewGroup.java:3686)
24 com.android.internal.policy.DecorView.dispatchDraw(DecorView.java:806)
25 android.view.View.draw(View.java:17332)
26 com.android.internal.policy.DecorView.draw(DecorView.java:792)
27 com.github.mmin18.widget.RealtimeBlurView$1.onPreDraw()
28 android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
29 android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2574)
30 android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1483)
31 android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6998)
32 android.view.Choreographer$CallbackRecord.run(Choreographer.java:907)
33 android.view.Choreographer.doCallbacks(Choreographer.java:709)
34 android.view.Choreographer.doFrame(Choreographer.java:644)
35 android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893)
36 android.os.Handler.handleCallback(Handler.java:836)
37 android.os.Handler.dispatchMessage(Handler.java:103)
38 android.os.Looper.loop(Looper.java:203)
39 android.app.ActivityThread.main(ActivityThread.java:6252)
40 java.lang.reflect.Method.invoke(Native Method)
41 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1072)
42 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:933)

Strange frames around the edges of the blur

I try to blur the background, and almost constantly around the edges of the blur, I see the effect of the "frame"
screenshot_1529657143
Sometimes when Activity is launched, this effect does not appear
screenshot_1529657130

Tested on: Pixel 2 emulator (API 22), Samsung SM-A300F

Code:

`

    <android.support.v4.view.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="8dp"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">
    </android.support.v4.view.ViewPager>
</FrameLayout>

<com.github.mmin18.widget.RealtimeBlurView
    android:id="@+id/blurView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:realtimeBlurRadius="4dp"
    app:realtimeOverlayColor="@color/colorOverlayGrey" />`

Android 4.1 use AndroidX crash

11-08 02:33:00.437 8014-8014/? E/RenderScript_jni: No GC methods
11-08 02:33:00.437 8014-8014/? D/dalvikvm: Trying to load lib /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so 0xa7550ac8
11-08 02:33:00.437 8014-8014/? D/dalvikvm: Added shared lib /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so 0xa7550ac8
11-08 02:33:00.437 8014-8014/? A/libc: Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 8014 (blurview.sample)
11-08 02:33:00.537 1135-1135/? I/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
11-08 02:33:00.537 1135-1135/? I/DEBUG: Build fingerprint: 'generic_x86/sdk_x86/generic_x86:4.1.2/MASTER/4875369:eng/test-keys'
11-08 02:33:00.537 1135-1135/? I/DEBUG: pid: 8014, tid: 8014, name: blurview.sample >>> com.github.mmin18.realtimeblurview.sample <<<
11-08 02:33:00.537 1135-1135/? I/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
11-08 02:33:00.537 1818-1818/com.android.launcher D/EGL_emulation: eglMakeCurrent: 0xb858b100: ver 2 0
11-08 02:33:00.627 1135-1135/? I/DEBUG: eax b84790b0 ebx 99f45100 ecx b6b2c920 edx b8521558
11-08 02:33:00.627 1135-1135/? I/DEBUG: esi 99f37170 edi 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: xcs 00000073 xds 0000007b xes 0000007b xfs 00000000 xss 0000007b
11-08 02:33:00.627 1135-1135/? I/DEBUG: eip 99f37191 ebp bf847d18 esp bf847cf0 flags 00010296
11-08 02:33:00.627 1135-1135/? I/DEBUG: backtrace:
11-08 02:33:00.627 1135-1135/? I/DEBUG: #00 pc 00000191 /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so (JNI_OnLoad+33)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #1 pc 0006bf32 /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+1234)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #2 pc 0009f7d9 /system/lib/libdvm.so (Dalvik_java_lang_Runtime_nativeLoad(unsigned int const*, JValue*)+73)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #3 pc 000c55a8 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: #4 pc 00028ff6 /system/lib/libdvm.so (dvmMterpStd(Thread*)+70)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #5 pc 000261c0 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+160)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #6 pc 00090ada /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+938)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #7 pc 000a0a91 /system/lib/libdvm.so (Dalvik_java_lang_reflect_Constructor_constructNative(unsigned int const*, JValue*)+177)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #8 pc 000c55a8 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: #9 pc 00028ff6 /system/lib/libdvm.so (dvmMterpStd(Thread*)+70)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #10 pc 000261c0 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+160)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #11 pc 00090ada /system/lib/libdvm.so (dvmInvokeMethod(Object*, Method const*, ArrayObject*, ArrayObject*, ClassObject*, bool)+938)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #12 pc 000a1b2a /system/lib/libdvm.so (Dalvik_java_lang_reflect_Method_invokeNative(unsigned int const*, JValue*)+282)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #13 pc 000c55a8 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: #14 pc 00028ff6 /system/lib/libdvm.so (dvmMterpStd(Thread*)+70)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #15 pc 000261c0 /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+160)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #16 pc 00091139 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, char*)+601)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #17 pc 0006231a /system/lib/libdvm.so (CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+106)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #18 pc 000421f4 /system/lib/libdvm.so (Check_CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, char*)+436)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #19 pc 00051dba /system/lib/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+42)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #20 pc 00053029 /system/lib/libandroid_runtime.so (android::AndroidRuntime::start(char const*, char const*)+969)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #21 pc 000011f7 /system/bin/app_process (main+599)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #22 pc 00016e7f /system/lib/libc.so (__libc_init+95)
11-08 02:33:00.627 1135-1135/? I/DEBUG: stack:
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cb0 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cb4 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cb8 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cbc 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cc0 0000004e
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cc4 b76b1325 /system/lib/libc.so (memset+37)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cc8 b773694f /system/bin/linker (__dl_lookup_in_library+15)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847ccc b775cfa8 /system/bin/linker
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cd0 99f37170 /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so (JNI_OnLoad)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cd4 b775d024 /system/bin/linker
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cd8 bf847d18 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cdc b6aa0c88 /system/lib/libdvm.so (dvmChangeStatus(Thread*, ThreadStatus)+24)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847ce0 b775d024 /system/bin/linker
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847ce4 b6afba47 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847ce8 0000004e
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cec 99f37181 /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so (JNI_OnLoad+17)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #00 bf847cf0 00000001
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cf4 b8521500 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cf8 bf847d01 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847cfc b7761e58
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d00 00000001
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d04 0000001c
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d08 b6a81d5b /system/lib/libdvm.so (dvmHashTableLookup(HashTable*, unsigned int, void*, int ()(void const, void const*), bool)+11)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d0c 99f37170 /data/data/com.github.mmin18.realtimeblurview.sample/lib/librsjni_androidx.so (JNI_OnLoad)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d10 b8521500 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d14 b6b2bc98 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d18 bf847d78 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d1c b6a99f32 /system/lib/libdvm.so (dvmLoadNativeCode(char const*, Object*, char**)+1234)
11-08 02:33:00.627 1135-1135/? I/DEBUG: #1 bf847d20 b84790b0 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d24 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d28 b6afba30 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d2c b8521500 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d30 a7550ac8 /dev/ashmem/dalvik-heap (deleted)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d34 a75a4dd8 /dev/ashmem/dalvik-heap (deleted)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d38 bf847db8 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d3c b6b2bc98 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d40 b6b2c920 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d44 b8521558 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d48 b8521568 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d4c 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d50 b847c4e0 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d54 b8521564 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d58 00000001
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d5c ffffffff
11-08 02:33:00.627 1135-1135/? I/DEBUG: ........ ........
11-08 02:33:00.627 1135-1135/? I/DEBUG: #2 bf847d80 b8521500 [heap]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d84 a7550ac8 /dev/ashmem/dalvik-heap (deleted)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d88 bf847d9c [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d8c b6aa6910 /system/lib/libdvm.so (dvmAllocObject+64)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d90 b6abccc9 /system/lib/libdvm.so (dvmGetCaller2Class(void const*)+9)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d94 b6b2bc98 /system/lib/libdvm.so
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d98 bf847db8 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847d9c 00000000
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847da0 a06e8884
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847da4 00000001
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847da8 b6ad965b /system/lib/libdvm.so (dvmResolveMethod+11)
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847dac a06e8850
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847db0 9f445b34 /system/framework/core.odex
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847db4 a06e886c
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847db8 bf847e08 [stack]
11-08 02:33:00.627 1135-1135/? I/DEBUG: bf847dbc b6af35a8 /system/lib/libdvm.so
11-08 02:33:00.677 1632-3710/system_process I/ActivityManager: Process com.github.mmin18.realtimeblurview.sample (pid 8014) has died.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.