Browse Source

[메인][New] 가로 스냅핑 2
- 마지막 작은 크기의 홀더가 미비

hyodong.min 7 years ago
parent
commit
44f3646b23

+ 26 - 30
app/src/main/java/kr/co/zumo/app/lifeplus/view/screen/main/MainCategoryContentsImageView.java

@@ -8,6 +8,7 @@ import android.graphics.Matrix;
 import android.graphics.drawable.Drawable;
 import android.support.annotation.Nullable;
 import android.support.v7.widget.RecyclerView;
+import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ImageView;
@@ -170,6 +171,26 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
 
       if (x > -maskWidth && x < screenWidth) {  // holder 가 표시되는 부분에서만 계산
 
+        // modify itemView x -------------------------------------------------
+        cx = x;
+        ratio = (float) -cx / maskWidth;
+
+        if (ratio > 1) {
+          ratio = 1;
+        }
+        else if (ratio < 0) {
+          ratio = 0;
+        }
+        tx = (int) -(spaceWidth * ratio);
+
+        // 이미지와 dim 마스크 함께 이동.
+        imageView.setX(tx);
+        mask0.setX(tx);
+        mask1.setX(tx);
+        mask2.setX(tx);
+        // modify itemView x -------------------------------------------------
+
+        // bitmap x -------------------------------------------------------
         if (imageWidth < screenWidth) {
 
           /**
@@ -191,6 +212,7 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
 
         cx = (int) values[2];
         dx = tx - cx;
+        // bitmap x -------------------------------------------------------
 
 //        if (index == 2) {
 //          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " x: " + x);
@@ -209,6 +231,7 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
 
       if (y > -maskHeight && y < screenHeight) {  // holder 가 표시되는 부분에서만 계산
 
+        // bitmap y -------------------------------------------------------
         if (imageHeight < screenHeight) {
           /**
            * 이미지가 스크린보다 작을 때
@@ -227,6 +250,8 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
         }
         cy = (int) values[5];
         dy = ty - cy;
+        // bitmap y -------------------------------------------------------
+
       }
 
       matrix.postTranslate(dx, dy);
@@ -234,35 +259,6 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
       imageView.setImageMatrix(matrix);
     }
 
-    x = (int) itemView.getX();
-    if (x > -maskWidth && x < screenWidth) {  // holder 가 표시되는 부분에서만 계산
-      // modify itemView x
-      cx = x;
-      ratio = (float) -cx / maskWidth;
-
-      if (ratio > 1) {
-        ratio = 1;
-      }
-      else if (ratio < 0) {
-        ratio = 0;
-      }
-      tx = (int) -(spaceWidth * ratio);
-      imageView.setX(tx);
-      mask0.setX(tx);
-      mask1.setX(tx);
-      mask2.setX(tx);
-
-//      if (index == 2) {
-//        Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " cx: " + cx);
-//        Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " ratio: " + ratio);
-//          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " imageWidth: " + imageWidth);
-//          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " maskWidth: " + maskWidth);
-//        Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " tx: " + tx);
-//          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "|" + " dx: " + dx);
-//          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "| item x: " + itemView.getX());
-//          Log.i("APP# MainCategoryContentsImageView | onScrolledInternal", "| item y: " + itemView.getY());
-//      }
-    }
   }
 
 
@@ -345,7 +341,7 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
       try {
         Glide.with(imageView).clear(imageView);
       } catch (Exception e) {
-        e.printStackTrace();
+        Log.w("APP# MainCategoryContentsImageView | dispose", "|" + e.getLocalizedMessage());
       }
       imageView.setOnClickListener(null);
       imageView = null;