Open jpvs0101 opened 6 years ago
@jpvs0101
I don't know what do you mean by normal scrolling
, but the way how items are changed is controlling here: https://github.com/Azoft/CarouselLayoutManager/blob/master/CarouselLayoutManager/carousel/src/main/java/com/azoft/carousellayoutmanager/CarouselZoomPostLayoutListener.java
If it is not an answer, please give me a better explanation of your question.
@mig35
I mean, control over the speed of scroll!
To be more precise, i want to control the below method in CarouselLayoutManager.java
@Override
public int scrollHorizontallyBy(final int dx, final RecyclerView.Recycler recycler, final RecyclerView.State state) {
if (VERTICAL == mOrientation) {
return 0;
}
return scrollBy(dx, recycler, state);
}
how to increase the speed of scroll?
@jpvs0101 sorry for a long answer. Basically LayoutManager is not controlling the scrolling speed. The only method where I'm using a scoller is
public void smoothScrollToPosition(@NonNull final RecyclerView recyclerView, @NonNull final RecyclerView.State state, final int position) {
final LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
@Override
public int calculateDyToMakeVisible(final View view, final int snapPreference) {
if (!canScrollVertically()) {
return 0;
}
return getOffsetForCurrentView(view);
}
@Override
public int calculateDxToMakeVisible(final View view, final int snapPreference) {
if (!canScrollHorizontally()) {
return 0;
}
return getOffsetForCurrentView(view);
}
};
linearSmoothScroller.setTargetPosition(position);
startSmoothScroll(linearSmoothScroller);
}
You can override it an use any scoller that you want. Note that this method will be called from CenterScrollListener class.
Other scrolling things are controlled only from the RecyclerView. Basically I can add some multiplier for such events, but I don't think that we need them. If you really need it, you can override scrollHorizontallyBy and scrollVerticallyBy methods and pass smaller/bigger dx and dy values.. may be it will help you
Got it, thank you! On 10-Jul-2018 2:35 pm, "Mikhail Gurevich" notifications@github.com wrote:
@jpvs0101 https://github.com/jpvs0101 sorry for a long answer. Basically LayoutManager is not controlling the scrolling speed. The only method where I'm using a scoller is
public void smoothScrollToPosition(@NonNull final RecyclerView recyclerView, @NonNull final RecyclerView.State state, final int position) { final LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) { @Override public int calculateDyToMakeVisible(final View view, final int snapPreference) { if (!canScrollVertically()) { return 0; }
return getOffsetForCurrentView(view); } @Override public int calculateDxToMakeVisible(final View view, final int snapPreference) { if (!canScrollHorizontally()) { return 0; } return getOffsetForCurrentView(view); } }; linearSmoothScroller.setTargetPosition(position); startSmoothScroll(linearSmoothScroller); }
You can override it an use any scoller that you want. Note that this method will be called from CenterScrollListener class.
Other scrolling things are controlled only from the RecyclerView. Basically I can add some multiplier for such events, but I don't think that we need them. If you really need it, you can override scrollHorizontallyBy and scrollVerticallyBy methods and pass smaller/bigger dx and dy values.. may be it will help you
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Azoft/CarouselLayoutManager/issues/79#issuecomment-403753614, or mute the thread https://github.com/notifications/unsubscribe-auth/AkhD6ivBuKHwVJILEL1cz-nCY5pX2zK5ks5uFG5lgaJpZM4U3a-I .
I want to achieve to same scroll speed, so @jpvs0101 Can you please share your answer with us?
Smooth scroll is awesome! (Especially with zoom effect). But in some cases, better use normal scrolling behaviour! Is there any workaround to make items scroll in normal speed (or control the speed)?