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();
}
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;
}
}
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);
}
}
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);
}
}
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);
}
});
}
Aggregations