Allow BaseState.getTransitionDuration to read DeviceProfile
- Changed handheld duration to AllApps to 600
Bug: 227745955
Test: manual
Change-Id: I6f6642440dda3e39947231c2d38e8b60d152e08f
diff --git a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
index 2d7ce32..c4837a0 100644
--- a/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
+++ b/quickstep/src/com/android/launcher3/taskbar/allapps/TaskbarAllAppsSlideInView.java
@@ -62,7 +62,7 @@
PropertyValuesHolder.ofFloat(TRANSLATION_SHIFT, TRANSLATION_SHIFT_OPENED));
mOpenCloseAnimator.setInterpolator(AGGRESSIVE_EASE);
mOpenCloseAnimator.setDuration(
- ALL_APPS.getTransitionDuration(mContext, true /* isToState */)).start();
+ ALL_APPS.getTransitionDuration(mActivityContext, true /* isToState */)).start();
} else {
mTranslationShift = TRANSLATION_SHIFT_OPENED;
}
@@ -81,7 +81,8 @@
@Override
protected void handleClose(boolean animate) {
Optional.ofNullable(mOnCloseBeginListener).ifPresent(OnCloseListener::onSlideInViewClosed);
- handleClose(animate, ALL_APPS.getTransitionDuration(mContext, false /* isToState */));
+ handleClose(animate,
+ ALL_APPS.getTransitionDuration(mActivityContext, false /* isToState */));
}
@Override
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 621dfb8..7b01670 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -20,6 +20,7 @@
import android.content.Context;
+import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -38,8 +39,11 @@
}
@Override
- public int getTransitionDuration(Context context, boolean isToState) {
- return isToState ? 500 : 300;
+ public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
+ int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
+ return !context.getDeviceProfile().isTablet && isToState
+ ? 600
+ : isToState ? 500 : 300;
}
@Override
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 72f4221..d4c5b8f 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -4051,7 +4051,7 @@
// TODO(194414938) starting bounds seem slightly off, investigate
Rect firstTaskStartingBounds = new Rect();
Rect firstTaskEndingBounds = mTempRect;
- int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext(),
+ int duration = mActivity.getStateManager().getState().getTransitionDuration(mActivity,
false /* isToState */);
PendingAnimation pendingAnimation = new PendingAnimation(duration);
diff --git a/src/com/android/launcher3/statemanager/BaseState.java b/src/com/android/launcher3/statemanager/BaseState.java
index 4a68dda..f9a36ad 100644
--- a/src/com/android/launcher3/statemanager/BaseState.java
+++ b/src/com/android/launcher3/statemanager/BaseState.java
@@ -18,6 +18,7 @@
import android.content.Context;
import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
/**
* Interface representing a state of a StatefulActivity
@@ -36,7 +37,8 @@
/**
* @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
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
index 2f8e680..52a6759 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -20,6 +20,7 @@
import android.content.Context;
+import com.android.launcher3.DeviceProfile.DeviceProfileListenable;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -39,8 +40,11 @@
}
@Override
- public int getTransitionDuration(Context context, boolean isToState) {
- return isToState ? 500 : 300;
+ public <DEVICE_PROFILE_CONTEXT extends Context & DeviceProfileListenable>
+ int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
+ return !context.getDeviceProfile().isTablet && isToState
+ ? 600
+ : isToState ? 500 : 300;
}
@Override