Search in sources :

Example 6 with LauncherState

use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.

the class QuickstepLauncher method onStateOrResumeChanging.

/**
 * Recents logic that triggers when launcher state changes or launcher activity stops/resumes.
 */
private void onStateOrResumeChanging(boolean inTransition) {
    LauncherState state = getStateManager().getState();
    boolean started = ((getActivityFlags() & ACTIVITY_STATE_STARTED)) != 0;
    if (started) {
        DeviceProfile profile = getDeviceProfile();
        boolean willUserBeActive = (getActivityFlags() & ACTIVITY_STATE_USER_WILL_BE_ACTIVE) != 0;
        boolean visible = (state == NORMAL || state == OVERVIEW) && (willUserBeActive || isUserActive()) && !profile.isVerticalBarLayout() && profile.isPhone && !profile.isLandscape;
        UiThreadHelper.runAsyncCommand(this, SET_SHELF_HEIGHT, visible ? 1 : 0, profile.hotseatBarSizePx);
    }
    if (state == NORMAL && !inTransition) {
        ((RecentsView) getOverviewPanel()).setSwipeDownShouldLaunchApp(false);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState) DeviceProfile(com.android.launcher3.DeviceProfile) RecentsView(com.android.quickstep.views.RecentsView)

Example 7 with LauncherState

use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.

the class AbstractStateChangeTouchController method getSwipeDirection.

private int getSwipeDirection() {
    LauncherState fromState = mLauncher.getStateManager().getState();
    int swipeDirection = 0;
    if (getTargetState(fromState, true) != fromState) {
        swipeDirection |= SingleAxisSwipeDetector.DIRECTION_POSITIVE;
    }
    if (getTargetState(fromState, false) != fromState) {
        swipeDirection |= SingleAxisSwipeDetector.DIRECTION_NEGATIVE;
    }
    return swipeDirection;
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Example 8 with LauncherState

use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.

the class StaggeredWorkspaceAnim method addDepthAnimationForState.

private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
    if (!(launcher instanceof BaseQuickstepLauncher)) {
        return;
    }
    PendingAnimation builder = new PendingAnimation(duration);
    DepthController depthController = ((BaseQuickstepLauncher) launcher).getDepthController();
    depthController.setStateWithAnimation(state, new StateAnimationConfig(), builder);
    mAnimators.play(builder.buildAnim());
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) BaseQuickstepLauncher(com.android.launcher3.BaseQuickstepLauncher) StateAnimationConfig(com.android.launcher3.states.StateAnimationConfig) DepthController(com.android.launcher3.statehandlers.DepthController)

Example 9 with LauncherState

use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.

the class LauncherRecentsView method setOverviewStateEnabled.

@Override
public void setOverviewStateEnabled(boolean enabled) {
    super.setOverviewStateEnabled(enabled);
    if (enabled) {
        LauncherState state = mActivity.getStateManager().getState();
        boolean hasClearAllButton = (state.getVisibleElements(mActivity) & CLEAR_ALL_BUTTON) != 0;
        setDisallowScrollToClearAll(!hasClearAllButton);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Example 10 with LauncherState

use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.

the class AbstractStateChangeTouchController method reinitCurrentAnimation.

private boolean reinitCurrentAnimation(boolean reachedToState, boolean isDragTowardPositive) {
    LauncherState newFromState = mFromState == null ? mLauncher.getStateManager().getState() : reachedToState ? mToState : mFromState;
    LauncherState newToState = getTargetState(newFromState, isDragTowardPositive);
    onReinitToState(newToState);
    if (newFromState == mFromState && newToState == mToState || (newFromState == newToState)) {
        return false;
    }
    mFromState = newFromState;
    mToState = newToState;
    mStartProgress = 0;
    if (mCurrentAnimation != null) {
        mCurrentAnimation.getTarget().removeListener(mClearStateOnCancelListener);
    }
    mProgressMultiplier = initCurrentAnimation();
    mCurrentAnimation.dispatchOnStart();
    return true;
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Aggregations

LauncherState (com.android.launcher3.LauncherState)14 StateAnimationConfig (com.android.launcher3.states.StateAnimationConfig)8 Animator (android.animation.Animator)4 PendingAnimation (com.android.launcher3.anim.PendingAnimation)4 ValueAnimator (android.animation.ValueAnimator)3 RecentsView (com.android.quickstep.views.RecentsView)3 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)2 AnimatorSet (android.animation.AnimatorSet)2 Interpolator (android.view.animation.Interpolator)2 PendingRequestArgs (com.android.launcher3.util.PendingRequestArgs)2 AppWidgetHostView (android.appwidget.AppWidgetHostView)1 Parcelable (android.os.Parcelable)1 FloatProperty (android.util.FloatProperty)1 View (android.view.View)1 VISIBLE (android.view.View.VISIBLE)1 ImageView (android.widget.ImageView)1 Nullable (androidx.annotation.Nullable)1 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)1 CellLayout (com.android.launcher3.CellLayout)1 DeviceProfile (com.android.launcher3.DeviceProfile)1