daimajia / daimajia/AndroidSwipeLayout

There is a bug when use lay_down mode.

Open
#233 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.3k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

my layout:

``` xml


```

![](http://i.imgur.com/0D1b7Jt.jpg)
![](http://i.imgur.com/vgMZPbt.jpg)
![](http://i.imgur.com/i9ldJEQ.jpg)
First, drag TEXT to open the layout. Then click on "删除" and drag it left or right. You will see TEXT is moved out of the legal area(I think), leaving a white space between surface view and bottom view.

And I have a solution:
SwipeLayout.mDragHelperCallback.onViewPositionChanged:

``` java
} else if (getBottomViews().contains(changedView)) {
if (mShowMode == ShowMode.PullOut) {
...
} else {
...
if (mCurrentDragEdge == DragEdge.Left) {
if (newLeft < getPaddingLeft()) newLeft = getPaddingLeft();
if (newLeft > mDragDistance) newLeft = mDragDistance;//my modification
} else if (mCurrentDragEdge == DragEdge.Right) {
if (newLeft > getPaddingLeft()) newLeft = getPaddingLeft();
if (newLeft < -mDragDistance)newLeft = -mDragDistance;//my modification
} else ...
...
}
}
```

the original code:

``` java
if (mCurrentDragEdge == DragEdge.Left && newLeft < getPaddingLeft())
newLeft = getPaddingLeft();
else if (mCurrentDragEdge == DragEdge.Right && newLeft > getPaddingLeft())
newLeft = getPaddingLeft();
else ...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.