Search in sources :

Example 11 with AnimationCompleteListener

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

the class Camera1Fragment method fadeOutControls.

@Override
public void fadeOutControls(@NonNull Runnable onEndAction) {
    controlsContainer.setEnabled(false);
    controlsContainer.animate().setInterpolator(MediaAnimations.getInterpolator()).setDuration(250).alpha(0f).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            controlsContainer.setEnabled(true);
            onEndAction.run();
        }
    });
}
Also used : Animator(android.animation.Animator) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 12 with AnimationCompleteListener

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

the class Camera1Fragment method fadeInControls.

@Override
public void fadeInControls() {
    controlsContainer.setEnabled(false);
    controlsContainer.animate().setInterpolator(MediaAnimations.getInterpolator()).setDuration(250).alpha(1f).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            controlsContainer.setEnabled(true);
        }
    });
}
Also used : Animator(android.animation.Animator) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 13 with AnimationCompleteListener

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

the class CameraXFragment method fadeInControls.

@Override
public void fadeInControls() {
    controlsContainer.setEnabled(false);
    controlsContainer.animate().setDuration(250).alpha(1f).setInterpolator(MediaAnimations.getInterpolator()).setListener(new AnimationCompleteListener() {

        @Override
        public void onAnimationEnd(Animator animation) {
            controlsContainer.setEnabled(true);
        }
    });
}
Also used : Animator(android.animation.Animator) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 14 with AnimationCompleteListener

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

the class ConfirmKbsPinFragment method updateSaveAnimation.

private void updateSaveAnimation(@NonNull ConfirmKbsPinViewModel.SaveAnimation animation) {
    updateAnimationAndInputVisibility(animation);
    LottieAnimationView lottieProgress = getLottieProgress();
    switch(animation) {
        case NONE:
            lottieProgress.cancelAnimation();
            break;
        case LOADING:
            lottieProgress.setAnimation(R.raw.lottie_kbs_loading);
            lottieProgress.setRepeatMode(LottieDrawable.RESTART);
            lottieProgress.setRepeatCount(LottieDrawable.INFINITE);
            lottieProgress.playAnimation();
            break;
        case SUCCESS:
            startEndAnimationOnNextProgressRepetition(R.raw.lottie_kbs_success, new AnimationCompleteListener() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    requireActivity().setResult(Activity.RESULT_OK);
                    closeNavGraphBranch();
                    RegistrationUtil.maybeMarkRegistrationComplete(requireContext());
                    StorageSyncHelper.scheduleSyncForDataChange();
                }
            });
            break;
        case FAILURE:
            startEndAnimationOnNextProgressRepetition(R.raw.lottie_kbs_fail, new AnimationCompleteListener() {

                @Override
                public void onAnimationEnd(Animator animation) {
                    RegistrationUtil.maybeMarkRegistrationComplete(requireContext());
                    displayFailedDialog();
                }
            });
            break;
    }
}
Also used : Animator(android.animation.Animator) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener)

Example 15 with AnimationCompleteListener

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

the class ConfirmKbsPinFragment method startEndAnimationOnNextProgressRepetition.

private void startEndAnimationOnNextProgressRepetition(@RawRes int lottieAnimationId, @NonNull AnimationCompleteListener listener) {
    LottieAnimationView lottieProgress = getLottieProgress();
    LottieAnimationView lottieEnd = getLottieEnd();
    lottieEnd.setAnimation(lottieAnimationId);
    lottieEnd.removeAllAnimatorListeners();
    lottieEnd.setRepeatCount(0);
    lottieEnd.addAnimatorListener(listener);
    if (lottieProgress.isAnimating()) {
        lottieProgress.addAnimatorListener(new AnimationRepeatListener(animator -> hideProgressAndStartEndAnimation(lottieProgress, lottieEnd)));
    } else {
        hideProgressAndStartEndAnimation(lottieProgress, lottieEnd);
    }
}
Also used : ViewCompat(androidx.core.view.ViewCompat) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) AlertDialog(androidx.appcompat.app.AlertDialog) NonNull(androidx.annotation.NonNull) ApplicationDependencies(org.thoughtcrime.securesms.dependencies.ApplicationDependencies) Megaphones(org.thoughtcrime.securesms.megaphone.Megaphones) SpanUtil(org.thoughtcrime.securesms.util.SpanUtil) Animator(android.animation.Animator) R(org.thoughtcrime.securesms.R) AnimationRepeatListener(org.thoughtcrime.securesms.animation.AnimationRepeatListener) Objects(java.util.Objects) RawRes(androidx.annotation.RawRes) LottieDrawable(com.airbnb.lottie.LottieDrawable) StorageSyncHelper(org.thoughtcrime.securesms.storage.StorageSyncHelper) RegistrationUtil(org.thoughtcrime.securesms.registration.RegistrationUtil) View(android.view.View) ViewModelProviders(androidx.lifecycle.ViewModelProviders) AnimationCompleteListener(org.thoughtcrime.securesms.animation.AnimationCompleteListener) Activity(android.app.Activity) ContextCompat(androidx.core.content.ContextCompat) HintConstants(androidx.autofill.HintConstants) AnimationRepeatListener(org.thoughtcrime.securesms.animation.AnimationRepeatListener) LottieAnimationView(com.airbnb.lottie.LottieAnimationView)

Aggregations

Animator (android.animation.Animator)28 AnimationCompleteListener (org.thoughtcrime.securesms.animation.AnimationCompleteListener)28 AnimatorSet (android.animation.AnimatorSet)4 ObjectAnimator (android.animation.ObjectAnimator)4 ValueAnimator (android.animation.ValueAnimator)4 View (android.view.View)4 OvershootInterpolator (android.view.animation.OvershootInterpolator)4 NonNull (androidx.annotation.NonNull)4 ConstraintSet (androidx.constraintlayout.widget.ConstraintSet)4 LottieAnimationView (com.airbnb.lottie.LottieAnimationView)4 TextPaint (android.text.TextPaint)3 SuppressLint (android.annotation.SuppressLint)2 Activity (android.app.Activity)2 Point (android.graphics.Point)2 TextView (android.widget.TextView)2 MainThread (androidx.annotation.MainThread)2 RawRes (androidx.annotation.RawRes)2 AlertDialog (androidx.appcompat.app.AlertDialog)2 HintConstants (androidx.autofill.HintConstants)2 ContextCompat (androidx.core.content.ContextCompat)2