Java Code Examples for com.airbnb.lottie.LottieAnimationView#setAnimation()
The following examples show how to use
com.airbnb.lottie.LottieAnimationView#setAnimation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfirmKbsPinFragment.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
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); } }
Example 2
Source File: LottieViewCreator.java From LottieBottomNav with MIT License | 5 votes |
private static void setLottieView(LottieAnimationView view, MenuItem menuItem, boolean isSelected) { switch (menuItem.lottieSource) { case Raw: case Assets: view.setAnimation(isSelected ? menuItem.selectedLottieName : menuItem.unselectedLottieName); view.pauseAnimation(); view.setProgress(menuItem.lottieProgress); view.setRepeatCount(menuItem.loop ? Integer.MAX_VALUE : 0); } }
Example 3
Source File: Reaction.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
public Reaction(final ReactionType reactionType, int padding, Context context) { this.reactionType = reactionType; view = new LottieAnimationView(context); view.setAnimation(this.reactionType.name() .toLowerCase() + ".json"); view.loop(true); view.setPadding(padding, padding, padding, padding); }
Example 4
Source File: MessageRequestMegaphoneActivity.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public void onCreate(@Nullable Bundle savedInstanceState, boolean isReady) { dynamicTheme.onCreate(this); setContentView(R.layout.message_requests_megaphone_activity); LottieAnimationView lottie = findViewById(R.id.message_requests_lottie); TextView profileNameButton = findViewById(R.id.message_requests_confirm_profile_name); lottie.setAnimation(R.raw.lottie_message_requests_splash); lottie.playAnimation(); profileNameButton.setOnClickListener(v -> { final Intent profile = new Intent(this, EditProfileActivity.class); profile.putExtra(EditProfileActivity.SHOW_TOOLBAR, false); profile.putExtra(EditProfileActivity.NEXT_BUTTON_TEXT, R.string.save); startActivityForResult(profile, EDIT_PROFILE_REQUEST_CODE); }); }
Example 5
Source File: SplashActivity.java From Awesome-WanAndroid with Apache License 2.0 | 4 votes |
private void startAnimation(LottieAnimationView mLottieAnimationView, String animationName) { mLottieAnimationView.setAnimation(animationName); mLottieAnimationView.playAnimation(); }
Example 6
Source File: LottieAnimationViewPropertyManager.java From lottie-react-native with Apache License 2.0 | 4 votes |
/** * Updates the view with changed fields. * Majority of the properties here are independent so they are has to be reset to null * as soon as view is updated with the value. * * The only exception from this rule is the group of the properties for the animation. * For now this is animationName and cacheStrategy. These two properties are should be set * simultaneously if the dirty flag is set. */ public void commitChanges() { LottieAnimationView view = viewWeakReference.get(); if (view == null) { return; } if (animationJson != null) { view.setAnimationFromJson(animationJson, Integer.toString(animationJson.hashCode())); animationJson = null; } if (animationNameDirty) { view.setAnimation(animationName); animationNameDirty = false; } if (progress != null) { view.setProgress(progress); progress = null; } if (loop != null) { view.setRepeatCount(loop ? LottieDrawable.INFINITE : 0); loop = null; } if (speed != null) { view.setSpeed(speed); speed = null; } if (scaleType != null) { view.setScaleType(scaleType); scaleType = null; } if (renderMode != null) { view.setRenderMode(renderMode); renderMode = null; } if (imageAssetsFolder != null) { view.setImageAssetsFolder(imageAssetsFolder); imageAssetsFolder = null; } if (enableMergePaths != null) { view.enableMergePathsForKitKatAndAbove(enableMergePaths); enableMergePaths = null; } if (colorFilters != null && colorFilters.size() > 0) { for (int i = 0 ; i < colorFilters.size() ; i++) { ReadableMap current = colorFilters.getMap(i); String color = current.getString("color"); String path = current.getString("keypath"); SimpleColorFilter colorFilter = new SimpleColorFilter(Color.parseColor(color)); KeyPath keyPath = new KeyPath(path, "**"); LottieValueCallback<ColorFilter> callback = new LottieValueCallback<>(colorFilter); view.addValueCallback(keyPath, LottieProperty.COLOR_FILTER, callback); } } }