|
|
@@ -3,10 +3,12 @@ package kr.co.zumo.app.lifeplus.view.custom.contents;
|
|
|
import android.content.Context;
|
|
|
import android.support.constraint.ConstraintLayout;
|
|
|
import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.LinearSmoothScroller;
|
|
|
import android.support.v7.widget.PagerSnapHelper;
|
|
|
import android.support.v7.widget.RecyclerView;
|
|
|
import android.support.v7.widget.SnapHelper;
|
|
|
import android.util.AttributeSet;
|
|
|
+import android.util.DisplayMetrics;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.MotionEvent;
|
|
|
import android.view.View;
|
|
|
@@ -197,7 +199,8 @@ public class CustomListicleImageView extends ConstraintLayout {
|
|
|
if (contentsLength > 1) {
|
|
|
layoutPager.setVisibility(View.VISIBLE);
|
|
|
textViewCurrentPage.setText("1");
|
|
|
- textViewTotalPage.setText(String.valueOf(contentsLength));;
|
|
|
+ textViewTotalPage.setText(String.valueOf(contentsLength));
|
|
|
+ ;
|
|
|
}
|
|
|
else {
|
|
|
layoutPager.setVisibility(View.INVISIBLE);
|
|
|
@@ -215,6 +218,18 @@ public class CustomListicleImageView extends ConstraintLayout {
|
|
|
protected int getExtraLayoutSpace(RecyclerView.State state) {
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void smoothScrollToPosition(RecyclerView recyclerView, RecyclerView.State state, int position) {
|
|
|
+ final LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
|
|
|
+ @Override
|
|
|
+ protected float calculateSpeedPerPixel(DisplayMetrics displayMetrics) {
|
|
|
+ return 60f / displayMetrics.densityDpi;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ linearSmoothScroller.setTargetPosition(position);
|
|
|
+ startSmoothScroll(linearSmoothScroller);
|
|
|
+ }
|
|
|
};
|
|
|
recyclerView.setLayoutManager(linearLayoutManager);
|
|
|
|