From cd42880b0032c5885ce96693d2eef01e69c1fa70 Mon Sep 17 00:00:00 2001 From: Suphon Thanakornpakapong Date: Mon, 3 Oct 2022 23:01:45 +0530 Subject: [PATCH 01/11] refactor: adjust blur configs and scales --- .../e/blisslauncher/core/blur/BlurDrawable.kt | 18 ++- .../core/blur/BlurViewDelegate.kt | 9 +- .../core/blur/BlurWallpaperFilter.kt | 74 +++++----- .../core/blur/BlurWallpaperProvider.kt | 45 ++++-- .../core/blur/ShaderBlurDrawable.kt | 133 ------------------ .../core/customviews/BlurBackgroundView.kt | 10 +- .../core/customviews/BlurLayout.kt | 3 +- .../core/customviews/DockGridLayout.kt | 3 +- .../core/customviews/RoundedWidgetView.java | 3 +- .../core/customviews/SquareFrameLayout.java | 5 +- 10 files changed, 110 insertions(+), 193 deletions(-) delete mode 100644 app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt index 52a19e33fd..763ac52dec 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurDrawable.kt @@ -10,8 +10,11 @@ import android.graphics.RectF import android.graphics.Shader import android.graphics.drawable.Drawable -class BlurDrawable internal constructor(private val blurWallpaperProvider: BlurWallpaperProvider) : - Drawable(), BlurWallpaperProvider.Listener { +class BlurDrawable +internal constructor( + private val blurWallpaperProvider: BlurWallpaperProvider, + private val config: BlurWallpaperProvider.BlurConfig = BlurWallpaperProvider.blurConfigWidget +) : Drawable(), BlurWallpaperProvider.Listener { private var blurAlpha = 255 private val blurPaint = Paint(Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG) @@ -33,7 +36,9 @@ class BlurDrawable internal constructor(private val blurWallpaperProvider: BlurW val height = blurBounds.bottom.toInt() - blurBounds.top.toInt() if (width <= 0 || height <= 0) return if (blurAlpha == 0) return - blurBitmap = blurWallpaperProvider.wallpapers?.second + val wallpapers = blurWallpaperProvider.wallpapers + blurBitmap = wallpapers?.let { config.getDrawable(it) } + val scale = config.scale.toFloat() if (blurBitmap == null) { blurBitmap = blurWallpaperProvider.placeholder @@ -43,9 +48,12 @@ class BlurDrawable internal constructor(private val blurWallpaperProvider: BlurW val top = blurBounds.top + offsetY val right = blurBounds.right + offsetX val bottom = blurBounds.bottom + offsetY + val count = canvas.save() canvas.translate(-left, -top) - canvas.drawRect(left, top, right, bottom, blurPaint) - canvas.translate(left, top) + canvas.clipRect(left, top, right, bottom) + canvas.scale(scale, scale, 0f, 0f) + canvas.drawPaint(blurPaint) + canvas.restoreToCount(count) } override fun setAlpha(alpha: Int) { diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt index 295a530bbf..18b3073740 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt @@ -14,8 +14,11 @@ import foundation.e.blisslauncher.R import foundation.e.blisslauncher.core.customviews.HorizontalPager import foundation.e.blisslauncher.core.utils.OffsetParent -class BlurViewDelegate(private val view: View, attrs: AttributeSet? = null) : - View.OnAttachStateChangeListener, BlurWallpaperProvider.Listener { +class BlurViewDelegate( + private val view: View, + private val config: BlurWallpaperProvider.BlurConfig, + attrs: AttributeSet? = null +) : View.OnAttachStateChangeListener, BlurWallpaperProvider.Listener { private val context = view.context private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstance(context) } @@ -131,7 +134,7 @@ class BlurViewDelegate(private val view: View, attrs: AttributeSet? = null) : private fun createFullBlurDrawable() { fullBlurDrawable?.let { if (view.isAttachedToWindow) it.stopListening() } fullBlurDrawable = - blurWallpaperProvider.createBlurDrawable().apply { + blurWallpaperProvider.createBlurDrawable(config).apply { callback = blurDrawableCallback setBounds(view.left, view.top, view.right, view.bottom) if (view.isAttachedToWindow) startListening() diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt index b075661a84..a752682157 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperFilter.kt @@ -4,44 +4,54 @@ import android.content.Context import android.graphics.Bitmap import com.hoko.blur.HokoBlur -typealias BitmapPair = Pair +class BlurWallpaperFilter(private val context: Context) : + WallpaperFilter { -class BlurWallpaperFilter(private val context: Context) : WallpaperFilter { - - private var blurRadiusSmall = 8 - private var blurRadiusLarge = 25 - - override fun apply(wallpaper: Bitmap): WallpaperFilter.ApplyTask { + override fun apply( + wallpaper: Bitmap + ): WallpaperFilter.ApplyTask { return WallpaperFilter.ApplyTask.create { emitter -> - var wallpaperSmallBlur: Bitmap? = null - var wallpaperLargeBlur: Bitmap? = null + var blurBackground: Bitmap? = null + var blurDock: Bitmap? = null + var blurAppGroup: Bitmap? = null + var blurWidget: Bitmap? = null try { - wallpaperSmallBlur = - HokoBlur.with(context) - .scheme(HokoBlur.SCHEME_NATIVE) - .mode(HokoBlur.MODE_STACK) - .radius(blurRadiusSmall) - .sampleFactor(8f) - .forceCopy(false) - .needUpscale(true) - .processor() - .blur(wallpaper) - wallpaperLargeBlur = - HokoBlur.with(context) - .scheme(HokoBlur.SCHEME_NATIVE) - .mode(HokoBlur.MODE_STACK) - .radius(blurRadiusLarge) - .sampleFactor(16f) - .forceCopy(false) - .needUpscale(true) - .processor() - .blur(wallpaper) - emitter.onSuccess(Pair(wallpaperSmallBlur, wallpaperLargeBlur)) + blurBackground = blur(wallpaper, BlurWallpaperProvider.blurConfigBackground) + blurDock = blur(wallpaper, BlurWallpaperProvider.blurConfigDock) + blurAppGroup = blur(wallpaper, BlurWallpaperProvider.blurConfigAppGroup) + blurWidget = blur(wallpaper, BlurWallpaperProvider.blurConfigWidget) + emitter.onSuccess( + BlurWallpaperProvider.BlurSizes( + blurBackground, + blurDock, + blurAppGroup, + blurWidget + ) + ) } catch (t: Throwable) { - wallpaperSmallBlur?.recycle() - wallpaperLargeBlur?.recycle() + blurBackground?.recycle() + blurDock?.recycle() + blurAppGroup?.recycle() + blurWidget?.recycle() emitter.onError(t) } } } + + private fun blur(wallpaper: Bitmap, config: BlurWallpaperProvider.BlurConfig): Bitmap { + val source = + Bitmap.createScaledBitmap( + wallpaper, + wallpaper.width / config.scale, + wallpaper.height / config.scale, + true + ) + return HokoBlur.with(context) + .scheme(HokoBlur.SCHEME_NATIVE) + .mode(HokoBlur.MODE_STACK) + .radius(config.radius) + .forceCopy(false) + .processor() + .blur(source) + } } diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index de1fa6aa21..617955d9ea 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -30,11 +30,10 @@ class BlurWallpaperProvider(val context: Context) { private val listeners = ArrayList() private val displayMetrics = DisplayMetrics() - var wallpapers: Pair? = null + var wallpapers: BlurSizes? = null private set(value) { if (field != value) { - field?.first?.recycle() - field?.second?.recycle() + field?.recycle() field = value } } @@ -51,7 +50,7 @@ class BlurWallpaperProvider(val context: Context) { private val mUpdateRunnable = Runnable { updateWallpaper() } private val wallpaperFilter = BlurWallpaperFilter(context) - private var applyTask: WallpaperFilter.ApplyTask>? = null + private var applyTask: WallpaperFilter.ApplyTask? = null private var updatePending = false @@ -192,7 +191,11 @@ class BlurWallpaperProvider(val context: Context) { (scaledWallpaper.height - height) / 2 } else 0 - return Bitmap.createBitmap(scaledWallpaper, 0, y, width, height - navigationBarHeight) + val newBitmap = + Bitmap.createBitmap(scaledWallpaper, 0, y, width, height - navigationBarHeight) + wallpaper.recycle() + scaledWallpaper.recycle() + return newBitmap } fun addListener(listener: Listener) { @@ -203,12 +206,8 @@ class BlurWallpaperProvider(val context: Context) { listeners.remove(listener) } - fun createDrawable(): ShaderBlurDrawable { - return ShaderBlurDrawable(this) - } - - fun createBlurDrawable(): BlurDrawable { - return BlurDrawable(this) + fun createBlurDrawable(config: BlurConfig = blurConfigDock): BlurDrawable { + return BlurDrawable(this, config) } interface Listener { @@ -222,11 +221,35 @@ class BlurWallpaperProvider(val context: Context) { sInstance = null }*/ + data class BlurSizes( + val background: Bitmap, + val dock: Bitmap, + val appGroup: Bitmap, + val widget: Bitmap + ) { + fun recycle() { + background.recycle() + dock.recycle() + appGroup.recycle() + widget.recycle() + } + } + + data class BlurConfig(val getDrawable: (BlurSizes) -> Bitmap, val scale: Int, val radius: Int) + companion object : SingletonHolder( ensureOnMainThread(useApplicationContext(::BlurWallpaperProvider)) ) { + val blurConfigBackground = BlurConfig({ it.background }, 2, 8) + + val blurConfigDock = BlurConfig({ it.dock }, 2, 2) + + val blurConfigAppGroup = BlurConfig({ it.appGroup }, 4, 6) + + val blurConfigWidget = BlurConfig({ it.widget }, 8, 6) + var isEnabled: Boolean = false private var sEnabledFlag: Int = 0 diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt deleted file mode 100644 index fc38be1f99..0000000000 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/ShaderBlurDrawable.kt +++ /dev/null @@ -1,133 +0,0 @@ -package foundation.e.blisslauncher.core.blur - -import android.graphics.Bitmap -import android.graphics.BitmapShader -import android.graphics.Canvas -import android.graphics.ColorFilter -import android.graphics.Paint -import android.graphics.Path -import android.graphics.PixelFormat -import android.graphics.RectF -import android.graphics.Shader -import android.graphics.drawable.Drawable -import foundation.e.blisslauncher.core.DeviceProfile - -class ShaderBlurDrawable -internal constructor(private val blurWallpaperProvider: BlurWallpaperProvider) : - Drawable(), BlurWallpaperProvider.Listener { - - private var blurAlpha = 255 - private val blurPaint = Paint(Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG) - private var blurBitmap: Bitmap? = null - set(value) { - if (field != value) { - field = value - blurPaint.shader = - value?.let { BitmapShader(it, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP) } - } - } - - private val blurBounds = RectF() - private val blurPath = Path() - private var blurPathValid = false - set(value) { - if (field != value) { - field = value - if (!value) { - invalidateSelf() - } - } - } - - var noRadius = true - - override fun draw(canvas: Canvas) = draw(canvas, noRadius) - - fun draw(canvas: Canvas, noRadius: Boolean = false) { - if (blurAlpha == 0) return - blurBitmap = blurWallpaperProvider.wallpapers?.first - - if (blurBitmap == null) { - blurBitmap = blurWallpaperProvider.placeholder - } - blurBitmap = - if ( - blurBitmap!!.height >= blurBounds.bottom && blurBitmap!!.width >= blurBounds.right - ) { - Bitmap.createBitmap( - blurBitmap!!, - blurBounds.left.toInt(), - blurBounds.top.toInt(), - blurBounds.right.toInt() - blurBounds.left.toInt(), - blurBounds.bottom.toInt() - blurBounds.top.toInt() - ) - } else { - blurBitmap - } - - // setupBlurPath() - - // canvas.translate(0f, -1500f) - if (noRadius) { - canvas.drawRect( - 0f, - 0f, - blurBounds.right - blurBounds.left, - blurBounds.bottom - blurBounds.top, - blurPaint - ) - } else { - canvas.drawPath(DeviceProfile.path, blurPaint) - } - // canvas.translate(0f, 1500f) - } - - override fun setAlpha(alpha: Int) { - blurAlpha = alpha - blurPaint.alpha = alpha - } - - override fun getAlpha(): Int { - return blurAlpha - } - - private fun setupBlurPath() { - if (blurPathValid) return - - blurPath.reset() - blurPath.addRect( - 0f, - 0f, - blurBounds.right - blurBounds.left, - blurBounds.bottom - blurBounds.top, - Path.Direction.CW - ) - } - - override fun setBounds(left: Int, top: Int, right: Int, bottom: Int) = - setBlurBounds(left.toFloat(), top.toFloat(), right.toFloat(), bottom.toFloat()) - - fun setBlurBounds(left: Float, top: Float, right: Float, bottom: Float) { - if ( - blurBounds.left != left || - blurBounds.top != top || - blurBounds.right != right || - blurBounds.bottom != bottom - ) { - blurBounds.set(left, top, right, bottom) - blurPathValid = false - } - } - - override fun getOpacity(): Int = PixelFormat.TRANSLUCENT - - override fun onWallpaperChanged() { - invalidateSelf() - } - - override fun setColorFilter(colorFilter: ColorFilter?) {} - - fun startListening() = blurWallpaperProvider.addListener(this) - - fun stopListening() = blurWallpaperProvider.removeListener(this) -} diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt index 9e09c6351b..1e0d61d2a9 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurBackgroundView.kt @@ -6,8 +6,8 @@ import android.graphics.Rect import android.graphics.drawable.Drawable import android.util.AttributeSet import android.view.View +import foundation.e.blisslauncher.core.blur.BlurDrawable import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider -import foundation.e.blisslauncher.core.blur.ShaderBlurDrawable import foundation.e.blisslauncher.core.runOnMainThread class BlurBackgroundView(context: Context, attrs: AttributeSet?) : @@ -15,7 +15,7 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : private val blurWallpaperProvider by lazy { BlurWallpaperProvider.getInstance(context) } - private var fullBlurDrawable: ShaderBlurDrawable? = null + private var fullBlurDrawable: BlurDrawable? = null private var blurAlpha = 255 private val blurDrawableCallback by lazy { @@ -62,10 +62,12 @@ class BlurBackgroundView(context: Context, attrs: AttributeSet?) : } } - private fun createFullBlurDrawable() { + private fun createFullBlurDrawable( + config: BlurWallpaperProvider.BlurConfig = BlurWallpaperProvider.blurConfigBackground + ) { fullBlurDrawable?.let { if (isAttachedToWindow) it.stopListening() } fullBlurDrawable = - blurWallpaperProvider.createDrawable().apply { + blurWallpaperProvider.createBlurDrawable(config).apply { callback = blurDrawableCallback setBounds(left, top, right, bottom) if (isAttachedToWindow) startListening() diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt index 9a64ecf1ce..1b81b2f62d 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/BlurLayout.kt @@ -5,11 +5,12 @@ import android.graphics.Canvas import android.util.AttributeSet import android.widget.FrameLayout import foundation.e.blisslauncher.core.blur.BlurViewDelegate +import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider open class BlurLayout @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : FrameLayout(context, attrs) { - private val delegate = BlurViewDelegate(this, attrs) + private val delegate = BlurViewDelegate(this, BlurWallpaperProvider.blurConfigWidget, attrs) init { setWillNotDraw(false) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt b/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt index b823e18336..bb51163ba6 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/DockGridLayout.kt @@ -7,6 +7,7 @@ import android.util.AttributeSet import android.widget.GridLayout import foundation.e.blisslauncher.BlissLauncher import foundation.e.blisslauncher.core.blur.BlurViewDelegate +import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider import foundation.e.blisslauncher.core.utils.OffsetParent class DockGridLayout @@ -21,7 +22,7 @@ constructor(private val mContext: Context, attrs: AttributeSet? = null, defStyle override val offsetY: Float get() = translationY - private val blurDelegate = BlurViewDelegate(this, attrs) + private val blurDelegate = BlurViewDelegate(this, BlurWallpaperProvider.blurConfigDock, attrs) init { setWillNotDraw(false) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/RoundedWidgetView.java b/app/src/main/java/foundation/e/blisslauncher/core/customviews/RoundedWidgetView.java index b53a81a1cb..c8bb76785a 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/RoundedWidgetView.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/RoundedWidgetView.java @@ -14,6 +14,7 @@ import android.widget.ImageView; import androidx.annotation.Nullable; import foundation.e.blisslauncher.R; import foundation.e.blisslauncher.core.blur.BlurViewDelegate; +import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; import foundation.e.blisslauncher.features.widgets.CheckLongPressHelper; public class RoundedWidgetView extends AppWidgetHostView { @@ -40,7 +41,7 @@ public class RoundedWidgetView extends AppWidgetHostView { this.cornerRadius = context.getResources().getDimensionPixelSize(R.dimen.corner_radius); mLongPressHelper = new CheckLongPressHelper(this); if (blurBackground) { - mBlurDelegate = new BlurViewDelegate(this, null); + mBlurDelegate = new BlurViewDelegate(this, BlurWallpaperProvider.Companion.getBlurConfigWidget(), null); mBlurDelegate.setBlurCornerRadius(cornerRadius); setWillNotDraw(false); setOutlineProvider(mBlurDelegate.getOutlineProvider()); diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java index 54a028dd96..41abadd847 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java @@ -8,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.blur.BlurViewDelegate; +import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; /** Created by falcon on 9/3/18. */ public class SquareFrameLayout extends FrameLayout { @@ -33,12 +34,12 @@ public class SquareFrameLayout extends FrameLayout { int width = getMeasuredWidth(); int height = getMeasuredHeight(); - int size = width < height ? width : height; + int size = Math.min(width, height); setMeasuredDimension(size, size); } public void enableBlur() { - mBlurDelegate = new BlurViewDelegate(this, null); + mBlurDelegate = new BlurViewDelegate(this, BlurWallpaperProvider.Companion.getBlurConfigAppGroup(), null); setWillNotDraw(false); } -- GitLab From d2abd554663d5779c597454cfccbffd38dfd9653 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Tue, 4 Oct 2022 00:35:44 +0530 Subject: [PATCH 02/11] change blur scales and radius for dock --- .../e/blisslauncher/core/blur/BlurWallpaperProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index 617955d9ea..499c2e5a4c 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -244,7 +244,7 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigBackground = BlurConfig({ it.background }, 2, 8) - val blurConfigDock = BlurConfig({ it.dock }, 2, 2) + val blurConfigDock = BlurConfig({ it.dock }, 1, 0) val blurConfigAppGroup = BlurConfig({ it.appGroup }, 4, 6) -- GitLab From 1c237e58c4351d4d2cbc2cfd7d156d225b9805f7 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Tue, 4 Oct 2022 01:21:39 +0530 Subject: [PATCH 03/11] test: add color field inside BlurConfig --- .../core/blur/BlurWallpaperProvider.kt | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index 499c2e5a4c..cb2a24a70c 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -4,11 +4,7 @@ import android.Manifest import android.app.WallpaperManager import android.content.Context import android.content.pm.PackageManager -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.ColorMatrix -import android.graphics.ColorMatrixColorFilter -import android.graphics.Paint +import android.graphics.* import android.util.DisplayMetrics import android.util.Log import android.view.WindowManager @@ -185,8 +181,7 @@ class BlurWallpaperProvider(val context: Context) { navigationBarHeight = context.getResources().getDimensionPixelSize(resourceId); } }*/ - val y: Int - y = + val y: Int = if (scaledWallpaper.height > height) { (scaledWallpaper.height - height) / 2 } else 0 @@ -235,7 +230,12 @@ class BlurWallpaperProvider(val context: Context) { } } - data class BlurConfig(val getDrawable: (BlurSizes) -> Bitmap, val scale: Int, val radius: Int) + data class BlurConfig( + val getDrawable: (BlurSizes) -> Bitmap, + val scale: Int, + val radius: Int, + val color: Int = Color.BLACK + ) companion object : SingletonHolder( @@ -246,9 +246,9 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigDock = BlurConfig({ it.dock }, 1, 0) - val blurConfigAppGroup = BlurConfig({ it.appGroup }, 4, 6) + val blurConfigAppGroup = BlurConfig({ it.appGroup }, 5, 6, Color.parseColor("#202020")) - val blurConfigWidget = BlurConfig({ it.widget }, 8, 6) + val blurConfigWidget = BlurConfig({ it.widget }, 3, 10, Color.parseColor("#202020")) var isEnabled: Boolean = false private var sEnabledFlag: Int = 0 -- GitLab From f53406c9a7075a012ccb5465f307db6f18e4c639 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Tue, 4 Oct 2022 16:35:59 +0530 Subject: [PATCH 04/11] change blur radius and scales for widgets and app group --- .../blisslauncher/core/blur/BlurWallpaperProvider.kt | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index cb2a24a70c..30fd95dd5b 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -230,12 +230,7 @@ class BlurWallpaperProvider(val context: Context) { } } - data class BlurConfig( - val getDrawable: (BlurSizes) -> Bitmap, - val scale: Int, - val radius: Int, - val color: Int = Color.BLACK - ) + data class BlurConfig(val getDrawable: (BlurSizes) -> Bitmap, val scale: Int, val radius: Int) companion object : SingletonHolder( @@ -246,9 +241,9 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigDock = BlurConfig({ it.dock }, 1, 0) - val blurConfigAppGroup = BlurConfig({ it.appGroup }, 5, 6, Color.parseColor("#202020")) + val blurConfigAppGroup = BlurConfig({ it.appGroup }, 5, 5) - val blurConfigWidget = BlurConfig({ it.widget }, 3, 10, Color.parseColor("#202020")) + val blurConfigWidget = BlurConfig({ it.widget }, 6, 10) var isEnabled: Boolean = false private var sEnabledFlag: Int = 0 -- GitLab From d9e25463b8035473203234dc43aa18a9c66f5543 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Tue, 4 Oct 2022 18:13:33 +0530 Subject: [PATCH 05/11] testing blur drawable for apps folder background --- .../core/blur/BlurWallpaperProvider.kt | 2 +- .../features/launcher/LauncherActivity.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index 30fd95dd5b..dbfd9e200a 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -241,7 +241,7 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigDock = BlurConfig({ it.dock }, 1, 0) - val blurConfigAppGroup = BlurConfig({ it.appGroup }, 5, 5) + val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) val blurConfigWidget = BlurConfig({ it.widget }, 6, 10) diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 939f68730d..32ae040b5b 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -98,6 +98,7 @@ import foundation.e.blisslauncher.core.Alarm; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.Preferences; import foundation.e.blisslauncher.core.Utilities; +import foundation.e.blisslauncher.core.blur.BlurDrawable; import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; import foundation.e.blisslauncher.core.broadcast.ManagedProfileBroadcastReceiver; import foundation.e.blisslauncher.core.broadcast.TimeChangeBroadcastReceiver; @@ -180,6 +181,7 @@ public class LauncherActivity extends AppCompatActivity private DockGridLayout mDock; private PageIndicatorLinearLayout mIndicator; private ViewGroup mFolderWindowContainer; + private LinearLayout mFolderAppsBackground; private ViewPager mFolderAppsViewPager; private BlissInput mFolderTitleInput; private BlissInput mSearchInput; @@ -252,6 +254,9 @@ public class LauncherActivity extends AppCompatActivity private LayoutInflater mLightLayoutInflater; private WindowInsetsControllerCompat mInsetsController; + private BlurDrawable mBlurDrawable = null; + // Save old bg drawable to reset on animation cancel + private Drawable oldBg; public static LauncherActivity getLauncher(Context context) { if (context instanceof LauncherActivity) { @@ -368,11 +373,17 @@ public class LauncherActivity extends AppCompatActivity mIndicator = mLauncherView.findViewById(R.id.page_indicator); mFolderWindowContainer = mLauncherView.findViewById(R.id.folder_window_container); mFolderAppsViewPager = mLauncherView.findViewById(R.id.folder_apps); + mFolderAppsBackground = mLauncherView.findViewById(R.id.folder_apps_background); mFolderTitleInput = mLauncherView.findViewById(R.id.folder_title); mProgressBar = mLauncherView.findViewById(R.id.progressbar); swipeSearchContainer = mLauncherView.findViewById(R.id.swipe_search_container); maxDistanceForFolderCreation = (int) (0.45f * mDeviceProfile.iconSizePx); + mBlurDrawable = BlurWallpaperProvider.Companion.getInstance(getApplicationContext()) + .createBlurDrawable(BlurWallpaperProvider.Companion.getBlurConfigAppGroup()); + + oldBg = mFolderAppsBackground.getBackground(); + scrollCorner = mDeviceProfile.iconDrawablePaddingPx / 2; wobbleAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble); @@ -2740,6 +2751,11 @@ public class LauncherActivity extends AppCompatActivity startBounds.bottom += deltaHeight; } + // Set blurDrawable offsets to match evenly with background + // TODO: fix y offset for all screen widths + mBlurDrawable.setOffsets(finalBounds.right / 8, finalBounds.bottom / 3.8f); + Log.d(TAG, "Bounds: " + startBounds); + // Construct and run the parallel animation of the four translation and // scale properties (X, Y, SCALE_X, and SCALE_Y). AnimatorSet set = new AnimatorSet(); @@ -2780,6 +2796,7 @@ public class LauncherActivity extends AppCompatActivity mHorizontalPager.setAlpha(0f); mIndicator.setAlpha(0f); mDock.setAlpha(0f); + mFolderAppsBackground.setBackgroundDrawable(mBlurDrawable); } @Override @@ -2798,6 +2815,7 @@ public class LauncherActivity extends AppCompatActivity mFolderTitleInput.setText(app.title); mFolderTitleInput.setCursorVisible(false); + mFolderAppsBackground.setBackgroundDrawable(oldBg); mFolderAppsViewPager.setAdapter(new FolderAppsPagerAdapter(this, app.items)); mFolderAppsViewPager.getLayoutParams().width = mDeviceProfile.cellWidthPx * 3 -- GitLab From 6d43032311dfd32b885e133befc73210cb0070a6 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Wed, 5 Oct 2022 12:48:05 +0530 Subject: [PATCH 06/11] use BlurLayout for blur on folder background --- .../features/launcher/LauncherActivity.java | 16 ------- app/src/main/res/layout/activity_main.xml | 48 +++++++++++-------- 2 files changed, 28 insertions(+), 36 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index 32ae040b5b..ba4d1ce342 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -98,7 +98,6 @@ import foundation.e.blisslauncher.core.Alarm; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.Preferences; import foundation.e.blisslauncher.core.Utilities; -import foundation.e.blisslauncher.core.blur.BlurDrawable; import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; import foundation.e.blisslauncher.core.broadcast.ManagedProfileBroadcastReceiver; import foundation.e.blisslauncher.core.broadcast.TimeChangeBroadcastReceiver; @@ -181,7 +180,6 @@ public class LauncherActivity extends AppCompatActivity private DockGridLayout mDock; private PageIndicatorLinearLayout mIndicator; private ViewGroup mFolderWindowContainer; - private LinearLayout mFolderAppsBackground; private ViewPager mFolderAppsViewPager; private BlissInput mFolderTitleInput; private BlissInput mSearchInput; @@ -254,7 +252,6 @@ public class LauncherActivity extends AppCompatActivity private LayoutInflater mLightLayoutInflater; private WindowInsetsControllerCompat mInsetsController; - private BlurDrawable mBlurDrawable = null; // Save old bg drawable to reset on animation cancel private Drawable oldBg; @@ -373,17 +370,11 @@ public class LauncherActivity extends AppCompatActivity mIndicator = mLauncherView.findViewById(R.id.page_indicator); mFolderWindowContainer = mLauncherView.findViewById(R.id.folder_window_container); mFolderAppsViewPager = mLauncherView.findViewById(R.id.folder_apps); - mFolderAppsBackground = mLauncherView.findViewById(R.id.folder_apps_background); mFolderTitleInput = mLauncherView.findViewById(R.id.folder_title); mProgressBar = mLauncherView.findViewById(R.id.progressbar); swipeSearchContainer = mLauncherView.findViewById(R.id.swipe_search_container); maxDistanceForFolderCreation = (int) (0.45f * mDeviceProfile.iconSizePx); - mBlurDrawable = BlurWallpaperProvider.Companion.getInstance(getApplicationContext()) - .createBlurDrawable(BlurWallpaperProvider.Companion.getBlurConfigAppGroup()); - - oldBg = mFolderAppsBackground.getBackground(); - scrollCorner = mDeviceProfile.iconDrawablePaddingPx / 2; wobbleAnimation = AnimationUtils.loadAnimation(this, R.anim.wobble); @@ -2751,11 +2742,6 @@ public class LauncherActivity extends AppCompatActivity startBounds.bottom += deltaHeight; } - // Set blurDrawable offsets to match evenly with background - // TODO: fix y offset for all screen widths - mBlurDrawable.setOffsets(finalBounds.right / 8, finalBounds.bottom / 3.8f); - Log.d(TAG, "Bounds: " + startBounds); - // Construct and run the parallel animation of the four translation and // scale properties (X, Y, SCALE_X, and SCALE_Y). AnimatorSet set = new AnimatorSet(); @@ -2796,7 +2782,6 @@ public class LauncherActivity extends AppCompatActivity mHorizontalPager.setAlpha(0f); mIndicator.setAlpha(0f); mDock.setAlpha(0f); - mFolderAppsBackground.setBackgroundDrawable(mBlurDrawable); } @Override @@ -2815,7 +2800,6 @@ public class LauncherActivity extends AppCompatActivity mFolderTitleInput.setText(app.title); mFolderTitleInput.setCursorVisible(false); - mFolderAppsBackground.setBackgroundDrawable(oldBg); mFolderAppsViewPager.setAdapter(new FolderAppsPagerAdapter(this, app.items)); mFolderAppsViewPager.getLayoutParams().width = mDeviceProfile.cellWidthPx * 3 diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2b31b02c32..69839982e7 100755 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,7 +1,7 @@ + android:focusable="true" + android:visibility="gone"> - + app:blurCornerRadius="12dp"> - + android:layout_height="wrap_content" + android:layout_centerInParent="true" + android:background="@drawable/folder_window" + android:orientation="vertical"> + + - + - + + -- GitLab From 5f5a4f553d1763e8160082c79189067a11159411 Mon Sep 17 00:00:00 2001 From: Yash-Garg Date: Tue, 18 Oct 2022 17:37:25 +0530 Subject: [PATCH 07/11] chore: set dock blur scale to 2 --- .../e/blisslauncher/core/blur/BlurWallpaperProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index dbfd9e200a..d18fbd9a5c 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -239,7 +239,7 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigBackground = BlurConfig({ it.background }, 2, 8) - val blurConfigDock = BlurConfig({ it.dock }, 1, 0) + val blurConfigDock = BlurConfig({ it.dock }, 2, 0) val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) -- GitLab From 772cc8b8eed438c8ea242650c66fcec415147479 Mon Sep 17 00:00:00 2001 From: Yash-Garg Date: Tue, 8 Nov 2022 16:54:33 +0530 Subject: [PATCH 08/11] remove unused variable from LauncherActivity Signed-off-by: Yash-Garg --- .../e/blisslauncher/features/launcher/LauncherActivity.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java index fcee30724e..14b7a12517 100755 --- a/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java +++ b/app/src/main/java/foundation/e/blisslauncher/features/launcher/LauncherActivity.java @@ -262,8 +262,6 @@ public class LauncherActivity extends AppCompatActivity private LayoutInflater mLightLayoutInflater; private WindowInsetsControllerCompat mInsetsController; - // Save old bg drawable to reset on animation cancel - private Drawable oldBg; public static LauncherActivity getLauncher(Context context) { if (context instanceof LauncherActivity) { -- GitLab From 1a071db2ff2e32ed31fdb494bccae31043b7b131 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Wed, 16 Nov 2022 14:27:27 +0530 Subject: [PATCH 09/11] increase dock blur values --- .../e/blisslauncher/core/blur/BlurWallpaperProvider.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index d18fbd9a5c..b82454016b 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -239,7 +239,7 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigBackground = BlurConfig({ it.background }, 2, 8) - val blurConfigDock = BlurConfig({ it.dock }, 2, 0) + val blurConfigDock = BlurConfig({ it.dock }, 3, 1) val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) -- GitLab From f087b7001b2941669b900f6555c5743c9bc4006e Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Wed, 16 Nov 2022 20:04:30 +0530 Subject: [PATCH 10/11] add blur offset and color to app group and folder --- .../e/blisslauncher/core/blur/BlurViewDelegate.kt | 13 +++++++++---- .../core/blur/BlurWallpaperProvider.kt | 2 +- .../core/customviews/SquareFrameLayout.java | 3 +++ app/src/main/res/layout/activity_main.xml | 4 +++- app/src/main/res/values/attrs.xml | 1 + app/src/main/res/values/colors.xml | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt index 18b3073740..3a46792ba3 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurViewDelegate.kt @@ -65,6 +65,7 @@ class BlurViewDelegate( } var blurCornerRadius = 0f + var overlayOffset = 70f val outlineProvider = object : ViewOutlineProvider() { override fun getOutline(view: View, outline: Outline) { @@ -77,9 +78,10 @@ class BlurViewDelegate( field = value overlayPaint.color = value } + private val overlayPaint = Paint(Paint.FILTER_BITMAP_FLAG or Paint.ANTI_ALIAS_FLAG).apply { - blendMode = BlendMode.OVERLAY + blendMode = BlendMode.MULTIPLY } init { @@ -90,6 +92,7 @@ class BlurViewDelegate( val a = context.obtainStyledAttributes(attrs, R.styleable.BlurLayout) blurCornerRadius = a.getDimension(R.styleable.BlurLayout_blurCornerRadius, 0f) overlayColor = a.getColor(R.styleable.BlurLayout_blurOverlayColor, 0) + overlayOffset = a.getInt(R.styleable.BlurLayout_blurOverlayOffset, 70).toFloat() a.recycle() } } @@ -121,11 +124,13 @@ class BlurViewDelegate( this.draw(canvas) } if (overlayColor != 0) { - canvas.drawRect( - view.left.toFloat(), - view.top.toFloat(), + canvas.drawRoundRect( + view.left.toFloat() - overlayOffset, + view.top.toFloat() - overlayOffset, view.right.toFloat(), view.bottom.toFloat(), + view.x, + view.y, overlayPaint ) } diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index b82454016b..67c65e9527 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -239,7 +239,7 @@ class BlurWallpaperProvider(val context: Context) { val blurConfigBackground = BlurConfig({ it.background }, 2, 8) - val blurConfigDock = BlurConfig({ it.dock }, 3, 1) + val blurConfigDock = BlurConfig({ it.dock }, 1, 2) val blurConfigAppGroup = BlurConfig({ it.appGroup }, 6, 8) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java index 41abadd847..511549e018 100755 --- a/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java +++ b/app/src/main/java/foundation/e/blisslauncher/core/customviews/SquareFrameLayout.java @@ -6,6 +6,8 @@ import android.util.AttributeSet; import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; + +import foundation.e.blisslauncher.R; import foundation.e.blisslauncher.core.DeviceProfile; import foundation.e.blisslauncher.core.blur.BlurViewDelegate; import foundation.e.blisslauncher.core.blur.BlurWallpaperProvider; @@ -40,6 +42,7 @@ public class SquareFrameLayout extends FrameLayout { public void enableBlur() { mBlurDelegate = new BlurViewDelegate(this, BlurWallpaperProvider.Companion.getBlurConfigAppGroup(), null); + mBlurDelegate.setOverlayColor(getContext().getColor(R.color.blur_overlay)); setWillNotDraw(false); } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 69839982e7..ca45e2043b 100755 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -71,7 +71,9 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" - app:blurCornerRadius="12dp"> + app:blurCornerRadius="12dp" + app:blurOverlayColor="@color/blur_overlay" + app:blurOverlayOffset="2000"> + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 09815dfd60..06352ae3f9 100755 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -34,4 +34,5 @@ #26ffffff @color/colorAccent + #38202020 -- GitLab From 1e83f728cd66196809dd904c1f9daf2e83428615 Mon Sep 17 00:00:00 2001 From: Yash Garg Date: Tue, 22 Nov 2022 12:51:37 +0530 Subject: [PATCH 11/11] chore: some formatting and import changes --- .../e/blisslauncher/core/blur/BlurWallpaperProvider.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt index 67c65e9527..afa55ca301 100644 --- a/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt +++ b/app/src/main/java/foundation/e/blisslauncher/core/blur/BlurWallpaperProvider.kt @@ -4,7 +4,11 @@ import android.Manifest import android.app.WallpaperManager import android.content.Context import android.content.pm.PackageManager -import android.graphics.* +import android.graphics.Bitmap +import android.graphics.Canvas +import android.graphics.ColorMatrix +import android.graphics.ColorMatrixColorFilter +import android.graphics.Paint import android.util.DisplayMetrics import android.util.Log import android.view.WindowManager @@ -201,9 +205,7 @@ class BlurWallpaperProvider(val context: Context) { listeners.remove(listener) } - fun createBlurDrawable(config: BlurConfig = blurConfigDock): BlurDrawable { - return BlurDrawable(this, config) - } + fun createBlurDrawable(config: BlurConfig = blurConfigDock) = BlurDrawable(this, config) interface Listener { fun onWallpaperChanged() {} -- GitLab