Browse Source

[카테고리][Bug] 두 번째 row 이지만 마지막에 표시되어 큰 이미지가 표시되지 않을 경우 큰 이미지의 여백을 없애기 위해서 third row로 표시한다.

hyodong.min 7 years ago
parent
commit
71ba1007a1

+ 10 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/category/type2/SecondCategoryMainAdapter.java

@@ -112,7 +112,7 @@ public class SecondCategoryMainAdapter extends RecyclerView.Adapter<SecondCatego
 
   @Override
   public int getItemCount() {
-    return (int) Math.ceil((float)contentsBeans.size() / 3f);
+    return (int) Math.ceil((float) contentsBeans.size() / 3f);
   }
 
   private boolean hasBanner() {
@@ -121,11 +121,18 @@ public class SecondCategoryMainAdapter extends RecyclerView.Adapter<SecondCatego
 
   @Override
   public int getItemViewType(int position) {
-    position = position % 3;
-    switch (position) {
+    int position2 = position % 3;
+
+    switch (position2) {
       case 0:
         return FIRST_ROW;
       case 1:
+        /**
+         * // 두 번째 row 이지만 마지막에 표시되어 큰 이미지가 표시되지 않을 경우 큰 이미지의 여백을 없애기 위해서 third 로 표시한다.
+         */
+        if (contentsBeans.size() - position * 3 < 3) {
+          return THIRD_ROW;
+        }
         return SECOND_ROW;
       case 2:
         return THIRD_ROW;

+ 1 - 5
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/category/type2/SecondCategoryMainHolder.java

@@ -87,19 +87,15 @@ public abstract class SecondCategoryMainHolder extends CategoryMainViewHolder<Ca
     if (null != bean) {
       List<CategoryContentsBean> list = bean.getContentsList();
       if (null != list) {
-        int len = 3; //list.size();
+        int len = list.size();
         for (int i = 0; i < len; ++i) {
           CategoryContentsBean bean = list.get(i);
           if (null != bean) {
-            itemView.setVisibility(View.VISIBLE);
             ImageView imageView = images[i];
             TextView textView = texts[i];
 
             setupView(index + i, list.get(i), imageView, textView);
           }
-          else {
-            itemView.setVisibility(View.INVISIBLE);
-          }
         }
       }
     }