Default to using SplitSelectSource drawable if TaskView icon drawable is null
* Alternative solution could be to set onTaskViewVisibilityChanged(true) for the taskView that is about to be dismissed so it loads it's taskIcon/thumbnail back from the cache * However, that does still leave us open to race conditions (even though we can be reasonably confident the icon is probably in the cache) * Also made other changes to allow already public fields on some classes to be mockable for unit testing Fixes: 275267738 Test: Tested with fullscreen task at end of overview, GroupedTaskView at end of overview, Initiating split from home, Initiating split from overview actions, Initiating split from overview app icon Change-Id: Ic9059c93c07b90f61c9f418d5d36d6ba201ff96a
This commit is contained in:
1 parent
90259a6db4
commit
ecca8eacbc
4 files changed
+198
-9
No files matched your search
@@ -24,6 +24,7 @@ import android.view.View
|
||||
import com.android.launcher3.DeviceProfile
|
||||
import com.android.launcher3.anim.PendingAnimation
|
||||
import com.android.launcher3.util.SplitConfigurationOptions.SplitSelectSource
|
||||
import com.android.quickstep.views.IconView
|
||||
import com.android.quickstep.views.TaskThumbnailView
|
||||
import com.android.quickstep.views.TaskView
|
||||
import com.android.quickstep.views.TaskView.TaskIdAttributeContainer
|
||||
@@ -52,21 +53,22 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
* depending on the state of the surface from which the split was initiated
|
||||
*/
|
||||
fun getFirstAnimInitViews(taskViewSupplier: Supplier<TaskView>,
|
||||
splitSelectSourceSupplier: Supplier<SplitSelectSource>)
|
||||
splitSelectSourceSupplier: Supplier<SplitSelectSource?>)
|
||||
: SplitAnimInitProps {
|
||||
val splitSelectSource = splitSelectSourceSupplier.get()
|
||||
if (!splitSelectStateController.isAnimateCurrentTaskDismissal) {
|
||||
// Initiating from home
|
||||
val splitSelectSource = splitSelectSourceSupplier.get()
|
||||
return SplitAnimInitProps(splitSelectSource.view, originalBitmap = null,
|
||||
return SplitAnimInitProps(splitSelectSource!!.view, originalBitmap = null,
|
||||
splitSelectSource.drawable, fadeWithThumbnail = false, isStagedTask = true,
|
||||
iconView = null)
|
||||
} else if (splitSelectStateController.isDismissingFromSplitPair) {
|
||||
// Initiating split from overview, but on a split pair
|
||||
val taskView = taskViewSupplier.get()
|
||||
for (container : TaskIdAttributeContainer in taskView.taskIdAttributeContainers) {
|
||||
if (container.task.key.id == splitSelectStateController.initialTaskId) {
|
||||
if (container.task.getKey().getId() == splitSelectStateController.initialTaskId) {
|
||||
val drawable = getDrawable(container.iconView, splitSelectSource)
|
||||
return SplitAnimInitProps(container.thumbnailView,
|
||||
container.thumbnailView.thumbnail, container.iconView.drawable!!,
|
||||
container.thumbnailView.thumbnail, drawable!!,
|
||||
fadeWithThumbnail = true, isStagedTask = true,
|
||||
iconView = container.iconView
|
||||
)
|
||||
@@ -77,13 +79,27 @@ class SplitAnimationController(val splitSelectStateController: SplitSelectStateC
|
||||
} else {
|
||||
// Initiating split from overview on fullscreen task TaskView
|
||||
val taskView = taskViewSupplier.get()
|
||||
val drawable = getDrawable(taskView.iconView, splitSelectSource)
|
||||
return SplitAnimInitProps(taskView.thumbnail, taskView.thumbnail.thumbnail,
|
||||
taskView.iconView.drawable!!, fadeWithThumbnail = true, isStagedTask = true,
|
||||
drawable!!, fadeWithThumbnail = true, isStagedTask = true,
|
||||
taskView.iconView
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the drawable that's provided in iconView, however if that
|
||||
* is null it falls back to the drawable that's in splitSelectSource.
|
||||
* TaskView's icon drawable can be null if the TaskView is scrolled far enough off screen
|
||||
* @return [Drawable]
|
||||
*/
|
||||
fun getDrawable(iconView: IconView, splitSelectSource: SplitSelectSource?) : Drawable? {
|
||||
if (iconView.drawable == null && splitSelectSource != null) {
|
||||
return splitSelectSource.drawable
|
||||
}
|
||||
return iconView.drawable
|
||||
}
|
||||
|
||||
/**
|
||||
* When selecting first app from split pair, second app's thumbnail remains. This animates
|
||||
* the second thumbnail by expanding it to take up the full taskViewWidth/Height and overlaying
|
||||
|
||||
Reference in new issue
Block a user