fix:优化解锁提示面板体验(模糊背景偶尔加载慢,改为动态添加View,有所改善)
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
package com.nnbc123.app.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.util.AttributeSet
|
||||
import android.view.ViewGroup
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.core.util.Consumer
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.github.mmin18.widget.RealtimeBlurView
|
||||
import com.nnbc123.app.R
|
||||
import com.nnbc123.core.gift.bean.GiftInfo
|
||||
import com.nnbc123.core.gift.bean.GiftType
|
||||
@@ -53,6 +56,7 @@ class GIftDialogUnlockPanel : CardView {
|
||||
return
|
||||
}
|
||||
this.isVisible = true
|
||||
checkAddBlurView()
|
||||
val index = list.indexOfFirst {
|
||||
it.getGiftData()?.giftId == currentGift.giftId
|
||||
}
|
||||
@@ -76,4 +80,19 @@ class GIftDialogUnlockPanel : CardView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkAddBlurView() {
|
||||
if (getChildAt(0) is RealtimeBlurView) {
|
||||
return
|
||||
}
|
||||
val blurView = RealtimeBlurView(context, null)
|
||||
blurView.setBlurRadius(25f)
|
||||
blurView.setDownsampleFactor(4f)
|
||||
blurView.setOverlayColor(Color.parseColor("#e0161722"))
|
||||
blurView.layoutParams = ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
addView(blurView, 0)
|
||||
}
|
||||
}
|
@@ -6,14 +6,6 @@
|
||||
android:layout_height="match_parent"
|
||||
tools:parentTag="androidx.cardview.widget.CardView">
|
||||
|
||||
<com.github.mmin18.widget.RealtimeBlurView
|
||||
android:id="@+id/blur_view_unlock"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:realtimeBlurRadius="25dp"
|
||||
app:realtimeDownsampleFactor="4"
|
||||
app:realtimeOverlayColor="#e0161722" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
|
Reference in New Issue
Block a user