diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/Folder.java | 29 | ||||
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/util/UiThreadCircularReveal.java | 6 |
3 files changed, 28 insertions, 15 deletions
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java index 85f58a1b1..f2c5d93f5 100644 --- a/src/com/android/launcher3/Folder.java +++ b/src/com/android/launcher3/Folder.java @@ -58,9 +58,11 @@ import com.android.launcher3.UninstallDropTarget.UninstallSource; import com.android.launcher3.Workspace.ItemOperator; import com.android.launcher3.accessibility.LauncherAccessibilityDelegate.AccessibilityDragSource; import com.android.launcher3.util.Thunk; +import com.android.launcher3.util.UiThreadCircularReveal; import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; /** * Represents a set of icons chosen by the user or generated by the system. @@ -362,7 +364,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList void bind(FolderInfo info) { mInfo = info; ArrayList<ShortcutInfo> children = info.contents; - Collections.sort(children, Utilities.RANK_COMPARATOR); + Collections.sort(children, ITEM_POS_COMPARATOR); ArrayList<ShortcutInfo> overflow = mContent.bindItems(children); @@ -467,6 +469,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList prepareReveal(); centerAboutIcon(); + AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); int width = getPaddingLeft() + getPaddingRight() + mContent.getDesiredWidth(); int height = getFolderHeight(); @@ -477,7 +480,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList PropertyValuesHolder tx = PropertyValuesHolder.ofFloat("translationX", transX, 0); PropertyValuesHolder ty = PropertyValuesHolder.ofFloat("translationY", transY, 0); - Animator drift = LauncherAnimUtils.ofPropertyValuesHolder(this, tx, ty); + Animator drift = ObjectAnimator.ofPropertyValuesHolder(this, tx, ty); drift.setDuration(mMaterialExpandDuration); drift.setStartDelay(mMaterialExpandStagger); drift.setInterpolator(new LogDecelerateInterpolator(100, 0)); @@ -486,20 +489,19 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList int ry = (int) Math.max(Math.max(height - getPivotY(), 0), getPivotY()); float radius = (float) Math.hypot(rx, ry); - AnimatorSet anim = LauncherAnimUtils.createAnimatorSet(); - Animator reveal = LauncherAnimUtils.createCircularReveal(this, (int) getPivotX(), + Animator reveal = UiThreadCircularReveal.createCircularReveal(this, (int) getPivotX(), (int) getPivotY(), 0, radius); reveal.setDuration(mMaterialExpandDuration); reveal.setInterpolator(new LogDecelerateInterpolator(100, 0)); mContentWrapper.setAlpha(0f); - Animator iconsAlpha = LauncherAnimUtils.ofFloat(mContentWrapper, "alpha", 0f, 1f); + Animator iconsAlpha = ObjectAnimator.ofFloat(mContentWrapper, "alpha", 0f, 1f); iconsAlpha.setDuration(mMaterialExpandDuration); iconsAlpha.setStartDelay(mMaterialExpandStagger); iconsAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); mFooter.setAlpha(0f); - Animator textAlpha = LauncherAnimUtils.ofFloat(mFooter, "alpha", 0f, 1f); + Animator textAlpha = ObjectAnimator.ofFloat(mFooter, "alpha", 0f, 1f); textAlpha.setDuration(mMaterialExpandDuration); textAlpha.setStartDelay(mMaterialExpandStagger); textAlpha.setInterpolator(new AccelerateInterpolator(1.5f)); @@ -1395,4 +1397,19 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList onDragOver(mDragObject, 1); } } + + // Compares item position based on rank and position giving priority to the rank. + private static final Comparator<ItemInfo> ITEM_POS_COMPARATOR = new Comparator<ItemInfo>() { + + @Override + public int compare(ItemInfo lhs, ItemInfo rhs) { + if (lhs.rank != rhs.rank) { + return lhs.rank - rhs.rank; + } else if (lhs.cellY != rhs.cellY) { + return lhs.cellY - rhs.cellY; + } else { + return lhs.cellX - rhs.cellX; + } + } + }; } diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index 19334ed31..8f4f0f9a1 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -59,7 +59,6 @@ import android.widget.Toast; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; -import java.util.Comparator; import java.util.Locale; import java.util.Set; import java.util.regex.Matcher; @@ -573,13 +572,6 @@ public final class Utilities { } } - public static final Comparator<ItemInfo> RANK_COMPARATOR = new Comparator<ItemInfo>() { - @Override - public int compare(ItemInfo lhs, ItemInfo rhs) { - return lhs.rank - rhs.rank; - } - }; - /** * Find the first vacant cell, if there is one. * diff --git a/src/com/android/launcher3/util/UiThreadCircularReveal.java b/src/com/android/launcher3/util/UiThreadCircularReveal.java index c7324fb1b..c8e1df289 100644 --- a/src/com/android/launcher3/util/UiThreadCircularReveal.java +++ b/src/com/android/launcher3/util/UiThreadCircularReveal.java @@ -15,11 +15,15 @@ import com.android.launcher3.Utilities; public class UiThreadCircularReveal { public static ValueAnimator createCircularReveal(View v, int x, int y, float r0, float r1) { + return createCircularReveal(v, x, y, r0, r1, ViewOutlineProvider.BACKGROUND); + } + + public static ValueAnimator createCircularReveal(View v, int x, int y, float r0, float r1, + final ViewOutlineProvider originalProvider) { ValueAnimator va = ValueAnimator.ofFloat(0f, 1f); final View revealView = v; final RevealOutlineProvider outlineProvider = new RevealOutlineProvider(x, y, r0, r1); - final ViewOutlineProvider originalProvider = revealView.getOutlineProvider(); final float elevation = v.getElevation(); va.addListener(new AnimatorListenerAdapter() { |