Bladeren bron

[콘텐츠상세][Common] PreCachingLayoutManager 임시 보류

Hasemi 7 jaren geleden
bovenliggende
commit
a63c4ee1f5
1 gewijzigde bestanden met toevoegingen van 47 en 0 verwijderingen
  1. 47 0
      app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/PreCachingLayoutManager.java

+ 47 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/PreCachingLayoutManager.java

@@ -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;
+  }
+}