|
|
@@ -144,14 +144,24 @@ public class MainContentsCategoryImageView extends MainCatogoryContentsView {
|
|
|
|
|
|
if (x > -maskWidth && x < screenWidth) { // holder 가 표시되는 부분에서만 계산
|
|
|
// x = 0 ~ screen.w - mask.w
|
|
|
- ratio = (float) x / (screenWidth - maskWidth);
|
|
|
+ int rail = screenWidth - maskWidth;
|
|
|
+ ratio = (float) x / (rail);
|
|
|
|
|
|
tx = -((int) ((imageWidth - maskWidth) * ratio)); // image 이동 구간 0 ~ -image.w-mask.w
|
|
|
|
|
|
+ if (imageWidth > screenWidth) {
|
|
|
+ if (tx > 0) {
|
|
|
+ tx = 0;
|
|
|
+ }
|
|
|
+ else if (tx < maskWidth - imageWidth) {
|
|
|
+ tx = maskWidth - imageWidth;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
cx = (int) values[2];
|
|
|
dx = tx - cx;
|
|
|
|
|
|
-// if (index == 1) {
|
|
|
+// if (index == 2) {
|
|
|
// Log.i("APP# MainContentsCategoryImageView | onScrolledInternal", "|" + " x: " + x);
|
|
|
// Log.i("APP# MainContentsCategoryImageView | onScrolledInternal", "|" + " ratio: " + ratio);
|
|
|
// Log.i("APP# MainContentsCategoryImageView | onScrolledInternal", "|" + " imageWidth: " + imageWidth);
|
|
|
@@ -199,17 +209,26 @@ public class MainContentsCategoryImageView extends MainCatogoryContentsView {
|
|
|
maskWidth = ResourceUtil.getDimension(R.dimen.main_contents_image_width);
|
|
|
maskHeight = ResourceUtil.getDimension(R.dimen.main_contents_image_height);
|
|
|
|
|
|
- Glide.with(getView())
|
|
|
- .load(bean.getImageUrl())
|
|
|
+ String url = bean.getImageUrl();
|
|
|
+
|
|
|
+// Drawable drawable = imageView.getDrawable();
|
|
|
+ //you should call after the bitmap drawn
|
|
|
+// imageWidth = maskWidth + 200; //drawable.getIntrinsicWidth(); //this is the bitmap's width
|
|
|
+// imageHeight = maskHeight + 100; //drawable.getIntrinsicHeight(); //this is the bitmap's height
|
|
|
+//
|
|
|
+// onScrolledInternal();
|
|
|
+
|
|
|
+ Glide.with(imageView)
|
|
|
+ .load(url)
|
|
|
.listener(new RequestListener<Drawable>() {
|
|
|
@Override
|
|
|
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
|
- Drawable drawable = imageView.getDrawable();
|
|
|
+ Drawable drawable = resource;
|
|
|
//you should call after the bitmap drawn
|
|
|
imageWidth = drawable.getIntrinsicWidth(); //this is the bitmap's width
|
|
|
imageHeight = drawable.getIntrinsicHeight(); //this is the bitmap's height
|
|
|
@@ -219,10 +238,12 @@ public class MainContentsCategoryImageView extends MainCatogoryContentsView {
|
|
|
|
|
|
onScrolledInternal();
|
|
|
|
|
|
- return true;
|
|
|
+ return false;
|
|
|
}
|
|
|
})
|
|
|
.into(imageView);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private int getScreenY(View view) {
|
|
|
@@ -236,4 +257,37 @@ public class MainContentsCategoryImageView extends MainCatogoryContentsView {
|
|
|
public void dispose() {
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+//
|
|
|
+// @GlideModule
|
|
|
+// public class GlideImageLoader extends AppGlideModule {
|
|
|
+//
|
|
|
+// public void load(ImageView imageView, String url) {
|
|
|
+//
|
|
|
+// Glide.with(imageView)
|
|
|
+// .load(url)
|
|
|
+// .listener(new RequestListener<Drawable>() {
|
|
|
+// @Override
|
|
|
+// public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
|
|
|
+// Drawable drawable = resource;
|
|
|
+// //you should call after the bitmap drawn
|
|
|
+// imageWidth = drawable.getIntrinsicWidth(); //this is the bitmap's width
|
|
|
+// imageHeight = drawable.getIntrinsicHeight(); //this is the bitmap's height
|
|
|
+//
|
|
|
+//// Log.i("APP# MainContentsCategoryImageView | init", "| maskWidth: " + maskWidth + ", maskHeight: " + maskHeight);
|
|
|
+//// Log.i("APP# MainContentsCategoryImageView | init", "| imageWidth: " + imageWidth + ", imageHeight: " + imageHeight);
|
|
|
+//
|
|
|
+// onScrolledInternal();
|
|
|
+//
|
|
|
+// return true;
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .into(imageView);
|
|
|
+// }
|
|
|
+// }
|
|
|
}
|