Merge "Apply the expand animation on Private Space" into main

This commit is contained in:
Brandon Dayauon authored and Android (Google) Code Review committed 2023-12-13 00:02:56 +00:00
commit 553a2c8775
5 files changed
+94 -68

No files matched your search

@@ -30,6 +30,7 @@ import android.os.UserManager;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.Flags;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.util.Preconditions;
@@ -47,6 +48,7 @@ public class PrivateProfileManager extends UserProfileManager {
private static final String SAFETY_CENTER_INTENT = Intent.ACTION_SAFETY_CENTER;
private static final String PS_SETTINGS_FRAGMENT_KEY = ":settings:fragment_args_key";
private static final String PS_SETTINGS_FRAGMENT_VALUE = "AndroidPrivateSpace_personal";
private static final int ANIMATION_DURATION = 2000;
private final ActivityAllAppsContainerView<?> mAllApps;
private final Predicate<UserHandle> mPrivateProfileMatcher;
private PrivateAppsSectionDecorator mPrivateAppsSectionDecorator;
@@ -125,7 +127,6 @@ public class PrivateProfileManager extends UserProfileManager {
// Create a new decorator instance if not already available.
if (mPrivateAppsSectionDecorator == null) {
mPrivateAppsSectionDecorator = new PrivateAppsSectionDecorator(
mAllApps.mActivityContext,
mainAdapterHolder.mAppsList);
}
for (int i = 0; i < mainAdapterHolder.mRecyclerView.getItemDecorationCount(); i++) {
@@ -137,6 +138,13 @@ public class PrivateProfileManager extends UserProfileManager {
}
// Add Private Space Decorator to the Recycler view.
mainAdapterHolder.mRecyclerView.addItemDecoration(mPrivateAppsSectionDecorator);
if (Flags.privateSpaceAnimation() && mAllApps.getActiveRecyclerView()
== mainAdapterHolder.mRecyclerView) {
RecyclerViewAnimationController recyclerViewAnimationController =
new RecyclerViewAnimationController(mAllApps);
recyclerViewAnimationController.animateToState(true /* expand */,
ANIMATION_DURATION, () -> {});
}
} else {
// Remove Private Space Decorator from the Recycler view.
if (mPrivateAppsSectionDecorator != null) {