diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-05-14 23:26:46 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-05-14 23:26:46 +0000 |
commit | d2e40927a7ce6f147f2dca70a127a010cb0b6ca4 (patch) | |
tree | a17b62f40aa67d08d1a0723c0e367db0f5a63ebd /go/quickstep/src | |
parent | e60e2bab65235db9dff901508c2bf3891aac1879 (diff) | |
parent | fd968a79a89e1762f048cf1f6855be6351c3c559 (diff) | |
download | android_packages_apps_Trebuchet-d2e40927a7ce6f147f2dca70a127a010cb0b6ca4.tar.gz android_packages_apps_Trebuchet-d2e40927a7ce6f147f2dca70a127a010cb0b6ca4.tar.bz2 android_packages_apps_Trebuchet-d2e40927a7ce6f147f2dca70a127a010cb0b6ca4.zip |
Merge "Scale down thumbnail with app surface" into ub-launcher3-qt-dev
Diffstat (limited to 'go/quickstep/src')
-rw-r--r-- | go/quickstep/src/com/android/quickstep/views/IconRecentsView.java | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index bcb634393..87b4d4e2e 100644 --- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java @@ -38,6 +38,7 @@ import android.content.Context; import android.content.res.Resources; import android.graphics.Matrix; import android.graphics.Rect; +import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.util.ArraySet; import android.util.AttributeSet; @@ -768,6 +769,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable { Rect endRect = new Rect(); thumbnailView.getGlobalVisibleRect(endRect); Rect appBounds = appTarget.sourceContainerBounds; + RectF currentAppRect = new RectF(); SyncRtSurfaceTransactionApplierCompat surfaceApplier = new SyncRtSurfaceTransactionApplierCompat(this); @@ -810,17 +812,30 @@ public final class IconRecentsView extends FrameLayout implements Insettable { @Override public void onUpdate(float percent) { - appMatrix.preScale(mScaleX.value, mScaleY.value, + Matrix m = new Matrix(); + m.preScale(mScaleX.value, mScaleY.value, appBounds.width() / 2.0f, appBounds.height() / 2.0f); - appMatrix.postTranslate(mTranslationX.value, mTranslationY.value); - + m.postTranslate(mTranslationX.value, mTranslationY.value); + appMatrix.preConcat(m); params[1] = new SurfaceParams(appTarget.leash, mAlpha.value, appMatrix, null /* windowCrop */, getLayer(appTarget, boostedMode), 0 /* cornerRadius */); surfaceApplier.scheduleApply(params); + + m.mapRect(currentAppRect, new RectF(appBounds)); + setViewToRect(thumbnailView, new RectF(endRect), currentAppRect); appMatrix.reset(); } }); + remoteAppAnim.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + thumbnailView.setTranslationY(0); + thumbnailView.setTranslationX(0); + thumbnailView.setScaleX(1); + thumbnailView.setScaleY(1); + } + }); anim.play(remoteAppAnim); } @@ -886,6 +901,27 @@ public final class IconRecentsView extends FrameLayout implements Insettable { } } + /** + * Set view properties so that the view fits to the target rect. + * + * @param view view to set + * @param origRect original rect that view was located + * @param targetRect rect to set to + */ + private void setViewToRect(View view, RectF origRect, RectF targetRect) { + float dX = targetRect.left - origRect.left; + float dY = targetRect.top - origRect.top; + view.setTranslationX(dX); + view.setTranslationY(dY); + + float scaleX = targetRect.width() / origRect.width(); + float scaleY = targetRect.height() / origRect.height(); + view.setPivotX(0); + view.setPivotY(0); + view.setScaleX(scaleX); + view.setScaleY(scaleY); + } + @Override public void setInsets(Rect insets) { mInsets = insets; |