Skip to content

Commit dae807b

Browse files
committed
Bump to 2.0
1 parent a11abc2 commit dae807b

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ If you need snapping support to start, top, end or bottom, use GravitySnapHelper
1111
Add this to your build.gradle:
1212

1313
```groovy
14-
implementation 'com.github.rubensousa:gravitysnaphelper:1.5'
14+
implementation 'com.github.rubensousa:gravitysnaphelper:2.0'
1515
```
1616

17-
Otherwise, center snapping is done with LinearSnapHelper (part of the recyclerview-v7 package).
17+
Otherwise, center snapping is done with LinearSnapHelper.
1818

1919
### Snapping center:
2020

2121
```java
22-
SnapHelper snapHelper = new LinearSnapHelper();
23-
snapHelper.attachToRecyclerView(recyclerView);
22+
new LinearSnapHelper().attachToRecyclerView(recyclerView);
2423
```
2524

2625
### Snapping start with GravitySnapHelper:
@@ -29,23 +28,21 @@ snapHelper.attachToRecyclerView(recyclerView);
2928
startRecyclerView.setLayoutManager(new LinearLayoutManager(this,
3029
LinearLayoutManager.HORIZONTAL, false));
3130

32-
SnapHelper snapHelperStart = new GravitySnapHelper(Gravity.START);
33-
snapHelperStart.attachToRecyclerView(startRecyclerView);
31+
new GravitySnapHelper(Gravity.START).attachToRecyclerView(startRecyclerView);
3432
```
3533

3634
### Snapping top with GravitySnapHelper:
3735

3836
```java
3937
topRecyclerView.setLayoutManager(new LinearLayoutManager(this));
4038

41-
SnapHelper snapHelperTop = new GravitySnapHelper(Gravity.TOP);
42-
snapHelperTop.attachToRecyclerView(topRecyclerView);
39+
new GravitySnapHelper(Gravity.TOP).attachToRecyclerView(topRecyclerView);
4340
```
4441

4542
## License
4643

47-
Copyright 2016 The Android Open Source Project
48-
Copyright 2016 Rúben Sousa
44+
Copyright 2018 The Android Open Source Project
45+
Copyright 2018 Rúben Sousa
4946

5047
Licensed under the Apache License, Version 2.0 (the "License");
5148
you may not use this file except in compliance with the License.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1818
# org.gradle.parallel=true
1919
GROUP=com.github.rubensousa
20-
VERSION_NAME=1.5
20+
VERSION_NAME=2.0
2121

2222
POM_ARTIFACT_ID=gravitysnaphelper
2323
POM_NAME=GravitySnapHelper

gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravityDelegate.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,9 @@ private int distanceToEnd(View targetView, LinearLayoutManager lm,
199199
@NonNull OrientationHelper helper) {
200200
int pos = recyclerView.getChildLayoutPosition(targetView);
201201
int distance;
202-
/**
203-
* The last position or the first position
204-
* (when there's a reverse layout or we're on RTL mode) must collapse to the padding edge.
205-
*/
202+
203+
// The last position or the first position
204+
// (when there's a reverse layout or we're on RTL mode) must collapse to the padding edge.
206205
if ((pos == 0 && (isRtl || lm.getReverseLayout())
207206
|| pos == lm.getItemCount() - 1 && (!isRtl || lm.getReverseLayout()))
208207
&& !recyclerView.getClipToPadding()) {

0 commit comments

Comments
 (0)