[Search][Motion] Introduce header protection in AllApps

ScrimView exposes ScrimDrawingController that allow FloatingHeaderView to observe AllApps scroll progress and draw header protection on Scrim. In addition, search box independently adopts header protection background to ensure proper clipping behavior.

Test: local
preview: https://drive.google.com/file/d/1_E577AAJ0LBg0zrKJQSEJK9GQnrtx7uv/view?usp=sharing&resourcekey=0-MTxjlB3xWyJ3qPvr4qMdig
Bug: 184946772
Change-Id: I64c0f4f50d26c475d31542148a15c7c145588d3f
This commit is contained in:
Samuel Fufa
2021-05-06 10:02:03 -05:00
parent f94540b28a
commit acebd1f69a
6 changed files with 127 additions and 9 deletions

View File

@@ -38,6 +38,7 @@ import androidx.recyclerview.widget.RecyclerView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.BaseRecyclerView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.R;
import com.android.launcher3.logging.StatsLogManager;
@@ -52,6 +53,7 @@ import java.util.List;
public class AllAppsRecyclerView extends BaseRecyclerView {
private static final String TAG = "AllAppsContainerView";
private static final boolean DEBUG = false;
private final Launcher mLauncher;
private AlphabeticalAppsList mApps;
private final int mNumAppsPerRow;
@@ -87,6 +89,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
R.dimen.all_apps_empty_search_bg_top_offset);
mNumAppsPerRow = LauncherAppState.getIDP(context).numColumns;
mFastScrollHelper = new AllAppsFastScrollHelper(this);
mLauncher = Launcher.getLauncher(context);
}
/**
@@ -199,6 +202,12 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
}
}
@Override
public void onScrolled(int dx, int dy) {
super.onScrolled(dx, dy);
mLauncher.getAppsView().updateHeaderScroll(getCurrentScrollY());
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
boolean result = super.onInterceptTouchEvent(e);
@@ -410,7 +419,7 @@ public class AllAppsRecyclerView extends BaseRecyclerView {
/**
* Returns the available scroll height:
* AvailableScrollHeight = Total height of the all items - last page height
* AvailableScrollHeight = Total height of the all items - last page height
*/
@Override
protected int getAvailableScrollHeight() {