|
|
@@ -35,6 +35,9 @@ public class ScalableImageView extends AppCompatImageView implements IScalable {
|
|
|
private int mHorizontalRawHeight;
|
|
|
private Bitmap mHorizontalBitmap;
|
|
|
|
|
|
+ private int parentWidth;
|
|
|
+ private int parentHeight;
|
|
|
+
|
|
|
public ScalableImageView(@NonNull Context context) {
|
|
|
this(context, null);
|
|
|
}
|
|
|
@@ -59,6 +62,10 @@ public class ScalableImageView extends AppCompatImageView implements IScalable {
|
|
|
mHorizontalRawWidth = horizontalOptions.outWidth;
|
|
|
mHorizontalRawHeight = horizontalOptions.outHeight;
|
|
|
|
|
|
+ FrameLayout frameLayout = (FrameLayout)getParent();
|
|
|
+ parentWidth = frameLayout.getWidth();
|
|
|
+ parentHeight = frameLayout.getHeight();
|
|
|
+
|
|
|
setImageBitmap(mVerticalBitmap);
|
|
|
AnimateManager.getInstance().register(this);
|
|
|
});
|
|
|
@@ -124,7 +131,8 @@ public class ScalableImageView extends AppCompatImageView implements IScalable {
|
|
|
animation = new TranslateAnimation(startX, endX, y, y);
|
|
|
animation.setRepeatMode(INFINITE);
|
|
|
animation.setRepeatCount(INFINITE);
|
|
|
- animation.setDuration(2000);
|
|
|
+ //long timeMillis = (endX-startX)*2000/parentWidth;
|
|
|
+ animation.setDuration(1500);
|
|
|
startAnimation(animation);
|
|
|
}
|
|
|
|
|
|
@@ -137,7 +145,8 @@ public class ScalableImageView extends AppCompatImageView implements IScalable {
|
|
|
animation = new TranslateAnimation(x, x, startY, endY);
|
|
|
animation.setRepeatMode(INFINITE);
|
|
|
animation.setRepeatCount(INFINITE);
|
|
|
- animation.setDuration(2000);
|
|
|
+ //long timeMillis = (endY-startY)*2000/parentHeight;
|
|
|
+ animation.setDuration(1500);
|
|
|
startAnimation(animation);
|
|
|
}
|
|
|
|