mirror of
https://github.com/jrpie/Launcher.git
synced 2025-05-17 16:01:10 +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 {
|
||||
|
||||
private val paint = Paint()
|
||||
private val handlePaint = Paint()
|
||||
private val selectedHandlePaint = Paint()
|
||||
|
||||
private val popupAnchor = View(context)
|
||||
|
||||
val paint = Paint()
|
||||
val handlePaint = Paint()
|
||||
val selectedHandlePaint = Paint()
|
||||
var mode: WidgetManagerView.EditMode? = null
|
||||
|
||||
class Handle(val mode: WidgetManagerView.EditMode, val position: Rect)
|
||||
init {
|
||||
addView(popupAnchor)
|
||||
setWillNotDraw(false)
|
||||
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.setARGB(100, 255, 255, 255)
|
||||
handlePaint.setShadowLayer(10f,0f,0f, Color.BLACK)
|
||||
|
||||
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
|
||||
|
@ -80,14 +86,15 @@ class WidgetOverlayView : ViewGroup {
|
|||
}
|
||||
}
|
||||
val bounds = getBounds()
|
||||
|
||||
canvas.drawRoundRect(bounds.toRectF(), 5f, 5f, paint)
|
||||
|
||||
if (mode == null) {
|
||||
return
|
||||
}
|
||||
|
||||
//preview?.bounds = bounds
|
||||
//preview?.draw(canvas)
|
||||
}
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {
|
||||
popupAnchor.layout(0,0,0,0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue