Skip to content

Commit

Permalink
fix: blur view in scroll (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
biezhihua authored Dec 17, 2022
1 parent 4cf8694 commit 526f6e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ open class GXView : AbsoluteLayout, GXIViewBindData, GXIRootView, GXIRoundCorner
}
this.gxBlurHelper?.radius = 25F
this.gxBlurHelper?.sampling = 12
// this.gxBlurHelper?.color = Color.parseColor("#70FFFFFF")
// this.gxBlurHelper?.color = Color.parseColor("#70FFFFFF")
}
this.gxBackdropFilter = gxBackdropFilter
} else if (gxBackdropFilter is GXBackdropFilter.None) {
Expand Down Expand Up @@ -195,6 +195,10 @@ open class GXView : AbsoluteLayout, GXIViewBindData, GXIRootView, GXIRoundCorner
}

override fun release() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
gxBlurHelper?.innerRelease()
gxBlurHelper = null
}
gxTemplateContext = null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class GXBlurHelper(private val host: GXView) {
private var captureView: View? = null

private fun releaseBitmap() {
blurringCanvas = null
bitmapToBlur?.recycle()
bitmapToBlur = null
blurredBitmap?.recycle()
Expand All @@ -67,7 +68,7 @@ class GXBlurHelper(private val host: GXView) {
val scaledWidth = width / sampling
val scaledHeight = height / sampling

if (blurringCanvas == null || blurredBitmap == null) {
if (bitmapToBlur == null || blurredBitmap == null) {
releaseBitmap()
var r = false
try {
Expand Down Expand Up @@ -177,7 +178,6 @@ class GXBlurHelper(private val host: GXView) {
if (captureView != null) {
captureView?.viewTreeObserver?.removeOnPreDrawListener(preDrawListener)
}
innerRelease()
}
}

Expand Down

0 comments on commit 526f6e7

Please sign in to comment.