Checkstyle fixes
This commit is contained in:
parent
56575c3291
commit
2c0a5fcb21
@ -7,8 +7,6 @@ import android.support.v7.widget.OrientationHelper;
|
|||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import static android.support.v7.widget.RecyclerView.NO_POSITION;
|
|
||||||
|
|
||||||
public class LinearLayoutManagerSnapHelper extends LinearSnapHelper {
|
public class LinearLayoutManagerSnapHelper extends LinearSnapHelper {
|
||||||
|
|
||||||
private View lastSavedTarget;
|
private View lastSavedTarget;
|
||||||
@ -66,19 +64,21 @@ public class LinearLayoutManagerSnapHelper extends LinearSnapHelper {
|
|||||||
int currentSmallestDistance = Integer.MAX_VALUE;
|
int currentSmallestDistance = Integer.MAX_VALUE;
|
||||||
View currentSmallestDistanceView = null;
|
View currentSmallestDistanceView = null;
|
||||||
|
|
||||||
int snappedViewIndex = ((LinearLayoutManager)layoutManager).getPosition(snappedView);
|
int snappedViewIndex = ((LinearLayoutManager) layoutManager).getPosition(snappedView);
|
||||||
if (snappedViewIndex != NO_POSITION) {
|
if (snappedViewIndex != RecyclerView.NO_POSITION) {
|
||||||
|
|
||||||
int snapPositionFirst = orientationHelper.getDecoratedMeasurement(((LinearLayoutManager) layoutManager).findViewByPosition(firstChild)) / 2;
|
int snapPositionFirst = orientationHelper.getDecoratedMeasurement(((LinearLayoutManager) layoutManager).findViewByPosition(firstChild)) / 2;
|
||||||
int snapPositionLast = orientationHelper.getTotalSpace() - orientationHelper.getDecoratedMeasurement(((LinearLayoutManager) layoutManager).findViewByPosition(lastChild)) / 2;
|
int snapPositionLast = orientationHelper.getTotalSpace() - orientationHelper.getDecoratedMeasurement(((LinearLayoutManager) layoutManager).findViewByPosition(lastChild)) / 2;
|
||||||
|
|
||||||
// If first item not on screen, ignore views 0..snappedViewIndex-1
|
// If first item not on screen, ignore views 0..snappedViewIndex-1
|
||||||
if (firstChild != 0)
|
if (firstChild != 0) {
|
||||||
firstChild = snappedViewIndex;
|
firstChild = snappedViewIndex;
|
||||||
|
}
|
||||||
|
|
||||||
// If last item not on screen, ignore views snappedViewIndex+1..N
|
// If last item not on screen, ignore views snappedViewIndex+1..N
|
||||||
if (lastChild != this.layoutManager.getItemCount() - 1)
|
if (lastChild != this.layoutManager.getItemCount() - 1) {
|
||||||
lastChild = snappedViewIndex;
|
lastChild = snappedViewIndex;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = firstChild; i <= lastChild; i++) {
|
for (int i = firstChild; i <= lastChild; i++) {
|
||||||
View view = ((LinearLayoutManager) layoutManager).findViewByPosition(i);
|
View view = ((LinearLayoutManager) layoutManager).findViewByPosition(i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user