diff options
author | Tony Wickham <twickham@google.com> | 2018-05-23 20:51:40 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-05-23 20:51:40 +0000 |
commit | 65e831122278afdd790251505084cc0cc6cd15c9 (patch) | |
tree | fa496b0083bc1c1c58b2153e49283a7183e107a9 | |
parent | 4e057b5f97652ff7c65ec02d88fb8ef5a12f8f3c (diff) | |
parent | 422e1f9c69efdbc7ccfe10e8ebdadcf30a25022e (diff) | |
download | android_packages_apps_Trebuchet-65e831122278afdd790251505084cc0cc6cd15c9.tar.gz android_packages_apps_Trebuchet-65e831122278afdd790251505084cc0cc6cd15c9.tar.bz2 android_packages_apps_Trebuchet-65e831122278afdd790251505084cc0cc6cd15c9.zip |
Merge "Only log swipe interaction on swipe end" into ub-launcher3-edmonton
-rw-r--r-- | src/com/android/launcher3/touch/AbstractStateChangeTouchController.java | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java index a9006e314..453810c06 100644 --- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java +++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java @@ -42,9 +42,9 @@ import com.android.launcher3.Utilities; import com.android.launcher3.anim.AnimationSuccessListener; import com.android.launcher3.anim.AnimatorPlaybackController; import com.android.launcher3.anim.AnimatorSetBuilder; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch; -import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.util.FlingBlockCheck; import com.android.launcher3.util.PendingAnimation; import com.android.launcher3.util.TouchController; @@ -181,17 +181,6 @@ public abstract class AbstractStateChangeTouchController return false; } - if (reachedToState) { - logReachedState(Touch.SWIPE); - } - if (newFromState == ALL_APPS) { - mStartContainerType = ContainerType.ALLAPPS; - } else if (newFromState == NORMAL) { - mStartContainerType = getLogContainerTypeForNormalState(); - } else if (newFromState == OVERVIEW){ - mStartContainerType = ContainerType.TASKSWITCHER; - } - mFromState = newFromState; mToState = newToState; @@ -237,6 +226,13 @@ public abstract class AbstractStateChangeTouchController @Override public void onDragStart(boolean start) { mStartState = mLauncher.getStateManager().getState(); + if (mStartState == ALL_APPS) { + mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS; + } else if (mStartState == NORMAL) { + mStartContainerType = getLogContainerTypeForNormalState(); + } else if (mStartState == OVERVIEW){ + mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER; + } if (mCurrentAnimation == null) { mFromState = mStartState; mToState = null; @@ -332,23 +328,21 @@ public abstract class AbstractStateChangeTouchController @Override public void onDragEnd(float velocity, boolean fling) { - final int logAction; - final LauncherState targetState; - final float progress = mCurrentAnimation.getProgressFraction(); + final int logAction = fling ? Touch.FLING : Touch.SWIPE; boolean blockedFling = fling && mFlingBlockCheck.isBlocked(); if (blockedFling) { fling = false; } + final LauncherState targetState; + final float progress = mCurrentAnimation.getProgressFraction(); if (fling) { - logAction = Touch.FLING; targetState = Float.compare(Math.signum(velocity), Math.signum(mProgressMultiplier)) == 0 ? mToState : mFromState; // snap to top or bottom using the release velocity } else { - logAction = Touch.SWIPE; float successProgress = mToState == ALL_APPS ? MIN_PROGRESS_TO_ALL_APPS : SUCCESS_TRANSITION_PROGRESS; targetState = (progress > successProgress) ? mToState : mFromState; @@ -472,20 +466,20 @@ public abstract class AbstractStateChangeTouchController shouldGoToTargetState = !reachedTarget; } if (shouldGoToTargetState) { - if (targetState != mFromState) { - logReachedState(logAction); + if (targetState != mStartState) { + logReachedState(logAction, targetState); } mLauncher.getStateManager().goToState(targetState, false /* animated */); } } - private void logReachedState(int logAction) { + private void logReachedState(int logAction, LauncherState targetState) { // Transition complete. log the action mLauncher.getUserEventDispatcher().logStateChangeAction(logAction, getDirectionForLog(), mStartContainerType, - mFromState.containerType, - mToState.containerType, + mStartState.containerType, + targetState.containerType, mLauncher.getWorkspace().getCurrentPage()); } |