|
|
@@ -2,7 +2,6 @@ package kr.co.zumo.app.lifeplus.view.screen.event;
|
|
|
|
|
|
import android.support.annotation.NonNull;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
-import android.util.Log;
|
|
|
|
|
|
import kr.co.zumo.app.lifeplus.view.Event;
|
|
|
import kr.co.zumo.app.lifeplus.view.IEventListener;
|
|
|
@@ -26,37 +25,17 @@ public class EventPagerSnapHelper extends CustomPagerSnapHelper {
|
|
|
this.listener = listener;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
protected boolean snapFromFling(@NonNull RecyclerView.LayoutManager layoutManager, int velocityX, int velocityY) {
|
|
|
- if (!(layoutManager instanceof RecyclerView.SmoothScroller.ScrollVectorProvider)) {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ boolean isReturnType = super.snapFromFling(layoutManager, velocityX, velocityY);
|
|
|
|
|
|
- Log.w("APP# EventPagerSnapHelper | snapFromFling", "|" + "velocityX: " + velocityX);
|
|
|
-
|
|
|
- int targetPosition = findTargetSnapPosition(layoutManager, velocityX, velocityY);
|
|
|
- if (targetPosition == RecyclerView.NO_POSITION) {
|
|
|
- return false;
|
|
|
+ if (isReturnType) {
|
|
|
+ if (velocityX > 0) {
|
|
|
+ listener.onEvent(new Event.Builder(Event.ENTRY).build());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- mRecyclerView.smoothScrollToPosition(targetPosition);
|
|
|
- //이벤트 반환
|
|
|
- listener.onEvent(new Event.Builder(Event.ENTRY).build());
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public boolean onFling(int velocityX, int velocityY) {
|
|
|
- RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
|
|
|
- if (layoutManager == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- RecyclerView.Adapter adapter = mRecyclerView.getAdapter();
|
|
|
- if (adapter == null) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- int minFlingVelocity = mRecyclerView.getMinFlingVelocity();
|
|
|
- //flling 이 되면 true가 되서 화면이 이동이 되는거다.......
|
|
|
- return (Math.abs(velocityY) > minFlingVelocity || Math.abs(velocityX) > minFlingVelocity) && snapFromFling(layoutManager, velocityX, velocityY);
|
|
|
+ return isReturnType;
|
|
|
}
|
|
|
}
|