|
|
@@ -0,0 +1,47 @@
|
|
|
+package kr.co.zumo.app.lifeplus.view.custom;
|
|
|
+
|
|
|
+import android.content.Context;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.util.AttributeSet;
|
|
|
+
|
|
|
+/**
|
|
|
+ * PreCachingLayoutManager
|
|
|
+ * <pre>
|
|
|
+ * </pre>
|
|
|
+ *
|
|
|
+ * @author 하세미
|
|
|
+ * @version 1.0
|
|
|
+ * @history 하세미 [2018-12-04] [최초 작성]
|
|
|
+ * @since 2018-12-04
|
|
|
+ */
|
|
|
+public class PreCachingLayoutManager extends LinearLayoutManager {
|
|
|
+
|
|
|
+ private static final int DEFAULT_EXTRA_LAYOUT_SPACE = 600;
|
|
|
+ private int extraLayoutSpace = -1;
|
|
|
+ private Context context;
|
|
|
+
|
|
|
+ public PreCachingLayoutManager(Context context) {
|
|
|
+ super(context);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PreCachingLayoutManager(Context context, int orientation, boolean reverseLayout) {
|
|
|
+ super(context, orientation, reverseLayout);
|
|
|
+ }
|
|
|
+
|
|
|
+ public PreCachingLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
|
+ super(context, attrs, defStyleAttr, defStyleRes);
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setExtraLayoutSpace(int extraLayoutSpace) {
|
|
|
+ this.extraLayoutSpace = extraLayoutSpace;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getExtraLayoutSpace(RecyclerView.State state) {
|
|
|
+ if (extraLayoutSpace > 0) {
|
|
|
+ return extraLayoutSpace;
|
|
|
+ }
|
|
|
+ return DEFAULT_EXTRA_LAYOUT_SPACE;
|
|
|
+ }
|
|
|
+}
|