mirror of
https://github.com/jrpie/Launcher.git
synced 2025-05-18 00:11:48 +02:00
fix #161 - draw shadow around widget control elements
This commit is contained in:
parent
1ba7479469
commit
23bc58806c
1 changed files with 13 additions and 6 deletions
|
@ -24,24 +24,30 @@ private const val HANDLE_EDGE_SIZE = (1.2 * HANDLE_SIZE).toInt()
|
||||||
*/
|
*/
|
||||||
class WidgetOverlayView : ViewGroup {
|
class WidgetOverlayView : ViewGroup {
|
||||||
|
|
||||||
|
private val paint = Paint()
|
||||||
|
private val handlePaint = Paint()
|
||||||
|
private val selectedHandlePaint = Paint()
|
||||||
|
|
||||||
private val popupAnchor = View(context)
|
private val popupAnchor = View(context)
|
||||||
|
|
||||||
val paint = Paint()
|
|
||||||
val handlePaint = Paint()
|
|
||||||
val selectedHandlePaint = Paint()
|
|
||||||
var mode: WidgetManagerView.EditMode? = null
|
var mode: WidgetManagerView.EditMode? = null
|
||||||
|
|
||||||
class Handle(val mode: WidgetManagerView.EditMode, val position: Rect)
|
class Handle(val mode: WidgetManagerView.EditMode, val position: Rect)
|
||||||
init {
|
init {
|
||||||
addView(popupAnchor)
|
addView(popupAnchor)
|
||||||
setWillNotDraw(false)
|
setWillNotDraw(false)
|
||||||
handlePaint.style = Paint.Style.STROKE
|
handlePaint.style = Paint.Style.STROKE
|
||||||
handlePaint.setARGB(255, 255, 255, 255)
|
handlePaint.color = Color.WHITE
|
||||||
|
handlePaint.strokeWidth = 2f
|
||||||
|
handlePaint.setShadowLayer(10f,0f,0f, Color.BLACK)
|
||||||
|
|
||||||
selectedHandlePaint.style = Paint.Style.FILL_AND_STROKE
|
selectedHandlePaint.style = Paint.Style.FILL_AND_STROKE
|
||||||
selectedHandlePaint.setARGB(100, 255, 255, 255)
|
selectedHandlePaint.setARGB(100, 255, 255, 255)
|
||||||
|
handlePaint.setShadowLayer(10f,0f,0f, Color.BLACK)
|
||||||
|
|
||||||
paint.style = Paint.Style.STROKE
|
paint.style = Paint.Style.STROKE
|
||||||
paint.setARGB(255, 255, 255, 255)
|
paint.color = Color.WHITE
|
||||||
|
paint.setShadowLayer(10f,0f,0f, Color.BLACK)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var preview: Drawable? = null
|
private var preview: Drawable? = null
|
||||||
|
@ -80,14 +86,15 @@ class WidgetOverlayView : ViewGroup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val bounds = getBounds()
|
val bounds = getBounds()
|
||||||
|
|
||||||
canvas.drawRoundRect(bounds.toRectF(), 5f, 5f, paint)
|
canvas.drawRoundRect(bounds.toRectF(), 5f, 5f, paint)
|
||||||
|
|
||||||
if (mode == null) {
|
if (mode == null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//preview?.bounds = bounds
|
//preview?.bounds = bounds
|
||||||
//preview?.draw(canvas)
|
//preview?.draw(canvas)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||||
popupAnchor.layout(0,0,0,0)
|
popupAnchor.layout(0,0,0,0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue