Skip to content

Commit 8dd5818

Browse files
committed
WIP. Testing something.
1 parent 675c22b commit 8dd5818

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

carouselview/src/main/java/com/jama/carouselview/CarouselLinearLayoutManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class CarouselLinearLayoutManager extends LinearLayoutManager {
1010

11-
private boolean isOffsetStart;
11+
private boolean isOffsetCenter;
1212
private boolean scaleOnScroll = false;
1313

1414
CarouselLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
@@ -33,7 +33,7 @@ public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, Recycler
3333
float childWidthHalf = childWidth / 2.f;
3434
float childCenter = child.getLeft() + childWidthHalf;
3535

36-
float parentWidth = this.isOffsetStart ? childWidth : getWidth();
36+
float parentWidth = this.isOffsetCenter ? childWidth : getWidth();
3737
float parentWidthHalf = parentWidth / 2.f;
3838

3939
float d0 = 0.f;
@@ -56,8 +56,8 @@ public int scrollHorizontallyBy(int dx, RecyclerView.Recycler recycler, Recycler
5656
}
5757
}
5858

59-
void isOffsetStart(boolean isOffsetStart) {
60-
this.isOffsetStart = isOffsetStart;
59+
void isOffsetCenter(boolean isOffsetCenter) {
60+
this.isOffsetCenter = isOffsetCenter;
6161
}
6262

6363
void setScaleOnScroll(boolean scaleOnScroll) {

carouselview/src/main/java/com/jama/carouselview/CarouselView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ protected void onDetachedFromWindow() {
108108

109109
private void setAdapter() {
110110
this.layoutManager = new CarouselLinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
111-
this.layoutManager.isOffsetStart(this.getCarouselOffset() == OffsetType.START);
111+
this.layoutManager.isOffsetCenter(this.getCarouselOffset() == OffsetType.CENTER);
112112
if (this.getScaleOnScroll()) this.layoutManager.setScaleOnScroll(true);
113113
carouselRecyclerView.setLayoutManager(this.layoutManager);
114114
this.carouselRecyclerView.setAdapter(new CarouselViewAdapter(getCarouselViewListener(), getResource(), getSize(), carouselRecyclerView, this.getSpacing(), this.getCarouselOffset() == OffsetType.CENTER));

0 commit comments

Comments
 (0)