summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-06-03 15:59:02 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-06-03 16:00:06 -0700
commit9d8b1376e8b8cffefe548164da9e284cf7584fcb (patch)
tree5adde117790eeb56ebe22fee923f6033671f0568 /quickstep
parent72c6e7b73651dcb0c3cacd12a284a8f3a42cd436 (diff)
downloadandroid_packages_apps_Trebuchet-9d8b1376e8b8cffefe548164da9e284cf7584fcb.tar.gz
android_packages_apps_Trebuchet-9d8b1376e8b8cffefe548164da9e284cf7584fcb.tar.bz2
android_packages_apps_Trebuchet-9d8b1376e8b8cffefe548164da9e284cf7584fcb.zip
Adding some state for fallback recents View
Maintaining a boolean corresponding to overview or QuickSwitch which updates the visuals for RecentsView accordingly Bug: 134166337 Change-Id: If1aec99257de4db1796335f2cf39d2d35789915b
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java30
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java9
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java68
3 files changed, 100 insertions, 7 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
index dc58a4efc..2c42fd63a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -17,6 +17,7 @@ package com.android.quickstep;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
+import static com.android.quickstep.fallback.FallbackRecentsView.ZOOM_PROGRESS;
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
import android.animation.Animator;
@@ -33,6 +34,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
+import com.android.quickstep.fallback.FallbackRecentsView;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.RecentsView;
@@ -120,11 +122,14 @@ public final class FallbackActivityControllerHelper implements
return (transitionLength) -> { };
}
- RecentsView rv = activity.getOverviewPanel();
+ FallbackRecentsView rv = activity.getOverviewPanel();
rv.setContentAlpha(0);
rv.getClearAllButton().setVisibilityAlpha(0);
rv.setDisallowScrollToClearAll(true);
+ boolean fromState = !animateActivity;
+ rv.setInOverviewState(fromState);
+
return new AnimationFactory() {
boolean isAnimatingToRecents = false;
@@ -141,15 +146,28 @@ public final class FallbackActivityControllerHelper implements
@Override
public void createActivityController(long transitionLength) {
- if (!isAnimatingToRecents) {
- return;
+ AnimatorSet animatorSet = new AnimatorSet();
+ if (isAnimatingToRecents) {
+ ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
+ anim.setDuration(transitionLength).setInterpolator(LINEAR);
+ animatorSet.play(anim);
}
- ObjectAnimator anim = ObjectAnimator.ofFloat(rv, CONTENT_ALPHA, 0, 1);
+ ObjectAnimator anim = ObjectAnimator.ofFloat(rv, ZOOM_PROGRESS, 1, 0);
anim.setDuration(transitionLength).setInterpolator(LINEAR);
- AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(anim);
- callback.accept(AnimatorPlaybackController.wrap(animatorSet, transitionLength));
+
+ AnimatorPlaybackController controller =
+ AnimatorPlaybackController.wrap(animatorSet, transitionLength);
+
+ // Since we are changing the start position of the UI, reapply the state, at the end
+ controller.setEndAction(() -> {
+ boolean endState = true;
+ rv.setInOverviewState(controller.getInterpolatedProgress() > 0.5 ?
+ endState : fromState);
+ });
+
+ callback.accept(controller);
}
};
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
index 5decc3ed6..32a92618a 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
@@ -125,7 +125,14 @@ public final class RecentsActivity extends BaseRecentsActivity {
@Override
public void onCreateAnimation(RemoteAnimationTargetCompat[] targetCompats,
AnimationResult result) {
- result.setAnimation(composeRecentsLaunchAnimator(taskView, targetCompats));
+ AnimatorSet anim = composeRecentsLaunchAnimator(taskView, targetCompats);
+ anim.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mFallbackRecentsView.resetViewUI();
+ }
+ });
+ result.setAnimation(anim);
}
};
return ActivityOptionsCompat.makeRemoteAnimation(new RemoteAnimationAdapterCompat(
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
index e254e240a..b0adbc5bd 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -15,19 +15,45 @@
*/
package com.android.quickstep.fallback;
+import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
+
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.util.FloatProperty;
import android.view.View;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.LauncherState.ScaleAndTranslation;
+import com.android.launcher3.Utilities;
import com.android.quickstep.RecentsActivity;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
+import com.android.quickstep.views.TaskView;
public class FallbackRecentsView extends RecentsView<RecentsActivity> {
+ public static final FloatProperty<FallbackRecentsView> ZOOM_PROGRESS =
+ new FloatProperty<FallbackRecentsView> ("zoomInProgress") {
+
+ @Override
+ public void setValue(FallbackRecentsView view, float value) {
+ view.setZoomProgress(value);
+ }
+
+ @Override
+ public Float get(FallbackRecentsView view) {
+ return view.mZoomInProgress;
+ }
+ };
+
+ private float mZoomInProgress = 0;
+ private boolean mInOverviewState = true;
+
+ private float mZoomScale = 1f;
+ private float mZoomTranslationY = 0f;
+
public FallbackRecentsView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -70,4 +96,46 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity> {
// Just use the activity task size for multi-window as well.
return false;
}
+
+ public void resetViewUI() {
+ setZoomProgress(0);
+ resetTaskVisuals();
+ }
+
+ public void setInOverviewState(boolean inOverviewState) {
+ if (mInOverviewState != inOverviewState) {
+ mInOverviewState = inOverviewState;
+ if (mInOverviewState) {
+ resetTaskVisuals();
+ } else {
+ setZoomProgress(1);
+ }
+ }
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
+ super.onLayout(changed, left, top, right, bottom);
+
+ if (getTaskViewCount() == 0) {
+ mZoomScale = 1f;
+ mZoomTranslationY = 0f;
+ } else {
+ TaskView dummyTask = getTaskViewAt(0);
+ ScaleAndTranslation sat = getTempClipAnimationHelper()
+ .updateForFullscreenOverview(dummyTask)
+ .getScaleAndTranslation();
+ mZoomScale = sat.scale;
+ mZoomTranslationY = sat.translationY;
+ }
+
+ setZoomProgress(mZoomInProgress);
+ }
+
+ public void setZoomProgress(float progress) {
+ mZoomInProgress = progress;
+ SCALE_PROPERTY.set(this, Utilities.mapRange(mZoomInProgress, 1, mZoomScale));
+ TRANSLATION_Y.set(this, Utilities.mapRange(mZoomInProgress, 0, mZoomTranslationY));
+ FULLSCREEN_PROGRESS.set(this, mZoomInProgress);
+ }
}