mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Properly prevent All Apps relayouts by avoiding scrollToPosition
Calling scrollToPosition on RecyclerView internally calls requestLayout() (to cacluate where to scroll and then go there). Therefore, we should avoid calling that whenever possible, especially during transitions. In particular, we can optimize scrollToTop() to not scrollToPosition() if we are already at the top. This makes some other workarounds unnecessary, namely setting All Apps to GONE during system gestures. Test: Open an app, swipe up, ensure AllAppsRecyclerView doesn't get onLayout(). If we had scrolled to an app first, we get one layout in prepareRecentsUi(), but not during the transition. Bug: 140308849 Change-Id: I62ee341bf5893c121cfc013cc6542559f79d2a42
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package com.android.launcher3.allapps;
|
||||
|
||||
import static android.view.View.ALPHA;
|
||||
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
|
||||
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
|
||||
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
|
||||
@@ -12,7 +10,6 @@ import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_FADE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_ALL_APPS_HEADER_FADE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_SCALE;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_VERTICAL_PROGRESS;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.FLAG_DONT_UPDATE_ALL_APPS_VISIBILITY;
|
||||
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
|
||||
@@ -21,7 +18,6 @@ import static com.android.launcher3.util.SystemUiController.UI_STATE_ALL_APPS;
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -215,12 +211,7 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil
|
||||
|
||||
Interpolator allAppsFade = builder.getInterpolator(ANIM_ALL_APPS_FADE, LINEAR);
|
||||
Interpolator headerFade = builder.getInterpolator(ANIM_ALL_APPS_HEADER_FADE, allAppsFade);
|
||||
View allAppsContent = mAppsView.getContentView();
|
||||
if (!hasAllAppsContent && builder.hasFlag(FLAG_DONT_UPDATE_ALL_APPS_VISIBILITY)) {
|
||||
setter.setFloat(allAppsContent, ALPHA, 0, allAppsFade);
|
||||
} else {
|
||||
setter.setViewAlpha(allAppsContent, hasAllAppsContent ? 1 : 0, allAppsFade);
|
||||
}
|
||||
setter.setViewAlpha(mAppsView.getContentView(), hasAllAppsContent ? 1 : 0, allAppsFade);
|
||||
setter.setViewAlpha(mAppsView.getScrollBar(), hasAllAppsContent ? 1 : 0, allAppsFade);
|
||||
mAppsView.getFloatingHeaderView().setContentVisibility(hasHeaderExtra, hasAllAppsContent,
|
||||
setter, headerFade, allAppsFade);
|
||||
|
||||
Reference in New Issue
Block a user