Merge "Using edgeEffect for overscroll in all-apps and widget tray" into sc-dev

This commit is contained in:
Sunny Goyal
2021-03-30 17:13:04 +00:00
committed by Android (Google) Code Review
3 changed files with 78 additions and 134 deletions

View File

@@ -77,7 +77,7 @@ import com.android.launcher3.workprofile.PersonalWorkSlidingTabStrip.OnActivePag
public class AllAppsContainerView extends SpringRelativeLayout implements DragSource,
Insettable, OnDeviceProfileChangeListener, OnActivePageChangedListener {
private static final float FLING_VELOCITY_MULTIPLIER = 135f;
private static final float FLING_VELOCITY_MULTIPLIER = 1000 * .8f;
// Starts the springs after at least 55% of the animation has passed.
private static final float FLING_ANIMATION_THRESHOLD = 0.55f;
private static final int ALPHA_CHANNEL_COUNT = 2;
@@ -140,12 +140,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
mAllAppsStore.addUpdateListener(this::onAppsUpdated);
addSpringView(R.id.all_apps_header);
addSpringView(R.id.apps_list_view);
addSpringView(R.id.all_apps_tabs_view_pager);
mMultiValueAlpha = new MultiValueAlpha(this, ALPHA_CHANNEL_COUNT);
}
/**
@@ -169,14 +164,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
return mWorkModeSwitch;
}
@Override
protected void setDampedScrollShift(float shift) {
// Bound the shift amount to avoid content from drawing on top (Y-val) of the QSB.
float maxShift = getSearchView().getHeight() / 2f;
super.setDampedScrollShift(Utilities.boundToRange(shift, -maxShift, maxShift));
}
@Override
public void onDeviceProfileChanged(DeviceProfile dp) {
for (AdapterHolder holder : mAH) {
@@ -408,12 +395,6 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
}
}
@Override
public int getCanvasClipTopForOverscroll() {
// Do not clip if the QSB is attached to the spring, otherwise the QSB will get clipped.
return mSpringViews.get(getSearchView().getId()) ? 0 : mHeader.getTop();
}
private void rebindAdapters(boolean showTabs) {
rebindAdapters(showTabs, false /* force */);
}
@@ -640,11 +621,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
public void onAnimationUpdate(ValueAnimator valueAnimator) {
if (shouldSpring
&& valueAnimator.getAnimatedFraction() >= FLING_ANIMATION_THRESHOLD) {
int searchViewId = getSearchView().getId();
addSpringView(searchViewId);
finishWithShiftAndVelocity(1, velocity * FLING_VELOCITY_MULTIPLIER,
(anim, canceled, value, velocity) -> removeSpringView(searchViewId));
absorbSwipeUpVelocity(Math.abs(
Math.round(velocity * FLING_VELOCITY_MULTIPLIER)));
shouldSpring = false;
}
}