b3fbc0ba8f
- state transition happening due to Home and back is handled by specifying src target as 'from' container and dst target as the 'to' container - Source and Destination container shows FROM and TO state for SWIPE/FLING - event.isStateChange = true indicates that an action resulted in state transition - Elapsed container millis is the screen time on the source container Bug: 70181187 - logcat printout with setprop log.tag.UserEvent VERBOSE 1) State: WORKSPACE -> ALLAPPS action:FLING direction=UP Source child:HOTSEAT id=0 parent:WORKSPACE id=0 Destination child:ALLAPPS Elapsed container 1225 ms, session 1225 ms, action 0 ms 2) ALLAPPS -> HOMESCREEN action:FLING direction=DOWN Source child:ALLAPPS parent:ALLAPPS Destination child:WORKSPACE id=0 Elapsed container 971 ms, session 2197 ms, action 0 ms 3) HOMESCREEN -> OVERVIEW action:FLING direction=UP Source child:NAVBAR parent:WORKSPACE id=0 Destination child:TASKSWITCHER Elapsed container 4834 ms, session 4834 ms, action 0 ms 4) OVERVIEW-> ALLAPPS action:FLING direction=UP Source child:TASK parent:TASKSWITCHER Destination child:ALLAPPS Elapsed container 2176 ms, session 7010 ms, action 0 ms 5) ALLAPPS->OVERVIEW action:FLING direction=DOWN Source child:ALLAPPS parent:ALLAPPS Destination child:TASKSWITCHER Elapsed container 3683 ms, session 10693 ms, action 0 ms 6) OVERVIEW-> HOMESCREEN action:FLING direction=DOWN Source child:TASK parent:TASKSWITCHER Destination child:WORKSPACE id=0 Elapsed container 2108 ms, session 12801 ms, action 0 ms 7) APPS-> OVERVIEW action:FLING direction=UP Source child:NAVBAR parent:APP Destination child:TASKSWITCHER Elapsed container 104 ms, session 104 ms, action 0 ms 8) Quickscrub: action:DRAGANDDROP Source child: QUICK 9) Quickswitch: action:FLING Source child: QUICK Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
72 lines
2.5 KiB
Java
72 lines
2.5 KiB
Java
/*
|
|
* Copyright (C) 2017 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
package com.android.launcher3.uioverrides;
|
|
|
|
import static com.android.launcher3.LauncherState.OVERVIEW;
|
|
|
|
import android.view.MotionEvent;
|
|
|
|
import com.android.launcher3.Launcher;
|
|
import com.android.launcher3.touch.SwipeDetector;
|
|
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.VerticalSwipeController;
|
|
|
|
/**
|
|
* Extension of {@link VerticalSwipeController} which allows swipe up from OVERVIEW to ALL_APPS
|
|
* Note that the swipe down is handled by {@link TwoStepSwipeController}.
|
|
*/
|
|
public class OverviewSwipeUpController extends VerticalSwipeController {
|
|
|
|
public OverviewSwipeUpController(Launcher l) {
|
|
super(l, OVERVIEW);
|
|
}
|
|
|
|
@Override
|
|
protected boolean shouldInterceptTouch(MotionEvent ev) {
|
|
if (!mLauncher.isInState(OVERVIEW)) {
|
|
return false;
|
|
}
|
|
if (mLauncher.getDeviceProfile().isVerticalBarLayout()) {
|
|
return ev.getY() >
|
|
mLauncher.getDragLayer().getHeight() * OVERVIEW.getVerticalProgress(mLauncher);
|
|
} else {
|
|
return mLauncher.getDragLayer().isEventOverHotseat(ev);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
protected int getSwipeDirection(MotionEvent ev) {
|
|
return SwipeDetector.DIRECTION_POSITIVE;
|
|
}
|
|
|
|
@Override
|
|
protected void onTransitionComplete(boolean wasFling, boolean stateChanged) {
|
|
if (stateChanged) {
|
|
// Transition complete. log the action
|
|
mLauncher.getUserEventDispatcher().logStateChangeAction(
|
|
wasFling ? Touch.FLING : Touch.SWIPE,
|
|
Direction.UP,
|
|
ContainerType.HOTSEAT,
|
|
ContainerType.TASKSWITCHER,
|
|
ContainerType.ALLAPPS,
|
|
mLauncher.getWorkspace().getCurrentPage());
|
|
}
|
|
|
|
}
|
|
}
|