mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 02:16:49 +00:00
The small size of the screenshots and make text look odd. Implementing new UI specs to improve this. - Updated icon position and size - Added some blur to the thumbnail Flag: LEGACY ENABLE_KEYBOARD_QUICK_SWITCH ENABLED Fixes: 328259439 Fixes: 328692456 Test: opened KQS in dark and light mode (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dba7cbae1adfde615060598a55b5ee0edfedef9f) Merged-In: I2b20100ddeb562291edf5f0bacbce916002eee45 Change-Id: I2b20100ddeb562291edf5f0bacbce916002eee45 24D1-dev is based on 24Q2-release. Therefore, we merged this CL to 24D1-dev.
60 lines
2.1 KiB
Kotlin
60 lines
2.1 KiB
Kotlin
/*
|
|
* Copyright (C) 2024 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.android.launcher3.taskbar
|
|
|
|
import android.graphics.Bitmap
|
|
import android.graphics.Canvas
|
|
import android.graphics.PixelFormat
|
|
import android.graphics.RenderEffect
|
|
import android.graphics.RenderNode
|
|
import android.graphics.Shader
|
|
import android.graphics.drawable.BitmapDrawable
|
|
import android.graphics.drawable.DrawableWrapper
|
|
|
|
/* BitmapDrawable that can blur the given bitmap. */
|
|
class BlurredBitmapDrawable(bitmap: Bitmap?, radiusX: Float, radiusY: Float) :
|
|
DrawableWrapper(BitmapDrawable(bitmap)) {
|
|
private val mBlurRenderNode: RenderNode = RenderNode("BlurredConstraintLayoutBlurNode")
|
|
|
|
constructor(bitmap: Bitmap?, radius: Float) : this(bitmap, radius, radius)
|
|
|
|
init {
|
|
mBlurRenderNode.setRenderEffect(
|
|
RenderEffect.createBlurEffect(radiusX, radiusY, Shader.TileMode.CLAMP)
|
|
)
|
|
}
|
|
|
|
override fun draw(canvas: Canvas) {
|
|
if (!canvas.isHardwareAccelerated) {
|
|
super.draw(canvas)
|
|
return
|
|
}
|
|
mBlurRenderNode.setPosition(bounds)
|
|
if (!mBlurRenderNode.hasDisplayList()) {
|
|
// Record render node if its display list is not recorded or discarded
|
|
// (which happens when it's no longer drawn by anything).
|
|
val recordingCanvas = mBlurRenderNode.beginRecording()
|
|
super.draw(recordingCanvas)
|
|
mBlurRenderNode.endRecording()
|
|
}
|
|
canvas.drawRenderNode(mBlurRenderNode)
|
|
}
|
|
|
|
override fun getOpacity(): Int {
|
|
return PixelFormat.OPAQUE
|
|
}
|
|
}
|