|
|
@@ -47,6 +47,7 @@ import kr.co.zumo.app.lifeplus.view.screen.FragmentBase;
|
|
|
*/
|
|
|
public class MainFragment extends FragmentBase<MainPresenter> implements IMainView {
|
|
|
|
|
|
+ private static final int MAX_VELOCITY_Y = 8000;
|
|
|
private RecyclerView contentsRecyclerView;
|
|
|
private MainContentsAdapter adapter;
|
|
|
private PageIndicator indicator;
|
|
|
@@ -217,6 +218,20 @@ public class MainFragment extends FragmentBase<MainPresenter> implements IMainVi
|
|
|
adapter = new MainContentsAdapter(getContext(), data, event -> {
|
|
|
presenter.onEvent(event);
|
|
|
});
|
|
|
+ contentsRecyclerView.setOnFlingListener(new RecyclerView.OnFlingListener() {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean onFling(int velocityX, int velocityY) {
|
|
|
+
|
|
|
+ if (Math.abs(velocityY) > MAX_VELOCITY_Y) {
|
|
|
+ velocityY = MAX_VELOCITY_Y * (int) Math.signum((double) velocityY);
|
|
|
+ contentsRecyclerView.fling(velocityX, velocityY);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
contentsRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false) {
|
|
|
@Override
|