Search in sources :

Example 6 with ResizeAnimation

use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by WhisperSystems.

the class WebRtcCallView method animatePipToSmallRectangle.

private void animatePipToSmallRectangle() {
    pictureInPictureGestureHelper.lockToBottomEnd();
    pictureInPictureGestureHelper.performAfterFling(() -> {
        ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, ViewUtil.dpToPx(54), ViewUtil.dpToPx(72));
        animation.setDuration(PIP_RESIZE_DURATION);
        animation.setAnimationListener(new SimpleAnimationListener() {

            @Override
            public void onAnimationEnd(Animation animation) {
                pictureInPictureGestureHelper.adjustPip();
            }
        });
        smallLocalRenderFrame.startAnimation(animation);
    });
}
Also used : ResizeAnimation(org.thoughtcrime.securesms.animation.ResizeAnimation) SimpleAnimationListener(org.thoughtcrime.securesms.mediasend.SimpleAnimationListener) Animation(android.view.animation.Animation) ResizeAnimation(org.thoughtcrime.securesms.animation.ResizeAnimation)

Example 7 with ResizeAnimation

use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by WhisperSystems.

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);
}
Also used : ResizeAnimation(org.thoughtcrime.securesms.animation.ResizeAnimation) Paint(android.graphics.Paint) Point(android.graphics.Point)

Example 8 with ResizeAnimation

use of org.thoughtcrime.securesms.animation.ResizeAnimation in project Signal-Android by signalapp.

the class WebRtcCallView method animatePipToSmallRectangle.

private void animatePipToSmallRectangle() {
    pictureInPictureGestureHelper.lockToBottomEnd();
    pictureInPictureGestureHelper.performAfterFling(() -> {
        ResizeAnimation animation = new ResizeAnimation(smallLocalRenderFrame, ViewUtil.dpToPx(54), ViewUtil.dpToPx(72));
        animation.setDuration(PIP_RESIZE_DURATION);
        animation.setAnimationListener(new SimpleAnimationListener() {

            @Override
            public void onAnimationEnd(Animation animation) {
                pictureInPictureGestureHelper.adjustPip();
            }
        });
        smallLocalRenderFrame.startAnimation(animation);
    });
}
Also used : ResizeAnimation(org.thoughtcrime.securesms.animation.ResizeAnimation) SimpleAnimationListener(org.thoughtcrime.securesms.mediasend.SimpleAnimationListener) Animation(android.view.animation.Animation) ResizeAnimation(org.thoughtcrime.securesms.animation.ResizeAnimation)

Aggregations

ResizeAnimation (org.thoughtcrime.securesms.animation.ResizeAnimation)8 Point (android.graphics.Point)6 Paint (android.graphics.Paint)4 Animation (android.view.animation.Animation)4 SimpleAnimationListener (org.thoughtcrime.securesms.mediasend.SimpleAnimationListener)4