use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by WhisperSystems.
the class ImageEditorFragment method scaleViewPortForDrawing.
private void scaleViewPortForDrawing(int orientation, int protection) {
if (resizeAnimation != null) {
resizeAnimation.cancel();
}
float aspectRatio = getAspectRatioForOrientation(orientation);
int targetWidth = getWidthForOrientation(orientation) - ViewUtil.dpToPx(32);
int targetHeight = (int) ((1 / aspectRatio) * targetWidth);
int maxHeight = getHeightForOrientation(orientation) - protection;
if (targetHeight > maxHeight) {
targetHeight = maxHeight;
targetWidth = Math.round(targetHeight * aspectRatio);
}
resizeAnimation = new ResizeAnimation(imageEditorView, targetWidth, targetHeight);
resizeAnimation.setDuration(250);
resizeAnimation.setInterpolator(MediaAnimations.getInterpolator());
imageEditorView.startAnimation(resizeAnimation);
}
use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by signalapp.
the class WebRtcCallView method animatePipToLargeRectangle.
private void animatePipToLargeRectangle(boolean isLandscape) {
final Point dimens;
if (isLandscape) {
dimens = new Point(ViewUtil.dpToPx(160), ViewUtil.dpToPx(90));
} else {
dimens = new Point(ViewUtil.dpToPx(90), ViewUtil.dpToPx(160));
}
ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, dimens.x, dimens.y);
animation.setDuration(PIP_RESIZE_DURATION);
animation.setAnimationListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
pictureInPictureGestureHelper.enableCorners();
pictureInPictureGestureHelper.adjustPip();
}
});
smallLocalRenderFrame.startAnimation(animation);
}
use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by signalapp.
the class ImageEditorFragment method restoreViewPortScaling.
private void restoreViewPortScaling(int orientation) {
if (resizeAnimation != null) {
resizeAnimation.cancel();
}
int maxHeight = getHeightForOrientation(orientation);
float aspectRatio = getAspectRatioForOrientation(orientation);
int targetWidth = getWidthForOrientation(orientation);
int targetHeight = (int) ((1 / aspectRatio) * targetWidth);
if (targetHeight > maxHeight) {
targetHeight = maxHeight;
targetWidth = Math.round(targetHeight * aspectRatio);
}
resizeAnimation = new ResizeAnimation(imageEditorView, targetWidth, targetHeight);
resizeAnimation.setDuration(250);
resizeAnimation.setInterpolator(MediaAnimations.getInterpolator());
imageEditorView.startAnimation(resizeAnimation);
}
use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by signalapp.
the class ImageEditorFragment method scaleViewPortForDrawing.
private void scaleViewPortForDrawing(int orientation, int protection) {
if (resizeAnimation != null) {
resizeAnimation.cancel();
}
float aspectRatio = getAspectRatioForOrientation(orientation);
int targetWidth = getWidthForOrientation(orientation) - ViewUtil.dpToPx(32);
int targetHeight = (int) ((1 / aspectRatio) * targetWidth);
int maxHeight = getHeightForOrientation(orientation) - protection;
if (targetHeight > maxHeight) {
targetHeight = maxHeight;
targetWidth = Math.round(targetHeight * aspectRatio);
}
resizeAnimation = new ResizeAnimation(imageEditorView, targetWidth, targetHeight);
resizeAnimation.setDuration(250);
resizeAnimation.setInterpolator(MediaAnimations.getInterpolator());
imageEditorView.startAnimation(resizeAnimation);
}
use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by WhisperSystems.
the class WebRtcCallView method animatePipToLargeRectangle.
private void animatePipToLargeRectangle(boolean isLandscape) {
final Point dimens;
if (isLandscape) {
dimens = new Point(ViewUtil.dpToPx(160), ViewUtil.dpToPx(90));
} else {
dimens = new Point(ViewUtil.dpToPx(90), ViewUtil.dpToPx(160));
}
ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, dimens.x, dimens.y);
animation.setDuration(PIP_RESIZE_DURATION);
animation.setAnimationListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animation animation) {
pictureInPictureGestureHelper.enableCorners();
pictureInPictureGestureHelper.adjustPip();
}
});
smallLocalRenderFrame.startAnimation(animation);
}
Aggregations