Add physics motion to items in all apps.

Motion applied to:
- Icons
- Prediction icons
- Prediction divider

Bug: 38349031
Change-Id: I376e6e39080c8c80463a0ce8b104b05e4d576f17
This commit is contained in:
Jon Miranda
2017-04-20 12:07:38 -07:00
parent 09273b676e
commit 4e11c2738a
9 changed files with 379 additions and 6 deletions

View File

@@ -28,8 +28,8 @@ import android.view.View;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
import com.android.launcher3.anim.SpringAnimationHandler;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.DrawableFactory;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -53,6 +53,8 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
private AllAppsBackgroundDrawable mEmptySearchBackground;
private int mEmptySearchBackgroundTopOffset;
private SpringAnimationHandler mSpringAnimationHandler;
public AllAppsRecyclerView(Context context) {
this(context, null);
}
@@ -75,6 +77,18 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
R.dimen.all_apps_empty_search_bg_top_offset);
}
public void setSpringAnimationHandler(SpringAnimationHandler springAnimationHandler) {
mSpringAnimationHandler = springAnimationHandler;
}
@Override
public boolean onTouchEvent(MotionEvent e) {
if (FeatureFlags.LAUNCHER3_PHYSICS && mSpringAnimationHandler != null) {
mSpringAnimationHandler.addMovement(e);
}
return super.onTouchEvent(e);
}
/**
* Sets the list of apps in this view, used to determine the fastscroll position.
*/