Java Code Examples for androidx.recyclerview.widget.OrientationHelper#createVerticalHelper()
The following examples show how to use
androidx.recyclerview.widget.OrientationHelper#createVerticalHelper() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecyclerViewPositionHelper.java From mollyim-android with GNU General Public License v3.0 | 5 votes |
View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { OrientationHelper helper; if (layoutManager.canScrollVertically()) { helper = OrientationHelper.createVerticalHelper(layoutManager); } else { helper = OrientationHelper.createHorizontalHelper(layoutManager); } final int start = helper.getStartAfterPadding(); final int end = helper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = layoutManager.getChildAt(i); final int childStart = helper.getDecoratedStart(child); final int childEnd = helper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
Example 2
Source File: StartSnapHelper.java From litho with Apache License 2.0 | 5 votes |
@NonNull private OrientationHelper getVerticalHelper(@NonNull LayoutManager layoutManager) { if (mVerticalHelper == null || mVerticalHelperLayoutManager != layoutManager) { mVerticalHelper = OrientationHelper.createVerticalHelper(layoutManager); mVerticalHelperLayoutManager = layoutManager; } return mVerticalHelper; }
Example 3
Source File: GalleryLayoutManager.java From CardSlideView with Apache License 2.0 | 5 votes |
private OrientationHelper getOrientationHelper() { if (mOrientation == LinearLayout.HORIZONTAL) { if (mHorizontalHelper == null) { mHorizontalHelper = OrientationHelper.createHorizontalHelper(this); } return mHorizontalHelper; } else { if (mVerticalHelper == null) { mVerticalHelper = OrientationHelper.createVerticalHelper(this); } return mVerticalHelper; } }
Example 4
Source File: RecyclerViewPositionHelper.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { OrientationHelper helper; if (layoutManager.canScrollVertically()) { helper = OrientationHelper.createVerticalHelper(layoutManager); } else { helper = OrientationHelper.createHorizontalHelper(layoutManager); } final int start = helper.getStartAfterPadding(); final int end = helper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = layoutManager.getChildAt(i); final int childStart = helper.getDecoratedStart(child); final int childEnd = helper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
Example 5
Source File: RecyclerViewPositionHelper.java From UltimateRecyclerView with Apache License 2.0 | 5 votes |
private View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { OrientationHelper helper; if (layoutManager.canScrollVertically()) { helper = OrientationHelper.createVerticalHelper(layoutManager); } else { helper = OrientationHelper.createHorizontalHelper(layoutManager); } final int start = helper.getStartAfterPadding(); final int end = helper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = layoutManager.getChildAt(i); final int childStart = helper.getDecoratedStart(child); final int childEnd = helper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
Example 6
Source File: RecyclerViewPositionHelper.java From Applozic-Android-SDK with BSD 3-Clause "New" or "Revised" License | 5 votes |
View findOneVisibleChild(int fromIndex, int toIndex, boolean completelyVisible, boolean acceptPartiallyVisible) { OrientationHelper helper; if (linearLayoutManager.canScrollVertically()) { helper = OrientationHelper.createVerticalHelper(linearLayoutManager); } else { helper = OrientationHelper.createHorizontalHelper(linearLayoutManager); } final int start = helper.getStartAfterPadding(); final int end = helper.getEndAfterPadding(); final int next = toIndex > fromIndex ? 1 : -1; View partiallyVisible = null; for (int i = fromIndex; i != toIndex; i += next) { final View child = linearLayoutManager.getChildAt(i); final int childStart = helper.getDecoratedStart(child); final int childEnd = helper.getDecoratedEnd(child); if (childStart < end && childEnd > start) { if (completelyVisible) { if (childStart >= start && childEnd <= end) { return child; } else if (acceptPartiallyVisible && partiallyVisible == null) { partiallyVisible = child; } } else { return child; } } } return partiallyVisible; }
Example 7
Source File: GravityDelegate.java From GetApk with MIT License | 4 votes |
private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) { if (verticalHelper == null) { verticalHelper = OrientationHelper.createVerticalHelper(layoutManager); } return verticalHelper; }
Example 8
Source File: GravitySnapHelper.java From GravitySnapHelper with Apache License 2.0 | 4 votes |
private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) { if (verticalHelper == null || verticalHelper.getLayoutManager() != layoutManager) { verticalHelper = OrientationHelper.createVerticalHelper(layoutManager); } return verticalHelper; }
Example 9
Source File: SnapToStartHelper.java From aptoide-client-v8 with GNU General Public License v3.0 | 4 votes |
private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) { if (verticalHelper == null) { verticalHelper = OrientationHelper.createVerticalHelper(layoutManager); } return verticalHelper; }
Example 10
Source File: GravitySnapHelper.java From MaterialDateTimePicker with Apache License 2.0 | 4 votes |
private OrientationHelper getVerticalHelper(RecyclerView.LayoutManager layoutManager) { if (verticalHelper == null) { verticalHelper = OrientationHelper.createVerticalHelper(layoutManager); } return verticalHelper; }