Crop Desktop TaskThumbnailView according to its intersection with parent
- Override TaskThumbnailView's outline bounds to be the Rect that the view intersect with parent, so it draw corner radius around the intersection, to match the corner radius behavior in live tile - This is not fixed in TaskThumbnailViewDeprecated as it doesn't have an outline implemenation, and it's too complicated to rewrite that as a bugfix Fix: 379881502 Flag: com.android.launcher3.enable_refactor_task_thumbnail Flag: com.android.window.flags.enable_desktop_recents_transitions_corners_bugfix Test: OverviewDesktopTaskImageTest Change-Id: I67d7e6a05b15f0f651c8ec71f33ca1e02d662b06
This commit is contained in:
1 parent
6191d06684
commit
08bd1bfcdb
2 files changed
+61
-27
No files matched your search
@@ -74,6 +74,16 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
private var taskThumbnailViewHeader: TaskThumbnailViewHeader? = null
|
||||
|
||||
private var uiState: TaskThumbnailUiState = Uninitialized
|
||||
|
||||
/**
|
||||
* Sets the outline bounds of the view. Default to use view's bound as outline when set to null.
|
||||
*/
|
||||
var outlineBounds: Rect? = null
|
||||
set(value) {
|
||||
field = value
|
||||
invalidateOutline()
|
||||
}
|
||||
|
||||
private val bounds = Rect()
|
||||
|
||||
var cornerRadius: Float = 0f
|
||||
@@ -109,7 +119,7 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
outlineProvider =
|
||||
object : ViewOutlineProvider() {
|
||||
override fun getOutline(view: View, outline: Outline) {
|
||||
outline.setRoundRect(bounds, cornerRadius)
|
||||
outline.setRoundRect(outlineBounds ?: bounds, cornerRadius)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,6 +134,7 @@ class TaskThumbnailView : FrameLayout, ViewPool.Reusable {
|
||||
|
||||
override fun onRecycle() {
|
||||
uiState = Uninitialized
|
||||
outlineBounds = null
|
||||
resetViews()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user