Add springs when user clicks on caret / all apps snaps to top.

Bug: 65373058
Change-Id: I9cc5c4c98fd3e5b53d597c4493f2dcef6d9be94a
This commit is contained in:
Jon Miranda
2017-09-05 11:32:13 -07:00
committed by Jonathan Miranda
parent 2021828034
commit 610af37575
2 changed files with 24 additions and 1 deletions

View File

@@ -424,6 +424,9 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
// The amount by which each adjacent rows' stiffness will differ.
private static final float ROW_STIFFNESS_COEFFICIENT = 50f;
// The percentage by which we multiply each row to create the row factor.
private static final float ROW_PERCENTAGE = 0.3f;
@Override
public SpringAnimation initialize(ViewHolder vh) {
return SpringAnimationHandler.forView(vh.itemView, DynamicAnimation.TRANSLATION_Y, 0);
@@ -462,7 +465,7 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
* effect.
*/
private void calculateSpringValues(SpringAnimation spring, int row, int col) {
float rowFactor = (1 + row) * 0.5f;
float rowFactor = (1 + row) * ROW_PERCENTAGE;
float colFactor = getColumnFactor(col, mAppsPerRow);
float minValue = DEFAULT_MIN_VALUE_PX * (rowFactor + colFactor);