App to home animation zooms into the app icon.
- Created FloatingIconView which is now used by both the app close and
app open animation.
- getItemLocation in DeviceProfile is used to get an item's final location
since getLocationOnScreen may return a View's location mid-animation.
- Added getFirstMatchForAppClose which is optimized to return for best
visual animation.
- Also fixes app open RTL bug.
- Next CL will use AdaptiveIcons and FolderShape reveal animator to match
the app icon to the app window.
Bug: 123900446
Bug: 123541334
Change-Id: Ief75f63fc5141c1ee59d4773946d08794846cb31
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 812cf9f..296c951 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -26,12 +26,15 @@
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.view.Surface;
+import android.view.View;
import android.view.WindowManager;
import com.android.launcher3.CellLayout.ContainerType;
import com.android.launcher3.icons.DotRenderer;
import com.android.launcher3.icons.IconNormalizer;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
+
public class DeviceProfile {
public final InvariantDeviceProfile inv;
@@ -574,6 +577,33 @@
}
}
+ /**
+ * Gets an item's location on the home screen. This is useful if the home screen
+ * is animating, otherwise use {@link View#getLocationOnScreen(int[])}.
+ *
+ * TODO(b/123900446): Handle landscape mode
+ * @param pageDiff The page difference relative to the current page.
+ */
+ public void getItemLocation(int cellX, int cellY, int spanX, int spanY, int container,
+ int pageDiff, Rect outBounds) {
+ outBounds.setEmpty();
+ outBounds.left = mInsets.left
+ + workspacePadding.left + cellLayoutPaddingLeftRightPx + (cellX * getCellSize().x);
+ outBounds.top = mInsets.top;
+ if (container == CONTAINER_HOTSEAT) {
+ outBounds.top += workspacePadding.top
+ + (inv.numRows * getCellSize().y)
+ + verticalDragHandleSizePx
+ - verticalDragHandleOverlapWorkspace;
+ outBounds.bottom = outBounds.top + hotseatBarSizePx - hotseatBarBottomPaddingPx;
+ } else {
+ outBounds.top += workspacePadding.top + (cellY * getCellSize().y);
+ outBounds.bottom = outBounds.top + (getCellSize().y * spanY);
+ outBounds.left += (pageDiff) * availableWidthPx;
+ }
+ outBounds.right = outBounds.left + (getCellSize().x * spanX);
+ }
+
private static Context getContext(Context c, int orientation) {
Configuration context = new Configuration(c.getResources().getConfiguration());
context.orientation = orientation;