| 109 | } |
| 110 | } |
| 111 | |
| 112 | fun onFrameChanged(x: Int, y: Int, width: Int, height: Int, isRightToLeft: Boolean, animator: Any?) { |
| 113 | val view = get() ?: return |
| 114 | |
| 115 | val typedAnimator = animator as? ValdiAnimator |
| 116 | |
| 117 | val wasAnimating = ViewUtils.cancelAnimation(view, "frame") |
| 118 | ViewUtils.setIsRightToLeft(view, isRightToLeft) |
| 119 | |
| 120 | if (typedAnimator == null) { |
| 121 | measureAndLayout(view, x, y, width, height, false) |
| 122 | } else { |
| 123 | val fromX: Int |
| 124 | val fromY: Int |
| 125 | val fromWidth: Int |
| 126 | val fromHeight: Int |
| 127 | if (!typedAnimator.beginFromCurrentState || !wasAnimating) { |
| 128 | fromX = ViewUtils.getCalculatedX(view) |
| 129 | fromY = ViewUtils.getCalculatedY(view) |
| 130 | fromWidth = ViewUtils.getCalculatedWidth(view) |
| 131 | fromHeight = ViewUtils.getCalculatedHeight(view) |
| 132 | } else { |
| 133 | fromX = view.left |
| 134 | fromY = view.top |
| 135 | fromWidth = view.width |
| 136 | fromHeight = view.height |
| 137 | } |
| 138 | |
| 139 | val valueAnimation = ValdiValueAnimation(ValdiValueAnimation.MinimumVisibleChange.PIXEL) { progress -> |
| 140 | val fractionX = fromX + ((x - fromX) * progress).toInt() |
| 141 | val fractionY = fromY + ((y - fromY) * progress).toInt() |
| 142 | val fractionWidth = fromWidth + ((width - fromWidth) * progress).toInt() |
| 143 | val fractionHeight = fromHeight + ((height - fromHeight) * progress).toInt() |
| 144 | |
| 145 | measureAndLayout(view, fractionX, fractionY, fractionWidth, fractionHeight, true) |
| 146 | } |
| 147 | typedAnimator.addValueAnimation("frame", view, valueAnimation) |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | fun onScrollSpecsChanged(contentOffsetX: Int, |
no test coverage detected