Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a717d162 authored by Alex Chau's avatar Alex Chau
Browse files

Allow BaseState.getTransitionDuration to read DeviceProfile

- Changed handheld duration to AllApps to 600

Bug: 227745955
Test: manual
Change-Id: I6f6642440dda3e39947231c2d38e8b60d152e08f
parent 21ea6828
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -62,7 +62,7 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
                    PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
                    PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
            mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
            mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
            mOpenCloseAnimator.setDuration(
            mOpenCloseAnimator.setDuration(
                    ALL_APPS.getTransitionDuration(mContext, true /* isToState */)).start();
                    ALL_APPS.getTransitionDuration(mActivityContext, true /* isToState */)).start();
        } else {
        } else {
            mTranslationShift = TRANSLATION_SHIFT_OPENED;
            mTranslationShift = TRANSLATION_SHIFT_OPENED;
        }
        }
@@ -81,7 +81,8 @@ public class TaskbarAllAppsSlideInView extends AbstractSlideInView<TaskbarAllApp
    @Override
    @Override
    protected void handleClose(boolean animate) {
    protected void handleClose(boolean animate) {
        Optional.ofNullable(mOnCloseBeginListener).ifPresent(OnCloseListener::onSlideInViewClosed);
        Optional.ofNullable(mOnCloseBeginListener).ifPresent(OnCloseListener::onSlideInViewClosed);
        handleClose(animate, ALL_APPS.getTransitionDuration(mContext, false /* isToState */));
        handleClose(animate,
                ALL_APPS.getTransitionDuration(mActivityContext, false /* isToState */));
    }
    }


    @Override
    @Override
+6 −2
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAP


import android.content.Context;
import android.content.Context;


import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.R;
@@ -38,8 +39,11 @@ public class AllAppsState extends LauncherState {
    }
    }


    @Override
    @Override
    public int getTransitionDuration(Context context, boolean isToState) {
    public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
        return isToState ? 500 : 300;
    int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
        return !context.getDeviceProfile().isTablet && isToState
                ? 600
                : isToState ? 500 : 300;
    }
    }


    @Override
    @Override
+1 −1
Original line number Original line Diff line number Diff line
@@ -4051,7 +4051,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
        // TODO(194414938) starting bounds seem slightly off, investigate
        // TODO(194414938) starting bounds seem slightly off, investigate
        Rect firstTaskStartingBounds = new Rect();
        Rect firstTaskStartingBounds = new Rect();
        Rect firstTaskEndingBounds = mTempRect;
        Rect firstTaskEndingBounds = mTempRect;
        int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext(),
        int duration = mActivity.getStateManager().getState().getTransitionDuration(mActivity,
                false /* isToState */);
                false /* isToState */);
        PendingAnimation pendingAnimation = new PendingAnimation(duration);
        PendingAnimation pendingAnimation = new PendingAnimation(duration);


+3 −1
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.launcher3.statemanager;
import android.content.Context;
import android.content.Context;


import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.DeviceProfileListenable;


/**
/**
 * Interface representing a state of a StatefulActivity
 * Interface representing a state of a StatefulActivity
@@ -36,7 +37,8 @@ public interface BaseState<T extends BaseState> {
    /**
    /**
     * @return How long the animation to this state should take (or from this state to NORMAL).
     * @return How long the animation to this state should take (or from this state to NORMAL).
     */
     */
    int getTransitionDuration(Context context, boolean isToState);
    <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
    int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState);


    /**
    /**
     * Returns the state to go back to from this state
     * Returns the state to go back to from this state
+6 −2
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@ import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAP


import android.content.Context;
import android.content.Context;


import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.R;
@@ -39,8 +40,11 @@ public class AllAppsState extends LauncherState {
    }
    }


    @Override
    @Override
    public int getTransitionDuration(Context context, boolean isToState) {
    public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
        return isToState ? 500 : 300;
    int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
        return !context.getDeviceProfile().isTablet && isToState
                ? 600
                : isToState ? 500 : 300;
    }
    }


    @Override
    @Override