@Override public void onBackPressed() { draggerView.closeActivity(); }
public void setAnimationDuration(int baseSettleDuration, int maxSettleDuration) { draggerView.setAnimationDuration(baseSettleDuration, maxSettleDuration); }
public void setDraggerPosition(DraggerPosition dragPosition) { draggerView.setDraggerPosition(dragPosition); }
/** * This is called only the touch on DraggerView is released. * * @param releasedChild return the view on focus * @param xVel return the speed of X animation * @param yVel return the speed of Y animation */ @Override public void onViewReleased(View releasedChild, float xVel, float yVel) { super.onViewReleased(releasedChild, xVel, yVel); if (draggerView.isDragViewAboveTheLimit()) { switch (draggerView.getDragPosition()) { case LEFT: draggerView.closeFromCenterToLeft(); break; case RIGHT: draggerView.closeFromCenterToRight(); break; case TOP: default: draggerView.closeFromCenterToBottom(); break; case BOTTOM: draggerView.closeFromCenterToTop(); break; } } else { draggerView.moveToCenter(); } }
public void closeActivity() { if (dragPosition != null) { switch (dragPosition) { case LEFT: closeFromCenterToLeft(); break; case RIGHT: closeFromCenterToRight(); break; case TOP: default: closeFromCenterToBottom(); break; case BOTTOM: closeFromCenterToTop(); break; } } else { throw new IllegalStateException("dragPosition is null"); } }
/** * Bind the attributes of the view and config * the DraggerView with these params. */ @Override protected void onFinishInflate() { super.onFinishInflate(); if (!isInEditMode()) { mapGUI(attributes); attributes.recycle(); configDragViewHelper(); preparePosition(); } }
@Override public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) { draggerView.setSlideEnabled(scrollY == 0); } @Override public void onDownMotionEvent() { }
/** * Detect the type of motion event (like touch) * at the DraggerView, this can be a simple * detector of the touch, not the listener ifself. * * @param ev Event of MotionEvent * @return View is touched */ @Override public boolean onInterceptTouchEvent(MotionEvent ev) { if (!isEnabled() || !canSlide()) { return false; } final int action = MotionEventCompat.getActionMasked(ev); switch (action) { case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_UP: dragHelper.cancel(); return false; case MotionEvent.ACTION_DOWN: int index = MotionEventCompat.getActionIndex(ev); activePointerId = MotionEventCompat.getPointerId(ev, index); if (activePointerId == INVALID_POINTER) { return false; } default: return dragHelper.shouldInterceptTouchEvent(ev); } }
public void setSlideEnabled(boolean enabled) { draggerView.setSlideEnabled(enabled); }
@Override public void onBackPressed() { draggerView.closeActivity(); }
public void setAnimationDuration(int miliseconds, float multipler) { draggerView.setAnimationDuration(miliseconds, multipler); }
private void configIntents() { draggerView.setDraggerPosition((DraggerPosition) getIntent().getSerializableExtra(DRAG_POSITION)); }
@Override public void onBackPressed() { draggerView.closeActivity(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); draggerView.setAnimationDuration(900, 500); configRecyclerView(); }
public void closeActivity() { draggerView.closeActivity(); }