Loading res/layout/all_apps.xml +1 −8 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ <include layout="@layout/all_apps_rv_layout" /> <include layout="@layout/all_apps_fast_scroller" /> <include layout="@layout/all_apps_floating_header" /> <!-- Note: we are reusing/repurposing a system attribute for search layout, because of a Loading @@ -39,10 +37,5 @@ android:id="@id/search_container_all_apps" layout="@layout/search_container_all_apps"/> <View android:id="@+id/nav_bar_bg" android:layout_width="match_parent" android:layout_height="0dp" android:layout_alignParentBottom="true" android:background="?attr/allAppsNavBarScrimColor" /> <include layout="@layout/all_apps_fast_scroller" /> </com.android.launcher3.allapps.AllAppsContainerView> No newline at end of file res/layout/widgets_full_sheet.xml +0 −8 Original line number Diff line number Diff line Loading @@ -47,13 +47,5 @@ android:layout_height="match_parent" android:layout_gravity="end" android:layout_marginEnd="@dimen/fastscroll_end_margin" /> <View android:id="@+id/nav_bar_bg" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="bottom" android:background="?attr/allAppsNavBarScrimColor" android:focusable="false" /> </com.android.launcher3.views.TopRoundedCornerView> </com.android.launcher3.widget.WidgetsFullSheet> No newline at end of file src/com/android/launcher3/BaseRecyclerView.java +3 −42 Original line number Diff line number Diff line Loading @@ -33,8 +33,7 @@ import com.android.launcher3.views.RecyclerViewFastScroller; * <li> Enable fast scroller. * </ul> */ public abstract class BaseRecyclerView extends RecyclerView implements RecyclerView.OnItemTouchListener { public abstract class BaseRecyclerView extends RecyclerView { protected RecyclerViewFastScroller mScrollbar; Loading @@ -50,12 +49,6 @@ public abstract class BaseRecyclerView extends RecyclerView super(context, attrs, defStyleAttr); } @Override protected void onFinishInflate() { super.onFinishInflate(); addOnItemTouchListener(this); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); Loading @@ -69,40 +62,8 @@ public abstract class BaseRecyclerView extends RecyclerView onUpdateScrollbar(0); } /** * We intercept the touch handling only to support fast scrolling when initiated from the * scroll bar. Otherwise, we fall back to the default RecyclerView touch handling. */ @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent ev) { return handleTouchEvent(ev); } @Override public void onTouchEvent(RecyclerView rv, MotionEvent ev) { handleTouchEvent(ev); } /** * Handles the touch event and determines whether to show the fast scroller (or updates it if * it is already showing). */ private boolean handleTouchEvent(MotionEvent ev) { // Move to mScrollbar's coordinate system. // We need to take parent into account (view pager's location) ViewGroup parent = (ViewGroup) getParent(); int left = parent.getLeft() - mScrollbar.getLeft(); int top = parent.getTop() + getTop() - mScrollbar.getTop() - getScrollBarTop(); ev.offsetLocation(left, top); try { return mScrollbar.handleTouchEvent(ev); } finally { ev.offsetLocation(-left, -top); } } public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { // DO NOT REMOVE, NEEDED IMPLEMENTATION FOR M BUILDS public RecyclerViewFastScroller getScrollbar() { return mScrollbar; } public int getScrollBarTop() { Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +56 −25 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.launcher3.allapps; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.os.Process; import android.support.annotation.NonNull; Loading Loading @@ -57,6 +60,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.BottomUserEducationView; import com.android.launcher3.views.RecyclerViewFastScroller; /** * The all apps view container. Loading @@ -70,6 +74,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private final ItemInfoMatcher mWorkMatcher = ItemInfoMatcher.not(mPersonalMatcher); private final AllAppsStore mAllAppsStore = new AllAppsStore(); private final Paint mNavBarScrimPaint; private int mNavBarScrimHeight = 0; private SearchUiManager mSearchUiManager; private View mSearchContainer; private AllAppsPagedView mViewPager; Loading @@ -80,6 +87,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private boolean mUsingTabs; private boolean mSearchModeWhileUsingTabs = false; private RecyclerViewFastScroller mTouchHandler; private final Point mFastScrollerOffset = new Point(); public AllAppsContainerView(Context context) { this(context, null); } Loading @@ -101,6 +111,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mAH[AdapterHolder.MAIN] = new AdapterHolder(false /* isWork */); mAH[AdapterHolder.WORK] = new AdapterHolder(true /* isWork */); mNavBarScrimPaint = new Paint(); mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor)); mAllAppsStore.addUpdateListener(this::onAppsUpdated); // Attach a scrim to be drawn behind all-apps and hotseat Loading @@ -108,26 +121,10 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, .attach(); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); applyTouchDelegate(); } private void applyTouchDelegate() { // TODO: Reimplement once fast scroller is fixed. } public AllAppsStore getAppsStore() { return mAllAppsStore; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); applyTouchDelegate(); } @Override public void onDeviceProfileChanged(DeviceProfile dp) { for (AdapterHolder holder : mAH) { Loading Loading @@ -163,7 +160,38 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, return true; } AllAppsRecyclerView rv = getActiveRecyclerView(); return rv == null || rv.shouldContainerScroll(ev, mLauncher.getDragLayer()); if (rv == null) { return true; } if (rv.getScrollbar().getThumbOffsetY() >= 0 && mLauncher.getDragLayer().isEventOverView(rv.getScrollbar(), ev)) { return false; } return rv.shouldContainerScroll(ev, mLauncher.getDragLayer()); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { AllAppsRecyclerView rv = getActiveRecyclerView(); if (rv != null && rv.getScrollbar().isHitInParent(ev.getX(), ev.getY(), mFastScrollerOffset)) { mTouchHandler = rv.getScrollbar(); } } if (mTouchHandler != null) { return mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); } return false; } @Override public boolean onTouchEvent(MotionEvent ev) { if (mTouchHandler != null) { mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); return true; } return false; } public AllAppsRecyclerView getActiveRecyclerView() { Loading Loading @@ -282,14 +310,20 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, } setLayoutParams(mlp); View navBarBg = findViewById(R.id.nav_bar_bg); ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams(); navBarBgLp.height = insets.bottom; navBarBg.setLayoutParams(navBarBgLp); mNavBarScrimHeight = insets.bottom; InsettableFrameLayout.dispatchInsets(this, insets); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mNavBarScrimHeight > 0) { canvas.drawRect(0, getHeight() - mNavBarScrimHeight, getWidth(), getHeight(), mNavBarScrimPaint); } } public SpringAnimationHandler getSpringAnimationHandler() { return mUsingTabs ? null : mAH[AdapterHolder.MAIN].animationHandler; } Loading Loading @@ -320,8 +354,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mAllAppsStore.registerIconContainer(mAH[AdapterHolder.MAIN].recyclerView); mAllAppsStore.registerIconContainer(mAH[AdapterHolder.WORK].recyclerView); applyTouchDelegate(); } private void replaceRVContainer(boolean showTabs) { Loading Loading @@ -352,7 +384,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, public void onTabChanged(int pos) { mHeader.setMainActive(pos == 0); reset(); applyTouchDelegate(); if (mAH[pos].recyclerView != null) { mAH[pos].recyclerView.bindFastScrollbar(); Loading src/com/android/launcher3/allapps/AllAppsRecyclerView.java +0 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine int defStyleRes) { super(context, attrs, defStyleAttr); Resources res = getResources(); addOnItemTouchListener(this); mEmptySearchBackgroundTopOffset = res.getDimensionPixelSize( R.dimen.all_apps_empty_search_bg_top_offset); Loading Loading
res/layout/all_apps.xml +1 −8 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ <include layout="@layout/all_apps_rv_layout" /> <include layout="@layout/all_apps_fast_scroller" /> <include layout="@layout/all_apps_floating_header" /> <!-- Note: we are reusing/repurposing a system attribute for search layout, because of a Loading @@ -39,10 +37,5 @@ android:id="@id/search_container_all_apps" layout="@layout/search_container_all_apps"/> <View android:id="@+id/nav_bar_bg" android:layout_width="match_parent" android:layout_height="0dp" android:layout_alignParentBottom="true" android:background="?attr/allAppsNavBarScrimColor" /> <include layout="@layout/all_apps_fast_scroller" /> </com.android.launcher3.allapps.AllAppsContainerView> No newline at end of file
res/layout/widgets_full_sheet.xml +0 −8 Original line number Diff line number Diff line Loading @@ -47,13 +47,5 @@ android:layout_height="match_parent" android:layout_gravity="end" android:layout_marginEnd="@dimen/fastscroll_end_margin" /> <View android:id="@+id/nav_bar_bg" android:layout_width="match_parent" android:layout_height="0dp" android:layout_gravity="bottom" android:background="?attr/allAppsNavBarScrimColor" android:focusable="false" /> </com.android.launcher3.views.TopRoundedCornerView> </com.android.launcher3.widget.WidgetsFullSheet> No newline at end of file
src/com/android/launcher3/BaseRecyclerView.java +3 −42 Original line number Diff line number Diff line Loading @@ -33,8 +33,7 @@ import com.android.launcher3.views.RecyclerViewFastScroller; * <li> Enable fast scroller. * </ul> */ public abstract class BaseRecyclerView extends RecyclerView implements RecyclerView.OnItemTouchListener { public abstract class BaseRecyclerView extends RecyclerView { protected RecyclerViewFastScroller mScrollbar; Loading @@ -50,12 +49,6 @@ public abstract class BaseRecyclerView extends RecyclerView super(context, attrs, defStyleAttr); } @Override protected void onFinishInflate() { super.onFinishInflate(); addOnItemTouchListener(this); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); Loading @@ -69,40 +62,8 @@ public abstract class BaseRecyclerView extends RecyclerView onUpdateScrollbar(0); } /** * We intercept the touch handling only to support fast scrolling when initiated from the * scroll bar. Otherwise, we fall back to the default RecyclerView touch handling. */ @Override public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent ev) { return handleTouchEvent(ev); } @Override public void onTouchEvent(RecyclerView rv, MotionEvent ev) { handleTouchEvent(ev); } /** * Handles the touch event and determines whether to show the fast scroller (or updates it if * it is already showing). */ private boolean handleTouchEvent(MotionEvent ev) { // Move to mScrollbar's coordinate system. // We need to take parent into account (view pager's location) ViewGroup parent = (ViewGroup) getParent(); int left = parent.getLeft() - mScrollbar.getLeft(); int top = parent.getTop() + getTop() - mScrollbar.getTop() - getScrollBarTop(); ev.offsetLocation(left, top); try { return mScrollbar.handleTouchEvent(ev); } finally { ev.offsetLocation(-left, -top); } } public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) { // DO NOT REMOVE, NEEDED IMPLEMENTATION FOR M BUILDS public RecyclerViewFastScroller getScrollbar() { return mScrollbar; } public int getScrollBarTop() { Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +56 −25 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.launcher3.allapps; import static com.android.launcher3.anim.Interpolators.DEACCEL_2; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.os.Process; import android.support.annotation.NonNull; Loading Loading @@ -57,6 +60,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.Themes; import com.android.launcher3.views.BottomUserEducationView; import com.android.launcher3.views.RecyclerViewFastScroller; /** * The all apps view container. Loading @@ -70,6 +74,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private final ItemInfoMatcher mWorkMatcher = ItemInfoMatcher.not(mPersonalMatcher); private final AllAppsStore mAllAppsStore = new AllAppsStore(); private final Paint mNavBarScrimPaint; private int mNavBarScrimHeight = 0; private SearchUiManager mSearchUiManager; private View mSearchContainer; private AllAppsPagedView mViewPager; Loading @@ -80,6 +87,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, private boolean mUsingTabs; private boolean mSearchModeWhileUsingTabs = false; private RecyclerViewFastScroller mTouchHandler; private final Point mFastScrollerOffset = new Point(); public AllAppsContainerView(Context context) { this(context, null); } Loading @@ -101,6 +111,9 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mAH[AdapterHolder.MAIN] = new AdapterHolder(false /* isWork */); mAH[AdapterHolder.WORK] = new AdapterHolder(true /* isWork */); mNavBarScrimPaint = new Paint(); mNavBarScrimPaint.setColor(Themes.getAttrColor(context, R.attr.allAppsNavBarScrimColor)); mAllAppsStore.addUpdateListener(this::onAppsUpdated); // Attach a scrim to be drawn behind all-apps and hotseat Loading @@ -108,26 +121,10 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, .attach(); } @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); applyTouchDelegate(); } private void applyTouchDelegate() { // TODO: Reimplement once fast scroller is fixed. } public AllAppsStore getAppsStore() { return mAllAppsStore; } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); applyTouchDelegate(); } @Override public void onDeviceProfileChanged(DeviceProfile dp) { for (AdapterHolder holder : mAH) { Loading Loading @@ -163,7 +160,38 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, return true; } AllAppsRecyclerView rv = getActiveRecyclerView(); return rv == null || rv.shouldContainerScroll(ev, mLauncher.getDragLayer()); if (rv == null) { return true; } if (rv.getScrollbar().getThumbOffsetY() >= 0 && mLauncher.getDragLayer().isEventOverView(rv.getScrollbar(), ev)) { return false; } return rv.shouldContainerScroll(ev, mLauncher.getDragLayer()); } @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (ev.getAction() == MotionEvent.ACTION_DOWN) { AllAppsRecyclerView rv = getActiveRecyclerView(); if (rv != null && rv.getScrollbar().isHitInParent(ev.getX(), ev.getY(), mFastScrollerOffset)) { mTouchHandler = rv.getScrollbar(); } } if (mTouchHandler != null) { return mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); } return false; } @Override public boolean onTouchEvent(MotionEvent ev) { if (mTouchHandler != null) { mTouchHandler.handleTouchEvent(ev, mFastScrollerOffset); return true; } return false; } public AllAppsRecyclerView getActiveRecyclerView() { Loading Loading @@ -282,14 +310,20 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, } setLayoutParams(mlp); View navBarBg = findViewById(R.id.nav_bar_bg); ViewGroup.LayoutParams navBarBgLp = navBarBg.getLayoutParams(); navBarBgLp.height = insets.bottom; navBarBg.setLayoutParams(navBarBgLp); mNavBarScrimHeight = insets.bottom; InsettableFrameLayout.dispatchInsets(this, insets); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if (mNavBarScrimHeight > 0) { canvas.drawRect(0, getHeight() - mNavBarScrimHeight, getWidth(), getHeight(), mNavBarScrimPaint); } } public SpringAnimationHandler getSpringAnimationHandler() { return mUsingTabs ? null : mAH[AdapterHolder.MAIN].animationHandler; } Loading Loading @@ -320,8 +354,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, mAllAppsStore.registerIconContainer(mAH[AdapterHolder.MAIN].recyclerView); mAllAppsStore.registerIconContainer(mAH[AdapterHolder.WORK].recyclerView); applyTouchDelegate(); } private void replaceRVContainer(boolean showTabs) { Loading Loading @@ -352,7 +384,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, public void onTabChanged(int pos) { mHeader.setMainActive(pos == 0); reset(); applyTouchDelegate(); if (mAH[pos].recyclerView != null) { mAH[pos].recyclerView.bindFastScrollbar(); Loading
src/com/android/launcher3/allapps/AllAppsRecyclerView.java +0 −1 Original line number Diff line number Diff line Loading @@ -97,7 +97,6 @@ public class AllAppsRecyclerView extends BaseRecyclerView implements LogContaine int defStyleRes) { super(context, attrs, defStyleAttr); Resources res = getResources(); addOnItemTouchListener(this); mEmptySearchBackgroundTopOffset = res.getDimensionPixelSize( R.dimen.all_apps_empty_search_bg_top_offset); Loading