diff options
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 8 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 35 | ||||
-rw-r--r-- | src/com/android/launcher3/folder/FolderPagedView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/logging/LoggerUtils.java | 8 |
4 files changed, 45 insertions, 10 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index ed225c9ec..dcc7a9d1e 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -408,9 +408,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc if (getChildCount() == 0) { return; } + int prevPage = mCurrentPage; mCurrentPage = validateNewPage(currentPage); updateCurrentPageScroll(); - notifyPageSwitchListener(); + notifyPageSwitchListener(prevPage); invalidate(); } @@ -418,7 +419,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc * Should be called whenever the page changes. In the case of a scroll, we wait until the page * has settled. */ - protected void notifyPageSwitchListener() { + protected void notifyPageSwitchListener(int prevPage) { updatePageIndicator(); } @@ -585,9 +586,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } else if (mNextPage != INVALID_PAGE && shouldInvalidate) { sendScrollAccessibilityEvent(); + int prevPage = mCurrentPage; mCurrentPage = validateNewPage(mNextPage); mNextPage = INVALID_PAGE; - notifyPageSwitchListener(); + notifyPageSwitchListener(prevPage); // We don't want to trigger a page end moving unless the page has settled // and the user has stopped scrolling diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index b1db7e8db..56a5f9ed8 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -75,6 +75,7 @@ import com.android.launcher3.graphics.DragPreviewProvider; import com.android.launcher3.graphics.PreloadIconDrawable; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.shortcuts.ShortcutDragPreviewProvider; +import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; @@ -300,6 +301,7 @@ public class Workspace extends PagedView boolean mScrollInteractionBegan; boolean mStartedSendingScrollEvents; float mLastOverlayScroll = 0; + boolean mOverlayShown = false; private boolean mForceDrawAdjacentPages = false; // Total over scrollX in the overlay direction. @@ -1405,6 +1407,20 @@ public class Workspace extends PagedView * The overlay scroll is being controlled locally, just update our overlay effect */ public void onOverlayScrollChanged(float scroll) { + + if (Float.compare(scroll, 1f) == 0) { + if (!mOverlayShown) { + mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, + Action.Direction.LEFT, ContainerType.WORKSPACE, 0); + } + mOverlayShown = true; + } else if (Float.compare(scroll, 0f) == 0) { + if (mOverlayShown) { + mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, + Action.Direction.RIGHT, ContainerType.WORKSPACE, -1); + } + mOverlayShown = false; + } float offset = 0f; float slip = 0f; @@ -1515,9 +1531,13 @@ public class Workspace extends PagedView } @Override - protected void notifyPageSwitchListener() { - super.notifyPageSwitchListener(); - + protected void notifyPageSwitchListener(int prevPage) { + super.notifyPageSwitchListener(prevPage); + if (prevPage != mCurrentPage) { + int swipeDirection = (prevPage < mCurrentPage) ? Action.Direction.RIGHT : Action.Direction.LEFT; + mLauncher.getUserEventDispatcher().logActionOnContainer(Action.Touch.SWIPE, + swipeDirection, ContainerType.WORKSPACE, prevPage); + } if (hasCustomContent() && getNextPage() == 0 && !mCustomContentShowing) { mCustomContentShowing = true; if (mCustomContentCallbacks != null) { @@ -1867,13 +1887,20 @@ public class Workspace extends PagedView return; } + ArrayList<Long> prevScreenOrder = (ArrayList<Long>) mScreenOrder.clone(); mScreenOrder.clear(); int count = getChildCount(); for (int i = 0; i < count; i++) { CellLayout cl = ((CellLayout) getChildAt(i)); mScreenOrder.add(getIdForScreen(cl)); } - mLauncher.getUserEventDispatcher().logOverviewReorder(); + + for (int i = 0; i < prevScreenOrder.size(); i++) { + if (mScreenOrder.get(i) != prevScreenOrder.get(i)) { + mLauncher.getUserEventDispatcher().logOverviewReorder(); + break; + } + } LauncherModel.updateWorkspaceScreenOrder(mLauncher, mScreenOrder); // Re-enable auto layout transitions for page deletion. diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index bc26fbef8..33ac5baf2 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -547,8 +547,8 @@ public class FolderPagedView extends PagedView { } @Override - protected void notifyPageSwitchListener() { - super.notifyPageSwitchListener(); + protected void notifyPageSwitchListener(int prevPage) { + super.notifyPageSwitchListener(prevPage); if (mFolder != null) { mFolder.updateTextViewFocus(); } diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java index 329b7d561..72a083b9e 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -66,8 +66,14 @@ public class LoggerUtils { } public static String getActionStr(Action action) { + String str = ""; switch (action.type) { - case Action.Type.TOUCH: return getFieldName(action.touch, Action.Touch.class); + case Action.Type.TOUCH: + str += getFieldName(action.touch, Action.Touch.class); + if (action.touch == Action.Touch.SWIPE) { + str += " direction=" + getFieldName(action.dir, Action.Direction.class); + } + return str; case Action.Type.COMMAND: return getFieldName(action.command, Action.Command.class); default: return UNKNOWN; } |