Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 126df206 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Bypass resources in DropTargetView

Flag: com.android.wm.shell.enable_bubble_to_fullscreen
Bug: 393173014
Test: treehugger
Change-Id: I7b1f6a328e7cb530df64f0b452cd120008633bd2
parent b946040e
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.util.TypedValue
import android.view.View
import com.android.wm.shell.shared.R

@@ -37,14 +38,21 @@ class DropTargetView(context: Context) : View(context) {
    private val strokePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
        color = context.getColor(com.android.internal.R.color.materialColorPrimaryContainer)
        style = Paint.Style.STROKE
        strokeWidth = context.resources.getDimensionPixelSize(R.dimen.drop_target_stroke).toFloat()
        strokeWidth = 1.dpToPx()
    }

    private val cornerRadius = context.resources.getDimensionPixelSize(
        R.dimen.drop_target_radius).toFloat()
    private val cornerRadius = 28.dpToPx()

    private val rect = RectF(0f, 0f, 0f, 0f)

    // TODO b/396539130: Use shared xml resources once we can access them in launcher
    private fun Int.dpToPx() =
        TypedValue.applyDimension(
                TypedValue.COMPLEX_UNIT_DIP,
                this.toFloat(),
                context.resources.displayMetrics
            )

    override fun onDraw(canvas: Canvas) {
        canvas.save()
        canvas.drawRoundRect(rect, cornerRadius, cornerRadius, rectPaint)