|
|
@@ -193,17 +193,7 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
|
|
|
// modify itemView x -------------------------------------------------
|
|
|
|
|
|
// bitmap x -------------------------------------------------------
|
|
|
- if (imageWidth < screenWidth) {
|
|
|
-
|
|
|
- /**
|
|
|
- * 이미지가 스크린보다 작을 때
|
|
|
- */
|
|
|
- // x = 0 ~ screen.w - mask.w
|
|
|
- ratio = (float) x / (screenWidth - maskWidth);
|
|
|
- tx = -((int) ((imageWidth - maskWidth) * ratio)) - tx; // image 이동 구간 0 ~ -image.w-mask.w, 이미지 view 이동 구간 반영
|
|
|
-
|
|
|
- }
|
|
|
- else {
|
|
|
+ if (imageWidth > screenWidth) {
|
|
|
/**
|
|
|
* 이미지가 스크린보다 클 때
|
|
|
*/
|
|
|
@@ -211,6 +201,14 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
|
|
|
ratio = (float) (maskWidth + x) / (maskWidth + screenWidth);
|
|
|
tx = -((int) ((imageWidth + maskWidth) * ratio)) + maskWidth - tx; // image 이동 구간 -image.w ~ mask.w, 이미지 view 이동 구간 반영
|
|
|
}
|
|
|
+ else {
|
|
|
+ /**
|
|
|
+ * 이미지가 스크린보다 작을 때
|
|
|
+ */
|
|
|
+ // x = 0 ~ screen.w - mask.w
|
|
|
+ ratio = (float) x / (screenWidth - maskWidth);
|
|
|
+ tx = -((int) ((imageWidth - maskWidth) * ratio)) - tx; // image 이동 구간 0 ~ -image.w-mask.w, 이미지 view 이동 구간 반영
|
|
|
+ }
|
|
|
|
|
|
cx = (int) values[2];
|
|
|
dx = tx - cx;
|
|
|
@@ -234,21 +232,19 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
|
|
|
if (y > -maskHeight && y < screenHeight) { // holder 가 표시되는 부분에서만 계산
|
|
|
|
|
|
// bitmap y -------------------------------------------------------
|
|
|
- if (imageHeight < screenHeight) {
|
|
|
+ if (imageHeight > screenHeight) {
|
|
|
/**
|
|
|
- * 이미지가 스크린보다 작을 때
|
|
|
+ * 이미지가 스크린보다 클 때
|
|
|
*/
|
|
|
- ratio = (float) y / (screenHeight - maskHeight);
|
|
|
- ty = -((int) ((imageHeight - maskHeight) * ratio));
|
|
|
-
|
|
|
+ ratio = (float) (maskHeight + y) / (maskHeight + screenHeight);
|
|
|
+ ty = -((int) ((imageHeight + maskHeight) * ratio)) + maskHeight;
|
|
|
}
|
|
|
else {
|
|
|
/**
|
|
|
- * 이미지가 스크린보다 클 때
|
|
|
+ * 이미지가 스크린보다 작을 때
|
|
|
*/
|
|
|
- ratio = (float) (maskHeight + y) / (maskHeight + screenHeight);
|
|
|
- ty = -((int) ((imageHeight + maskHeight) * ratio)) + maskHeight;
|
|
|
-
|
|
|
+ ratio = (float) y / (screenHeight - maskHeight);
|
|
|
+ ty = -((int) ((imageHeight - maskHeight) * ratio));
|
|
|
}
|
|
|
cy = (int) values[5];
|
|
|
dy = ty - cy;
|
|
|
@@ -300,12 +296,14 @@ public class MainCategoryContentsImageView extends MainCategoryContentsView {
|
|
|
|
|
|
onScrolledInternal();
|
|
|
|
|
|
+ int imageOverrideWidth = Math.max(maskWidth + ResourceUtil.dpToPx(50), screenWidth - ResourceUtil.dpToPx(50));
|
|
|
+
|
|
|
Glide.with(imageView)
|
|
|
.load(url)
|
|
|
// .apply(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.NONE))
|
|
|
// .apply(new RequestOptions().skipMemoryCache(true))
|
|
|
.apply(new RequestOptions().centerCrop())
|
|
|
- .apply(new RequestOptions().override(maskWidth + ResourceUtil.dpToPx(200), maskHeight + ResourceUtil.dpToPx(50)))
|
|
|
+ .apply(new RequestOptions().override(/*maskWidth + ResourceUtil.dpToPx(200)*/ imageOverrideWidth, maskHeight + ResourceUtil.dpToPx(50)))
|
|
|
.listener(new RequestListener<Drawable>() {
|
|
|
@Override
|
|
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|