Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersDrawable.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersDrawable.kt +2 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.android.wm.shell.common.ShellExecutor /** * Rounded corner [Drawable] implementation */ class RoundedCornersDrawable( class LetterboxRoundedCornersDrawable( private var cornerColor: Color, private var radius: Float = 0f ) : Drawable() { Loading Loading @@ -181,7 +181,7 @@ class RoundedCornersDrawable( private fun RectF.toRect() = Rect(this.top.toInt(), this.left.toInt(), this.right.toInt(), this.bottom.toInt()) fun flip(flipType: FlipType): RoundedCornersDrawable { fun flip(flipType: FlipType): LetterboxRoundedCornersDrawable { when (flipType) { FlipType.FLIP_VERTICAL -> verticalFlipped = !verticalFlipped FlipType.FLIP_HORIZONTAL -> horizontalFlipped = !horizontalFlipped Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersFactory.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersDrawableFactory.kt +8 −8 Original line number Diff line number Diff line Loading @@ -18,25 +18,25 @@ package com.android.wm.shell.compatui.letterbox.roundedcorners import android.graphics.Color import android.graphics.drawable.Drawable import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawable.FlipType.FLIP_HORIZONTAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawable.FlipType.FLIP_VERTICAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position import com.android.wm.shell.compatui.letterbox.roundedcorners.LetterboxRoundedCornersDrawable.FlipType.FLIP_HORIZONTAL import com.android.wm.shell.compatui.letterbox.roundedcorners.LetterboxRoundedCornersDrawable.FlipType.FLIP_VERTICAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position import com.android.wm.shell.dagger.WMSingleton import javax.inject.Inject /** * [RoundedCornersFactory] implementation returning rounded corners [Drawable]s using * [LetterboxRoundedCornersFactory] implementation returning rounded corners [Drawable]s using * SVG format. */ @WMSingleton class LetterboxRoundedCornersFactory @Inject constructor( ) : RoundedCornersFactory<RoundedCornersDrawable> { class LetterboxRoundedCornersDrawableFactory @Inject constructor( ) : RoundedCornersDrawableFactory<LetterboxRoundedCornersDrawable> { override fun getRoundedCornerDrawable( color: Color, position: Position, radius: Float ): RoundedCornersDrawable { val corners = RoundedCornersDrawable(color, radius) ): LetterboxRoundedCornersDrawable { val corners = LetterboxRoundedCornersDrawable(color, radius) return when (position) { Position.TOP_LEFT -> corners Position.TOP_RIGHT -> corners.flip(FLIP_HORIZONTAL) Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersFactory.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersDrawableFactory.kt +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.graphics.drawable.Drawable /** * Abstraction for the object responsible of the creation of the rounded corners Drawables. */ interface RoundedCornersFactory<T : Drawable> { interface RoundedCornersDrawableFactory<T : Drawable> { enum class Position { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT } Loading libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/AppCompatRoundedCornersSurface.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersSurface.kt +13 −10 Original line number Diff line number Diff line Loading @@ -36,25 +36,28 @@ import android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY import android.view.WindowlessWindowManager import android.widget.FrameLayout import android.window.TaskConstants import android.window.TaskConstants.TASK_CHILD_SHELL_LAYER_LETTERBOX_ROUNDED_CORNERS import com.android.wm.shell.R import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.suppliers.SurfaceBuilderSupplier import com.android.wm.shell.compatui.letterbox.LetterboxConfiguration import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.BOTTOM_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.BOTTOM_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.TOP_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.TOP_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.BOTTOM_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.BOTTOM_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.TOP_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.TOP_RIGHT /** * Overlay responsible for handling letterbox rounded corners in Shell. */ class AppCompatRoundedCornersSurface( class RoundedCornersSurface( private val context: Context, config: Configuration?, private val syncQueue: SyncTransactionQueue, private val parentSurface: SurfaceControl, private val cornersFactory: LetterboxRoundedCornersFactory, private val letterboxConfiguration: LetterboxConfiguration private val cornersFactory: LetterboxRoundedCornersDrawableFactory, private val letterboxConfiguration: LetterboxConfiguration, private val surfaceBuilderSupplier: SurfaceBuilderSupplier ) : WindowlessWindowManager(config, parentSurface, /* hostInputToken */ null) { private var viewHost: SurfaceControlViewHost? = null Loading Loading @@ -90,7 +93,7 @@ class AppCompatRoundedCornersSurface( attrs: WindowManager.LayoutParams ): SurfaceControl { val className = javaClass.simpleName val builder = SurfaceControl.Builder() val builder = surfaceBuilderSupplier.get() .setContainerLayer() .setName(className + "Leash") .setHidden(false) Loading Loading @@ -169,7 +172,7 @@ class AppCompatRoundedCornersSurface( visible: Boolean, immediate: Boolean = false ) { val drawable = background as? RoundedCornersDrawable val drawable = background as? LetterboxRoundedCornersDrawable drawable?.let { if (visible) it.show(executor, immediate) else it.hide(executor, immediate) } Loading Loading @@ -238,7 +241,7 @@ class AppCompatRoundedCornersSurface( } private fun View.applyCornerAttrs( position: RoundedCornersFactory.Position, position: RoundedCornersDrawableFactory.Position, radius: Float, cornerGravity: Int, color: Color Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersDrawable.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersDrawable.kt +2 −2 Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ import com.android.wm.shell.common.ShellExecutor /** * Rounded corner [Drawable] implementation */ class RoundedCornersDrawable( class LetterboxRoundedCornersDrawable( private var cornerColor: Color, private var radius: Float = 0f ) : Drawable() { Loading Loading @@ -181,7 +181,7 @@ class RoundedCornersDrawable( private fun RectF.toRect() = Rect(this.top.toInt(), this.left.toInt(), this.right.toInt(), this.bottom.toInt()) fun flip(flipType: FlipType): RoundedCornersDrawable { fun flip(flipType: FlipType): LetterboxRoundedCornersDrawable { when (flipType) { FlipType.FLIP_VERTICAL -> verticalFlipped = !verticalFlipped FlipType.FLIP_HORIZONTAL -> horizontalFlipped = !horizontalFlipped Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersFactory.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/LetterboxRoundedCornersDrawableFactory.kt +8 −8 Original line number Diff line number Diff line Loading @@ -18,25 +18,25 @@ package com.android.wm.shell.compatui.letterbox.roundedcorners import android.graphics.Color import android.graphics.drawable.Drawable import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawable.FlipType.FLIP_HORIZONTAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawable.FlipType.FLIP_VERTICAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position import com.android.wm.shell.compatui.letterbox.roundedcorners.LetterboxRoundedCornersDrawable.FlipType.FLIP_HORIZONTAL import com.android.wm.shell.compatui.letterbox.roundedcorners.LetterboxRoundedCornersDrawable.FlipType.FLIP_VERTICAL import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position import com.android.wm.shell.dagger.WMSingleton import javax.inject.Inject /** * [RoundedCornersFactory] implementation returning rounded corners [Drawable]s using * [LetterboxRoundedCornersFactory] implementation returning rounded corners [Drawable]s using * SVG format. */ @WMSingleton class LetterboxRoundedCornersFactory @Inject constructor( ) : RoundedCornersFactory<RoundedCornersDrawable> { class LetterboxRoundedCornersDrawableFactory @Inject constructor( ) : RoundedCornersDrawableFactory<LetterboxRoundedCornersDrawable> { override fun getRoundedCornerDrawable( color: Color, position: Position, radius: Float ): RoundedCornersDrawable { val corners = RoundedCornersDrawable(color, radius) ): LetterboxRoundedCornersDrawable { val corners = LetterboxRoundedCornersDrawable(color, radius) return when (position) { Position.TOP_LEFT -> corners Position.TOP_RIGHT -> corners.flip(FLIP_HORIZONTAL) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersFactory.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersDrawableFactory.kt +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.graphics.drawable.Drawable /** * Abstraction for the object responsible of the creation of the rounded corners Drawables. */ interface RoundedCornersFactory<T : Drawable> { interface RoundedCornersDrawableFactory<T : Drawable> { enum class Position { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/AppCompatRoundedCornersSurface.kt→libs/WindowManager/Shell/src/com/android/wm/shell/compatui/letterbox/roundedcorners/RoundedCornersSurface.kt +13 −10 Original line number Diff line number Diff line Loading @@ -36,25 +36,28 @@ import android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY import android.view.WindowlessWindowManager import android.widget.FrameLayout import android.window.TaskConstants import android.window.TaskConstants.TASK_CHILD_SHELL_LAYER_LETTERBOX_ROUNDED_CORNERS import com.android.wm.shell.R import com.android.wm.shell.common.ShellExecutor import com.android.wm.shell.common.SyncTransactionQueue import com.android.wm.shell.common.suppliers.SurfaceBuilderSupplier import com.android.wm.shell.compatui.letterbox.LetterboxConfiguration import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.BOTTOM_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.BOTTOM_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.TOP_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersFactory.Position.TOP_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.BOTTOM_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.BOTTOM_RIGHT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.TOP_LEFT import com.android.wm.shell.compatui.letterbox.roundedcorners.RoundedCornersDrawableFactory.Position.TOP_RIGHT /** * Overlay responsible for handling letterbox rounded corners in Shell. */ class AppCompatRoundedCornersSurface( class RoundedCornersSurface( private val context: Context, config: Configuration?, private val syncQueue: SyncTransactionQueue, private val parentSurface: SurfaceControl, private val cornersFactory: LetterboxRoundedCornersFactory, private val letterboxConfiguration: LetterboxConfiguration private val cornersFactory: LetterboxRoundedCornersDrawableFactory, private val letterboxConfiguration: LetterboxConfiguration, private val surfaceBuilderSupplier: SurfaceBuilderSupplier ) : WindowlessWindowManager(config, parentSurface, /* hostInputToken */ null) { private var viewHost: SurfaceControlViewHost? = null Loading Loading @@ -90,7 +93,7 @@ class AppCompatRoundedCornersSurface( attrs: WindowManager.LayoutParams ): SurfaceControl { val className = javaClass.simpleName val builder = SurfaceControl.Builder() val builder = surfaceBuilderSupplier.get() .setContainerLayer() .setName(className + "Leash") .setHidden(false) Loading Loading @@ -169,7 +172,7 @@ class AppCompatRoundedCornersSurface( visible: Boolean, immediate: Boolean = false ) { val drawable = background as? RoundedCornersDrawable val drawable = background as? LetterboxRoundedCornersDrawable drawable?.let { if (visible) it.show(executor, immediate) else it.hide(executor, immediate) } Loading Loading @@ -238,7 +241,7 @@ class AppCompatRoundedCornersSurface( } private fun View.applyCornerAttrs( position: RoundedCornersFactory.Position, position: RoundedCornersDrawableFactory.Position, radius: Float, cornerGravity: Int, color: Color Loading