Merge "Fix issue with delegate consumers being overwritten" into ub-launcher3-master
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 5e8c232..3e88ecb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -508,6 +508,29 @@
mHasVisibleTaskData.delete(taskView.getTask().key.id);
mTaskViewPool.recycle(taskView);
}
+ updateTaskStartIndex(child);
+ }
+
+ @Override
+ public void onViewAdded(View child) {
+ super.onViewAdded(child);
+ child.setAlpha(mContentAlpha);
+ // RecentsView is set to RTL in the constructor when system is using LTR. Here we set the
+ // child direction back to match system settings.
+ child.setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_LTR : View.LAYOUT_DIRECTION_RTL);
+ updateTaskStartIndex(child);
+ }
+
+ private void updateTaskStartIndex(View affectingView) {
+ if (!(affectingView instanceof TaskView) && !(affectingView instanceof ClearAllButton)) {
+ int childCount = getChildCount();
+
+ mTaskViewStartIndex = 0;
+ while (mTaskViewStartIndex < childCount
+ && !(getChildAt(mTaskViewStartIndex) instanceof TaskView)) {
+ mTaskViewStartIndex++;
+ }
+ }
}
public boolean isTaskViewVisible(TaskView tv) {
@@ -713,11 +736,15 @@
int currentIndex = indexOfChild(taskView);
TaskView previousTask = getTaskViewAt(currentIndex - 1);
TaskView nextTask = getTaskViewAt(currentIndex + 1);
+ float alpha = isTaskOverlayModal ? 0.0f : 1.0f;
if (previousTask != null) {
- previousTask.setVisibility(isTaskOverlayModal ? View.INVISIBLE : View.VISIBLE);
+ previousTask.animate().alpha(alpha)
+ .translationX(isTaskOverlayModal ? previousTask.getWidth() / 2 : 0);
}
if (nextTask != null) {
- nextTask.setVisibility(isTaskOverlayModal ? View.INVISIBLE : View.VISIBLE);
+ nextTask.animate().alpha(alpha)
+ .translationX(isTaskOverlayModal ? -nextTask.getWidth() / 2 : 0);
+
}
}
@@ -1556,12 +1583,6 @@
return mOrientationHandler;
}
- @Override
- public void onViewAdded(View child) {
- super.onViewAdded(child);
- child.setAlpha(mContentAlpha);
- }
-
@Nullable
public TaskView getNextTaskView() {
return getTaskViewAtByAbsoluteIndex(getRunningTaskIndex() + 1);
@@ -2069,37 +2090,11 @@
}
}
- @Override
- public void addView(View child, int index) {
- // RecentsView is set to RTL in the constructor when system is using LTR. Here we set the
- // child direction back to match system settings.
- child.setLayoutDirection(
- Utilities.isRtl(getResources())
- ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
- super.addView(child, index);
- if (isExtraCardView(child, index)) {
- mTaskViewStartIndex++;
- }
- }
-
- @Override
- public void removeView(View view) {
- if (isExtraCardView(view, indexOfChild(view))) {
- mTaskViewStartIndex--;
- }
- super.removeView(view);
- }
-
@Nullable
protected DepthController getDepthController() {
return null;
}
- private boolean isExtraCardView(View view, int index) {
- return !(view instanceof TaskView) && !(view instanceof ClearAllButton)
- && index <= mTaskViewStartIndex;
- }
-
/**
* Used to register callbacks for when our empty message state changes.
*
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index ceb099f..9193efb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -167,6 +167,7 @@
private float mStableAlpha = 1;
private boolean mShowScreenshot;
+ private boolean mRunningModalAnimation = false;
// The current background requests to load the task thumbnail and icon
private TaskThumbnailCache.ThumbnailLoadRequest mThumbnailLoadRequest;
@@ -249,17 +250,40 @@
/** Updates UI based on whether the task is modal. */
public void updateUiForModalTask() {
boolean isOverlayModal = isTaskOverlayModal();
+ mRunningModalAnimation = true;
if (getRecentsView() != null) {
getRecentsView().updateUiForModalTask(this, isOverlayModal);
}
- // Hide footers when overlay is modal.
+
+ // Hides footers and icon when overlay is modal.
if (isOverlayModal) {
for (FooterWrapper footer : mFooters) {
if (footer != null) {
footer.animateHide();
}
}
+ mIconView.animate().alpha(0.0f);
+ } else {
+ mIconView.animate().alpha(1.0f);
}
+
+ // Sets animations for modal UI. We will remove the margins to zoom in the snapshot.
+ float topMargin =
+ getResources().getDimension(R.dimen.task_thumbnail_top_margin_with_actions);
+ float bottomMargin =
+ getResources().getDimension(R.dimen.task_thumbnail_bottom_margin_with_actions);
+ float newHeight = mSnapshotView.getHeight() + topMargin + bottomMargin;
+ float scale = isOverlayModal ? newHeight / mSnapshotView.getHeight() : 1.0f;
+ float centerDifference = (bottomMargin - topMargin) / 2;
+ float translationY = isOverlayModal ? centerDifference : 0;
+ this.animate().scaleX(scale).scaleY(scale).translationY(translationY)
+ .withEndAction(new Runnable() {
+ @Override
+ public void run() {
+ setCurveScale(scale);
+ mRunningModalAnimation = false;
+ }
+ });
}
public TaskMenuView getMenuView() {
@@ -567,11 +591,15 @@
@Override
public void onPageScroll(ScrollState scrollState) {
+ // Don't do anything if it's modal.
+ if (mRunningModalAnimation || isTaskOverlayModal()) {
+ return;
+ }
+
float curveInterpolation =
CURVE_INTERPOLATOR.getInterpolation(scrollState.linearInterpolation);
float curveScaleForCurveInterpolation = getCurveScaleForCurveInterpolation(
curveInterpolation);
-
mSnapshotView.setDimAlpha(curveInterpolation * MAX_PAGE_SCRIM_ALPHA);
setCurveScale(curveScaleForCurveInterpolation);
diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml
index dcc85d5..7f1a8bf 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -17,6 +17,8 @@
<resources>
<dimen name="task_thumbnail_top_margin">24dp</dimen>
+ <dimen name="task_thumbnail_top_margin_with_actions">60dp</dimen>
+ <dimen name="task_thumbnail_bottom_margin_with_actions">76dp</dimen>
<dimen name="task_thumbnail_half_top_margin">12dp</dimen>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<!-- For screens without rounded corners -->
diff --git a/quickstep/src/com/android/quickstep/util/LayoutUtils.java b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
index 1f1a999..f71bcfb 100644
--- a/quickstep/src/com/android/quickstep/util/LayoutUtils.java
+++ b/quickstep/src/com/android/quickstep/util/LayoutUtils.java
@@ -122,7 +122,9 @@
paddingHorz = res.getDimension(paddingResId);
}
- float topIconMargin = res.getDimension(R.dimen.task_thumbnail_top_margin);
+ float topIconMargin = overviewActionsEnabled
+ ? res.getDimension(R.dimen.task_thumbnail_top_margin_with_actions)
+ : res.getDimension(R.dimen.task_thumbnail_top_margin);
float bottomMargin = thumbnailBottomMargin(context);
float paddingVert = overviewActionsEnabled && removeShelfFromOverview(context)