androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat Java Examples
The following examples show how to use
androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat.
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: FloatingNavigationView.java From Floating-Navigation-View with Apache License 2.0 | 6 votes |
private void startOpenAnimations() { // Icon AnimatedVectorDrawableCompat menuIcon = AnimatedVectorDrawableCompat.create(getContext(), R.drawable.ic_menu_animated); mFabView.setImageDrawable(menuIcon); menuIcon.start(); // Reveal int centerX = mFabRect.centerX(); int centerY = mFabRect.centerY(); float startRadius = getMinRadius(); float endRadius = getMaxRadius(); Animator reveal = CircularRevealCompat.createCircularReveal( mNavigationView, centerX, centerY, startRadius, endRadius ); // Fade in mNavigationMenuView.setAlpha(0); Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 0, 1); // Animations AnimatorSet set = new AnimatorSet(); set.playSequentially(reveal, fade); set.start(); }
Example #2
Source File: SwirlView.java From swirl with Apache License 2.0 | 6 votes |
public void setState(State state, boolean animate) { if (state == this.state) return; @DrawableRes int resId = getDrawable(this.state, state, animate); if (resId == 0) { setImageDrawable(null); } else { Drawable icon = null; if (animate) { icon = AnimatedVectorDrawableCompat.create(getContext(), resId); } if (icon == null) { icon = VectorDrawableCompat.create(getResources(), resId, getContext().getTheme()); } setImageDrawable(icon); if (icon instanceof Animatable) { ((Animatable) icon).start(); } } this.state = state; }
Example #3
Source File: SkinCompatDrawableManager.java From Android-skin-support with MIT License | 5 votes |
@SuppressLint("NewApi") @Override public Drawable createFromXmlInner(@NonNull Context context, @NonNull XmlPullParser parser, @NonNull AttributeSet attrs, @Nullable Resources.Theme theme) { try { return AnimatedVectorDrawableCompat .createFromXmlInner(context, context.getResources(), parser, attrs, theme); } catch (Exception e) { Log.e("AvdcInflateDelegate", "Exception while inflating <animated-vector>", e); return null; } }
Example #4
Source File: FloatingNavigationView.java From Floating-Navigation-View with Apache License 2.0 | 5 votes |
private void startCloseAnimations() { // Icon AnimatedVectorDrawableCompat closeIcon = AnimatedVectorDrawableCompat.create(getContext(), R.drawable.ic_close_animated); mFabView.setImageDrawable(closeIcon); closeIcon.start(); // Unreveal int centerX = mFabRect.centerX(); int centerY = mFabRect.centerY(); float startRadius = getMaxRadius(); float endRadius = getMinRadius(); Animator reveal = CircularRevealCompat.createCircularReveal( mNavigationView, centerX, centerY, startRadius, endRadius ); reveal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { detachNavigationView(); } }); // Fade out Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView, View.ALPHA, 1, 0); // Animations AnimatorSet set = new AnimatorSet(); set.playTogether(fade, reveal); set.start(); }