Git Product home page Git Product logo

Comments (9)

KunMinX avatar KunMinX commented on July 17, 2024
public void draw(Canvas canvas) {
		if (mIsRendering) {
			// Quit here, don't draw views above me
			throw STOP_EXCEPTION;
		} else if (RENDERING_COUNT > 0) {
			// Doesn't support blurview overlap on another blurview
		} else {
			super.draw(canvas);
		}
	}

从 二级页面返回一级的时候,会走 这个,然后 throw STOP_EXCEPTION。这是唯一能发现的线索,但 logcat 本身没任何消息。

from realtimeblurview.

KunMinX avatar KunMinX commented on July 17, 2024

经过排查,和 fragment 转场动画有关,关掉转场动画即可。

from realtimeblurview.

KunMinX avatar KunMinX commented on July 17, 2024

目前试了一下,除了渐变的 fade 动画,其他转场动画都会导致返回时不显示内容。
所以,有没有提供 api,使得 blur view 可以手动关闭和恢复毛玻璃呢?

from realtimeblurview.

KunMinX avatar KunMinX commented on July 17, 2024

现在改用 多 Activity 架构了。就是统一地在原来 fragment 的基础上套一层通用的 Activity,来独占 window 资源。

from realtimeblurview.

nukix avatar nukix commented on July 17, 2024

我使用的时候, 在页面A使用, 跳转页面B, 再回来页面A模糊效果也没了。 后来排查了一下, 是 RealtimeBlurView 里面的 blur 方法有问题, 继承 RealtimeBlurView, 重写 blur 方法, 就解决了, 不知道你的问题是不是和我的一样。

from realtimeblurview.

KunMinX avatar KunMinX commented on July 17, 2024

@nukix 哈哈,倒不是,我是 页面A 的内容全部不显示了。我通过为每个 fragment 套一个 Activity(申请到独立的 window)解决了。

from realtimeblurview.

JackieHou avatar JackieHou commented on July 17, 2024

@nukix 重写 blur 方法, 就解决了,重写的方法是怎么样写的?能贴一下代码吗

from realtimeblurview.

JackieHou avatar JackieHou commented on July 17, 2024

没有找到原因,我这只能简单粗暴的去解决了
@OverRide
public void showBlurView() {
if (blurView == null) {
//blurView.setVisibility(View.VISIBLE);
blurView = new RealtimeBlurView(this,null);
blurView.setBlurRadius(20);
blurView.setOverlayColor(Color.TRANSPARENT);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
mainFrameLayout.addView(blurView,params);
}

}

@Override
public void hideBlurView() {
    if (blurView != null) {
        //blurView.setVisibility(View.GONE);
        mainFrameLayout.removeView(blurView);
        blurView = null;
    }
}

from realtimeblurview.

nukix avatar nukix commented on July 17, 2024

我不清楚你遇到什么问题, 我只是重写 blur 用高斯模糊。 因为我 Debug 的时候, 发现回去原本的页面, 这个方法获得的模糊图变成了全0的透明图, 导致模糊失效了。

    @Override
    protected void blur(Bitmap bitmapToBlur, Bitmap blurredBitmap) {
        // super.blur(bitmapToBlur, blurredBitmap);
        RenderScript renderScript =  RenderScript.create(getContext());

        // Allocate memory for Renderscript to work with
        final Allocation input = Allocation.createFromBitmap(renderScript, bitmapToBlur);
        final Allocation output = Allocation.createTyped(renderScript,input.getType());
        // Load up an instance of the specific script that we want to use.
        ScriptIntrinsicBlur scriptIntrinsicBlur = ScriptIntrinsicBlur.create(renderScript, Element.U8_4(renderScript));
        scriptIntrinsicBlur.setInput(input);
        // Set the blur radius
        scriptIntrinsicBlur.setRadius(25);
        // Start the ScriptIntrinisicBlur
        scriptIntrinsicBlur.forEach(output);
        // Copy the output to the blurred bitmap
        output.copyTo(blurredBitmap);
        renderScript.destroy();
    }

from realtimeblurview.

Related Issues (20)

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.