List of usage examples for android.animation Animator setDuration
public abstract Animator setDuration(long duration);
From source file:com.taobao.weex.ui.animation.WXAnimationModule.java
public static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component, @NonNull WXAnimationBean animationBean, @Nullable String callback) { if (component == null) { return;//from w w w .ja v a 2 s .c o m } if (component.getHostView() == null) { AnimationHolder holder = new AnimationHolder(animationBean, callback); component.postAnimation(holder); return; } try { Animator animator = createAnimator(animationBean, component.getHostView(), mWXSDKInstance.getViewPortWidth()); if (animator != null) { Animator.AnimatorListener animatorCallback = createAnimatorListener(mWXSDKInstance, callback); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null); } Interpolator interpolator = createTimeInterpolator(animationBean); if (animatorCallback != null) { animator.addListener(animatorCallback); } if (interpolator != null) { animator.setInterpolator(interpolator); } animator.setDuration(animationBean.duration); animator.start(); } } catch (RuntimeException e) { e.printStackTrace(); WXLogUtils.e("", e); } }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void show() { Animator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 0, 1); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start();/*ww w.j a va 2 s . c om*/ }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void hide() { Animator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1, 0); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start();// w ww. j a v a2 s. c o m }
From source file:com.ruesga.rview.fragments.RevealDialogFragment.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private void performEnterRevealTransition() { if (!mDoReveal || getDialog() == null || getDialog().getWindow() == null) { mDoReveal = false;//from ww w . j a va2 s .co m return; } final View v = getDialog().getWindow().getDecorView(); if (!v.isAttachedToWindow()) { mDoReveal = false; return; } v.setVisibility(View.VISIBLE); Rect dialogRect = computeViewOnScreen(v); int cx = v.getMeasuredWidth() / 2; int cy = v.getMeasuredHeight() / 2; if (mAnchorRect != null) { cx = Math.min(Math.max(mAnchorRect.centerX(), dialogRect.left), dialogRect.right) - dialogRect.left; cy = Math.min(Math.max(mAnchorRect.centerY(), dialogRect.top), dialogRect.bottom) - dialogRect.top; } int finalRadius = Math.max(v.getWidth(), v.getHeight()); Animator anim = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius); anim.setDuration(350); anim.setInterpolator(new AccelerateInterpolator()); anim.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationEnd(Animator animation) { onDialogReveled(); mDoReveal = false; } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); anim.start(); }
From source file:org.cyanogenmod.designertools.ui.CreditsActivity.java
private void circularRevealActivity(View v) { int cx = v.getWidth() / 2; int cy = v.getHeight() / 2; float finalRadius = Math.max(v.getWidth(), v.getHeight()); // create the animator for this view (the start radius is zero) Animator circularReveal = ViewAnimationUtils.createCircularReveal(v, cx, cy, 0, finalRadius); circularReveal.setDuration(getResources().getInteger(R.integer.credits_circular_reveal_duration)); // make the view visible and start the animation v.setVisibility(View.VISIBLE); circularReveal.setInterpolator(new AccelerateDecelerateInterpolator()); circularReveal.addListener(new Animator.AnimatorListener() { @Override//w w w . j av a 2 s . co m public void onAnimationStart(Animator animator) { } @Override public void onAnimationEnd(Animator animator) { animateContent(); } @Override public void onAnimationCancel(Animator animator) { } @Override public void onAnimationRepeat(Animator animator) { } }); circularReveal.start(); }
From source file:nu.yona.app.customview.graph.TimeFrameGraph.java
public void startAnimation() { Animator anim = ObjectAnimator.ofFloat(this, "endPoint", 0, 1); anim.setDuration(animationDuration); anim.start();//from ww w . j a va2 s . com }
From source file:com.rks.musicx.ui.adapters.AlbumListAdapter.java
@Override public void onBindViewHolder(AlbumListAdapter.AlbumViewHolder holder, int position) { Album albums = getItem(position);//from www . j ava2 s .c o m if (layoutID == R.layout.item_grid_view || layoutID == R.layout.recent_list) { int pos = holder.getAdapterPosition(); if (lastpos < pos) { for (Animator animator : Helper.getAnimator(holder.backgroundColor)) { animator.setDuration(duration); animator.setInterpolator(interpolator); animator.start(); } } holder.AlbumArtwork.setTransitionName("TransitionArtwork" + position); holder.AlbumName.setText(albums.getAlbumName()); holder.ArtistName.setText(albums.getArtistName()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, albums.getAlbumName(), albums.getId(), new palette() { @Override public void palettework(Palette palette) { final int[] colors = Helper.getAvailableColor(getContext(), palette); holder.backgroundColor.setBackgroundColor(colors[0]); holder.AlbumName.setTextColor(Helper.getTitleTextColor(colors[0])); holder.ArtistName.setTextColor(Helper.getTitleTextColor(colors[0])); Helper.animateViews(getContext(), holder.backgroundColor, colors[0]); } }, holder.AlbumArtwork); holder.menu.setVisibility(View.GONE); } if (layoutID == R.layout.item_list_view) { holder.AlbumListName.setText(albums.getAlbumName()); holder.ArtistListName.setText(albums.getArtistName()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, albums.getAlbumName(), albums.getId(), new palette() { @Override public void palettework(Palette palette) { } }, holder.AlbumListArtwork); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { holder.AlbumListName.setTextColor(Color.WHITE); holder.ArtistListName .setTextColor(ContextCompat.getColor(getContext(), R.color.darkthemeTextColor)); } } }
From source file:com.rks.musicx.ui.adapters.ArtistListAdapter.java
@Override public void onBindViewHolder(ArtistViewHolder holder, int position) { Artist artists = getItem(position);// ww w .j av a 2 s . co m Helper helper = new Helper(getContext()); if (layoutID == R.layout.item_grid_view) { int pos = holder.getAdapterPosition(); if (lastpos < pos) { for (Animator animator : Helper.getAnimator(holder.backgroundColor)) { animator.setDuration(duration); animator.setInterpolator(interpolator); animator.start(); } } holder.ArtistsArtwork.setTransitionName("TransitionArtworks" + position); holder.ArtistName.setText(getContext().getResources().getQuantityString(R.plurals.albums_count, artists.getAlbumCount(), artists.getAlbumCount())); holder.AlbumCount.setText(artists.getName()); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, helper.loadArtistImage(artists.getName()), new palette() { @Override public void palettework(Palette palette) { final int[] colors = Helper.getAvailableColor(getContext(), palette); holder.backgroundColor.setBackgroundColor(colors[0]); holder.ArtistName.setTextColor(Helper.getTitleTextColor(colors[0])); holder.AlbumCount.setTextColor(Helper.getTitleTextColor(colors[0])); Helper.animateViews(getContext(), holder.backgroundColor, colors[0]); } }, holder.ArtistsArtwork); holder.menu.setVisibility(View.GONE); } if (layoutID == R.layout.item_list_view) { holder.ArtistListName.setText(artists.getName()); holder.ArtistListAlbumCount.setText(getContext().getResources() .getQuantityString(R.plurals.albums_count, artists.getAlbumCount(), artists.getAlbumCount())); ArtworkUtils.ArtworkLoader(getContext(), 300, 600, helper.loadArtistImage(artists.getName()), new palette() { @Override public void palettework(Palette palette) { } }, holder.ArtistListArtwork); if (Extras.getInstance().getDarkTheme() || Extras.getInstance().getBlackTheme()) { holder.ArtistListName.setTextColor(Color.WHITE); holder.ArtistListAlbumCount .setTextColor(ContextCompat.getColor(getContext(), R.color.darkthemeTextColor)); } } }
From source file:com.android.incallui.CircularRevealActivity.java
private Animator getRevealAnimator(Point touchPoint) { final View view = getWindow().getDecorView(); final Display display = getWindowManager().getDefaultDisplay(); final Point size = new Point(); display.getSize(size);/*from w w w . j a va2 s . c om*/ int startX = size.x / 2; int startY = size.y / 2; if (touchPoint != null) { startX = touchPoint.x; startY = touchPoint.y; } final Animator valueAnimator = ViewAnimationUtils.createCircularReveal(view, startX, startY, 0, Math.max(size.x, size.y)); valueAnimator.setDuration(REVEAL_DURATION); return valueAnimator; }
From source file:org.hawkular.client.android.util.ViewTransformer.java
@UiThread public void rotate() { Animator animator = ObjectAnimator.ofFloat(view, View.ROTATION, view.getRotation(), view.getRotation() + 180);/*w ww.j av a 2 s . co m*/ animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setDuration(Durations.MEDIUM); animator.start(); }