Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Commit

Permalink
Add interface to control can scroll feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAfc committed Jun 21, 2018
1 parent 07304dd commit ba9a681
Showing 1 changed file with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ public static void enableDebugging(boolean isDebug) {

private boolean mNestedScrolling = false;

private boolean mCanScrollHorizontally;

private boolean mCanScrollVertically;

private boolean mEnableMarginOverlapping = false;

private int mMaxMeasureSize = -1;
Expand Down Expand Up @@ -122,6 +126,8 @@ public VirtualLayoutManager(@NonNull final Context context, int orientation, boo
super(context, orientation, reverseLayout);
this.mOrientationHelper = OrientationHelperEx.createOrientationHelper(this, orientation);
this.mSecondaryOrientationHelper = OrientationHelperEx.createOrientationHelper(this, orientation == VERTICAL ? HORIZONTAL : VERTICAL);
this.mCanScrollVertically = super.canScrollVertically();
this.mCanScrollHorizontally = super.canScrollHorizontally();
setHelperFinder(new RangeLayoutHelperFinder());
}

Expand All @@ -136,6 +142,14 @@ public void setNoScrolling(boolean noScrolling) {
mSpaceMeasuring = false;
}

public void setCanScrollVertically(boolean canScrollVertically) {
this.mCanScrollVertically = canScrollVertically;
}

public void setCanScrollHorizontally(boolean canScrollHorizontally) {
this.mCanScrollHorizontally = canScrollHorizontally;
}

public void setNestedScrolling(boolean nestedScrolling) {
setNestedScrolling(nestedScrolling, -1);
}
Expand Down Expand Up @@ -1261,12 +1275,12 @@ public int getChildMeasureSpec(int parentSize, int size, boolean canScroll) {

@Override
public boolean canScrollHorizontally() {
return super.canScrollHorizontally() && !mNoScrolling;
return mCanScrollHorizontally && !mNoScrolling;
}

@Override
public boolean canScrollVertically() {
return super.canScrollVertically() && !mNoScrolling;
return mCanScrollVertically && !mNoScrolling;
}

@Override
Expand Down

0 comments on commit ba9a681

Please sign in to comment.