summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-03-31 13:48:39 -0700
committerJonathan Miranda <jonmiranda@google.com>2017-05-16 17:20:50 +0000
commitf79e54b8acb988203e20505039572dd4a5072793 (patch)
tree32789269b99bfb84a7decffc59bd6ce6fbbfa900 /src
parent054090ae2a9b6f729e82256d54dea877dd0d7fe7 (diff)
downloadandroid_packages_apps_Trebuchet-f79e54b8acb988203e20505039572dd4a5072793.tar.gz
android_packages_apps_Trebuchet-f79e54b8acb988203e20505039572dd4a5072793.tar.bz2
android_packages_apps_Trebuchet-f79e54b8acb988203e20505039572dd4a5072793.zip
Add missing 'leave behind' view for new Folder animation.
Bug: 35064148 Bug: 38338552 Change-Id: Iac1a795acf0ab21cf319e50d8b504cf42fbbb976 (cherry picked from commit 9544c8e49803742823a271cede8c29e0ec249ada)
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/folder/Folder.java10
-rw-r--r--src/com/android/launcher3/folder/FolderIcon.java29
2 files changed, 24 insertions, 15 deletions
diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java
index 1601edb44..c6bf3a1c1 100644
--- a/src/com/android/launcher3/folder/Folder.java
+++ b/src/com/android/launcher3/folder/Folder.java
@@ -34,7 +34,6 @@ import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
import android.view.accessibility.AccessibilityEvent;
@@ -633,6 +632,7 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
@Override
public void onAnimationStart(Animator animation) {
if (FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION) {
+ mFolderIcon.drawLeaveBehindIfExists();
mFolderIcon.setVisibility(INVISIBLE);
}
@@ -723,8 +723,12 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC
mFolderName.dispatchBackKey();
}
- if (mFolderIcon != null && !FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION) {
- mFolderIcon.shrinkAndFadeIn(animate);
+ if (mFolderIcon != null) {
+ if (FeatureFlags.LAUNCHER3_NEW_FOLDER_ANIMATION) {
+ mFolderIcon.clearLeaveBehindIfExists();
+ } else {
+ mFolderIcon.shrinkAndFadeIn(animate);
+ }
}
if (!(getParent() instanceof DragLayer)) return;
diff --git a/src/com/android/launcher3/folder/FolderIcon.java b/src/com/android/launcher3/folder/FolderIcon.java
index 1680f0bd7..6e3db0b2d 100644
--- a/src/com/android/launcher3/folder/FolderIcon.java
+++ b/src/com/android/launcher3/folder/FolderIcon.java
@@ -1174,28 +1174,21 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
public void shrinkAndFadeIn(boolean animate) {
- final CellLayout cl = (CellLayout) getParent().getParent();
- ((CellLayout.LayoutParams) getLayoutParams()).canReorder = true;
-
// We remove and re-draw the FolderIcon in-case it has changed
final PreviewImageView previewImage = PreviewImageView.get(getContext());
previewImage.removeFromParent();
copyToPreview(previewImage);
- if (cl != null) {
- cl.clearFolderLeaveBehind();
- }
+ clearLeaveBehindIfExists();
ObjectAnimator oa = LauncherAnimUtils.ofViewAlphaAndScale(previewImage, 1, 1, 1);
oa.setDuration(getResources().getInteger(R.integer.config_folderExpandDuration));
oa.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- if (cl != null) {
- // Remove the ImageView copy of the FolderIcon and make the original visible.
- previewImage.removeFromParent();
- setVisibility(View.VISIBLE);
- }
+ // Remove the ImageView copy of the FolderIcon and make the original visible.
+ previewImage.removeFromParent();
+ setVisibility(View.VISIBLE);
}
});
oa.start();
@@ -1204,7 +1197,15 @@ public class FolderIcon extends FrameLayout implements FolderListener {
}
}
- public void growAndFadeOut() {
+ public void clearLeaveBehindIfExists() {
+ ((CellLayout.LayoutParams) getLayoutParams()).canReorder = true;
+ if (mInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
+ CellLayout cl = (CellLayout) getParent().getParent();
+ cl.clearFolderLeaveBehind();
+ }
+ }
+
+ public void drawLeaveBehindIfExists() {
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) getLayoutParams();
// While the folder is open, the position of the icon cannot change.
lp.canReorder = false;
@@ -1212,6 +1213,10 @@ public class FolderIcon extends FrameLayout implements FolderListener {
CellLayout cl = (CellLayout) getParent().getParent();
cl.setFolderLeaveBehindCell(lp.cellX, lp.cellY);
}
+ }
+
+ public void growAndFadeOut() {
+ drawLeaveBehindIfExists();
// Push an ImageView copy of the FolderIcon into the DragLayer and hide the original
PreviewImageView previewImage = PreviewImageView.get(getContext());