Search in sources :

Example 6 with LottieAnimationView

use of com.airbnb.lottie.LottieAnimationView in project Offer by woshiyizhijiao.

the class RvLottieAdapter method convert.

@Override
protected void convert(BaseViewHolder helper, String item) {
    LottieAnimationView lottie_view = helper.getView(R.id.lottie_view);
    lottie_view.setAnimation(item);
    lottie_view.loop(true);
    lottie_view.playAnimation();
}
Also used : LottieAnimationView(com.airbnb.lottie.LottieAnimationView)

Example 7 with LottieAnimationView

use of com.airbnb.lottie.LottieAnimationView 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 8 with LottieAnimationView

use of com.airbnb.lottie.LottieAnimationView 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)

Example 9 with LottieAnimationView

use of com.airbnb.lottie.LottieAnimationView in project lottie-android by airbnb.

the class LottieFontViewGroup method addComposition.

private void addComposition(LottieComposition composition) {
    LottieAnimationView lottieAnimationView = new LottieAnimationView(getContext());
    lottieAnimationView.setLayoutParams(new LottieFontViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    lottieAnimationView.setComposition(composition);
    lottieAnimationView.playAnimation();
    if (cursorView == null) {
        addView(lottieAnimationView);
    } else {
        int index = indexOfChild(cursorView);
        addView(lottieAnimationView, index);
    }
}
Also used : LottieAnimationView(com.airbnb.lottie.LottieAnimationView)

Example 10 with LottieAnimationView

use of com.airbnb.lottie.LottieAnimationView in project lottie-android by airbnb.

the class LottieFontViewGroup method init.

private void init() {
    setFocusableInTouchMode(true);
    LottieComposition.Factory.fromAssetFileName(getContext(), "Mobilo/BlinkingCursor.json", new OnCompositionLoadedListener() {

        @Override
        public void onCompositionLoaded(LottieComposition composition) {
            cursorView = new LottieAnimationView(getContext());
            cursorView.setLayoutParams(new LottieFontViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
            cursorView.setComposition(composition);
            cursorView.loop(true);
            cursorView.playAnimation();
            addView(cursorView);
        }
    });
}
Also used : OnCompositionLoadedListener(com.airbnb.lottie.OnCompositionLoadedListener) LottieAnimationView(com.airbnb.lottie.LottieAnimationView) LottieComposition(com.airbnb.lottie.LottieComposition)

Aggregations

LottieAnimationView (com.airbnb.lottie.LottieAnimationView)15 View (android.view.View)7 TextView (android.widget.TextView)5 Animator (android.animation.Animator)4 AnimationCompleteListener (org.thoughtcrime.securesms.animation.AnimationCompleteListener)4 Intent (android.content.Intent)3 Activity (android.app.Activity)2 AlertDialog (android.app.AlertDialog)2 ImageView (android.widget.ImageView)2 NonNull (androidx.annotation.NonNull)2 RawRes (androidx.annotation.RawRes)2 AlertDialog (androidx.appcompat.app.AlertDialog)2 Toolbar (androidx.appcompat.widget.Toolbar)2 HintConstants (androidx.autofill.HintConstants)2 ContextCompat (androidx.core.content.ContextCompat)2 ViewCompat (androidx.core.view.ViewCompat)2 ViewModelProviders (androidx.lifecycle.ViewModelProviders)2 RecyclerView (androidx.recyclerview.widget.RecyclerView)2 LottieComposition (com.airbnb.lottie.LottieComposition)2 LottieDrawable (com.airbnb.lottie.LottieDrawable)2