Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ppamorim committed May 6, 2015
1 parent c3c1423 commit be0ced1
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions dragger/src/main/java/com/github/ppamorim/dragger/DraggerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class DraggerView extends FrameLayout {
private static final int DEFAULT_DRAG_POSITION = DraggerPosition.TOP.getPosition();
private static final int INVALID_POINTER = -1;

private boolean animationFinish = false;
private boolean canFinish = false;
private boolean canSlide = true;
private int activePointerId = INVALID_POINTER;
Expand Down Expand Up @@ -104,9 +105,14 @@ public DraggerView(Context context, AttributeSet attrs, int defStyle) {
if (dragView != null) {
dragView.measure(measureWidth, measureHeight);
setViewAlpha(dragView, MIN_ALPHA);
closeActivity();
expandWithDelay();
if (!animationFinish) {
closeActivity();
expandWithDelay();
} else {
showViews();
}
}

}

@Override protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
Expand Down Expand Up @@ -182,14 +188,6 @@ public void setListViewPosition(final ListView listView) {
int totalItemCount) {

switch (dragPosition) {
case LEFT:
//parentSize = dragView.getWidth();
//viewAxisPosition = -ViewHelper.getX(dragView) + (parentSize * dragLimit);
break;
case RIGHT:
//parentSize = dragView.getWidth();
//viewAxisPosition = ViewHelper.getX(dragView) + (parentSize * dragLimit);
break;
case TOP:
default:
if(firstVisibleItem > 0) {
Expand Down Expand Up @@ -261,7 +259,6 @@ public DraggerPosition getDragPosition() {
}

public void setDraggerPosition(DraggerPosition dragPosition) {
System.out.println("drag position: " + dragPosition.name());
this.dragPosition = dragPosition;
dragHelperCallback.setDragPosition(dragPosition);
}
Expand Down Expand Up @@ -339,16 +336,21 @@ public void expandWithDelay() {
handler.postDelayed(new Runnable() {
@Override public void run() {
if (isEnabled()) {
setViewAlpha(dragView, MAX_ALPHA);
shadowView.setVisibility(VISIBLE);
showViews();
openActivity();
canFinish = true;
}
}
}, DELAY);
}

private void showViews() {
setViewAlpha(dragView, MAX_ALPHA);
shadowView.setVisibility(VISIBLE);
}

private void openActivity() {
animationFinish = true;
moveToCenter();
}

Expand Down

0 comments on commit be0ced1

Please sign in to comment.