[automerger] Animate thumbnail dim after quick scrub settles am: c879dbf764
Change-Id: Ib1fedb0d73485d957c7398f3f4455622e3458525
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 3ff9921..ce17d25 100644
--- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -50,7 +50,9 @@
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
+import android.util.ArraySet;
import android.util.Log;
+import android.util.Pair;
import android.view.Surface;
import android.view.View;
import android.view.ViewGroup;
@@ -178,7 +180,15 @@
anim.play(getIconAnimator(v));
if (launcherClosing) {
- anim.play(getLauncherContentAnimator(false /* show */));
+ Pair<AnimatorSet, Runnable> launcherContentAnimator =
+ getLauncherContentAnimator(false /* show */);
+ anim.play(launcherContentAnimator.first);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ launcherContentAnimator.second.run();
+ }
+ });
}
anim.play(getWindowAnimators(v, targetCompats));
}
@@ -267,8 +277,9 @@
* @param show If true: Animate the content so that it moves upwards and fades in.
* Else: Animate the content so that it moves downwards and fades out.
*/
- private AnimatorSet getLauncherContentAnimator(boolean show) {
+ private Pair<AnimatorSet, Runnable> getLauncherContentAnimator(boolean show) {
AnimatorSet launcherAnimator = new AnimatorSet();
+ Runnable endListener;
float[] alphas = show
? new float[] {0, 1}
@@ -288,6 +299,13 @@
ObjectAnimator alpha = ObjectAnimator.ofFloat(appsView, View.ALPHA, alphas);
alpha.setDuration(217);
alpha.setInterpolator(LINEAR);
+ appsView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ alpha.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ appsView.setLayerType(View.LAYER_TYPE_NONE, null);
+ }
+ });
ObjectAnimator transY = ObjectAnimator.ofFloat(appsView, View.TRANSLATION_Y, trans);
transY.setInterpolator(AGGRESSIVE_EASE);
transY.setDuration(350);
@@ -295,13 +313,11 @@
launcherAnimator.play(alpha);
launcherAnimator.play(transY);
- launcherAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- appsView.setAlpha(startAlpha);
- appsView.setTranslationY(startY);
- }
- });
+ endListener = () -> {
+ appsView.setAlpha(startAlpha);
+ appsView.setTranslationY(startY);
+ appsView.setLayerType(View.LAYER_TYPE_NONE, null);
+ };
} else {
mDragLayer.setAlpha(alphas[0]);
mDragLayer.setTranslationY(trans[0]);
@@ -316,15 +332,14 @@
launcherAnimator.play(dragLayerAlpha);
launcherAnimator.play(dragLayerTransY);
- launcherAnimator.addListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mDragLayer.setAlpha(1);
- mDragLayer.setTranslationY(0);
- }
- });
+ mDragLayer.setLayerType(View.LAYER_TYPE_HARDWARE, null);
+ endListener = () -> {
+ mDragLayer.setLayerType(View.LAYER_TYPE_NONE, null);
+ mDragLayer.setAlpha(1);
+ mDragLayer.setTranslationY(0);
+ };
}
- return launcherAnimator;
+ return new Pair<>(launcherAnimator, endListener);
}
/**
@@ -658,9 +673,16 @@
private void createLauncherResumeAnimation(AnimatorSet anim) {
if (mLauncher.isInState(LauncherState.ALL_APPS)
|| mLauncher.getDeviceProfile().isVerticalBarLayout()) {
- AnimatorSet contentAnimator = getLauncherContentAnimator(true /* show */);
- contentAnimator.setStartDelay(LAUNCHER_RESUME_START_DELAY);
- anim.play(contentAnimator);
+ Pair<AnimatorSet, Runnable> contentAnimator =
+ getLauncherContentAnimator(true /* show */);
+ contentAnimator.first.setStartDelay(LAUNCHER_RESUME_START_DELAY);
+ anim.play(contentAnimator.first);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ contentAnimator.second.run();
+ }
+ });
} else {
AnimatorSet workspaceAnimator = new AnimatorSet();
diff --git a/res/layout/all_apps.xml b/res/layout/all_apps.xml
index 450d107..5e7b117 100644
--- a/res/layout/all_apps.xml
+++ b/res/layout/all_apps.xml
@@ -31,8 +31,6 @@
<include layout="@layout/all_apps_floating_header" />
- <!-- Note: we are reusing/repurposing a system attribute for search layout, because of a
- platform bug, which prevents using custom attributes in <include> tag -->
<include
android:id="@id/search_container_all_apps"
layout="@layout/search_container_all_apps"/>
diff --git a/src/com/android/launcher3/FastBitmapDrawable.java b/src/com/android/launcher3/FastBitmapDrawable.java
index 3873a81..1b91e88 100644
--- a/src/com/android/launcher3/FastBitmapDrawable.java
+++ b/src/com/android/launcher3/FastBitmapDrawable.java
@@ -174,10 +174,6 @@
return getBounds().height();
}
- public Bitmap getBitmap() {
- return mBitmap;
- }
-
@Override
public boolean isStateful() {
return true;
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index 9da5cf0..fe953fe 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -203,7 +203,6 @@
if (mPageIndicatorViewId > -1) {
mPageIndicator = parent.findViewById(mPageIndicatorViewId);
mPageIndicator.setMarkersCount(getChildCount());
- mPageIndicator.setPageDescription(getPageIndicatorDescription());
}
}
@@ -310,7 +309,6 @@
private void updatePageIndicator() {
if (mPageIndicator != null) {
- mPageIndicator.setPageDescription(getPageIndicatorDescription());
mPageIndicator.setActiveMarker(getNextPage());
}
}
@@ -1541,10 +1539,6 @@
return false;
}
- protected String getPageIndicatorDescription() {
- return getCurrentPageDescription();
- }
-
protected boolean canAnnouncePageDescription() {
return true;
}
diff --git a/src/com/android/launcher3/allapps/AllAppsPagedView.java b/src/com/android/launcher3/allapps/AllAppsPagedView.java
index b2e35a4..69068c6 100644
--- a/src/com/android/launcher3/allapps/AllAppsPagedView.java
+++ b/src/com/android/launcher3/allapps/AllAppsPagedView.java
@@ -76,4 +76,9 @@
super.determineScrollingStart(ev);
}
}
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
}
diff --git a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
index a7447b7..a6c1346 100644
--- a/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsRecyclerView.java
@@ -415,4 +415,8 @@
y + mEmptySearchBackground.getIntrinsicHeight());
}
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
}
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index 461f5b5..378450e 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -237,6 +237,11 @@
public boolean hasVisibleContent() {
return false;
}
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
}
diff --git a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
index a069d5d..a916697 100644
--- a/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
+++ b/src/com/android/launcher3/allapps/PersonalWorkSlidingTabStrip.java
@@ -25,6 +25,7 @@
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
+
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
@@ -169,8 +170,7 @@
public void setMarkersCount(int numMarkers) { }
@Override
- public void setPageDescription(CharSequence description) {
- // We don't want custom page description as the tab-bar already has two tabs with their
- // own descriptions.
+ public boolean hasOverlappingRendering() {
+ return false;
}
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicator.java b/src/com/android/launcher3/pageindicators/PageIndicator.java
index 3ce7291..8fafb6f 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicator.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicator.java
@@ -25,6 +25,4 @@
void setActiveMarker(int activePage);
void setMarkersCount(int numMarkers);
-
- void setPageDescription(CharSequence description);
}
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 524ec3c..709975f 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -228,11 +228,6 @@
}
@Override
- public void setPageDescription(CharSequence description) {
- setContentDescription(description);
- }
-
- @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// Add extra spacing of mDotRadius on all sides so than entry animation could be run.
int width = MeasureSpec.getMode(widthMeasureSpec) == MeasureSpec.EXACTLY ?
diff --git a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
index 4ad7feb..3c16cde 100644
--- a/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
+++ b/src/com/android/launcher3/pageindicators/WorkspacePageIndicator.java
@@ -186,11 +186,6 @@
}
}
- @Override
- public void setPageDescription(CharSequence description) {
- setContentDescription(description);
- }
-
public void setShouldAutoHide(boolean shouldAutoHide) {
mShouldAutoHide = shouldAutoHide;
if (shouldAutoHide && mLinePaint.getAlpha() > 0) {
diff --git a/src/com/android/launcher3/views/RecyclerViewFastScroller.java b/src/com/android/launcher3/views/RecyclerViewFastScroller.java
index 1cd6699..05bab8b 100644
--- a/src/com/android/launcher3/views/RecyclerViewFastScroller.java
+++ b/src/com/android/launcher3/views/RecyclerViewFastScroller.java
@@ -372,4 +372,11 @@
}
return sTempRect.contains((int) x, (int) y);
}
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ // There is actually some overlap between the track and the thumb. But since the track
+ // alpha is so low, it does not matter.
+ return false;
+ }
}