Java Code Examples for android.animation.Animator

The following are top voted examples for showing how to use android.animation.Animator. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Witch-Android   File: FlipOut.java   Source Code and License 7 votes vote down vote up
@Override
public void onBind(Target view, Value o, final OnBindListener onBindListener) {
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(view, View.ROTATION, 0f, 10f);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(view, View.ROTATION_X, 0f, 90f);
    AnimatorSet set = new AnimatorSet();
    set.setInterpolator(new AccelerateInterpolator(2f));
    set.setDuration(300);
    set.setStartDelay(80 * count);
    set.playTogether(animatorX, animatorY);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            onBindListener.onBindDone();
        }
    });
    set.start();
    count++;
}
 
Example 2
Project: MenuSet   File: TapBarMenu.java   Source Code and License 6 votes vote down vote up
private void showIcons(final boolean show) {
  for (int i = 0; i < getChildCount(); i++) {
    final View view = getChildAt(i);
    int translation = menuAnchor == MENU_ANCHOR_BOTTOM ? view.getHeight() : -view.getHeight();
    view.setTranslationY(show ? translation : 0f);
    view.setScaleX(show ? 0f : 1f);
    view.setScaleY(show ? 0f : 1f);
    view.setVisibility(VISIBLE);
    view.setAlpha(show ? 0f : 1f);
    view.animate()
        .scaleX(show ? 1f : 0f)
        .scaleY(show ? 1f : 0f)
        .translationY(0f)
        .alpha(show ? 1f : 0f)
        .setInterpolator(DECELERATE_INTERPOLATOR)
        .setDuration(show ? animationDuration / 2 : animationDuration / 3)
        .setStartDelay(show ? animationDuration / 3 : 0)
        .setListener(new AnimatorListenerAdapter() {
          @Override public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            view.setVisibility(show ? VISIBLE : GONE);
          }
        })
        .start();
  }
}
 
Example 3
Project: GitHub   File: SimpleAnimationAdapter.java   Source Code and License 6 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (position < getItemCount() && (customHeaderView != null ? position <= stringList.size() : position < stringList.size()) && (customHeaderView != null ? position > 0 : true)) {

        ((ViewHolder) holder).textViewSample.setText(stringList.get(customHeaderView != null ? position - 1 : position));
        // ((ViewHolder) holder).itemView.setActivated(selectedItems.get(position, false));
    }
    if (!isFirstOnly || position > mLastPosition) {
        for (Animator anim : getAdapterAnimations(holder.itemView, AdapterAnimationType.ScaleIn)) {
            anim.setDuration(mDuration).start();
            anim.setInterpolator(mInterpolator);
        }
        mLastPosition = position;
    } else {
        ViewHelper.clear(holder.itemView);
    }

}
 
Example 4
Project: MaterialMasterDetail   File: ContainersLayout.java   Source Code and License 6 votes vote down vote up
private void animateInFrameDetails() {
    frameDetails.setVisibility(View.VISIBLE);
    ViewUtils.onLaidOut(frameDetails, new Runnable() {
        @Override
        public void run() {
            ObjectAnimator alpha = ObjectAnimator.ofFloat(frameDetails, View.ALPHA, 0.4f, 1f);
            ObjectAnimator translate = ofFloat(frameDetails, View.TRANSLATION_Y, frameDetails.getHeight() * 0.3f, 0f);

            AnimatorSet set = new AnimatorSet();
            set.playTogether(alpha, translate);
            set.setDuration(ANIM_DURATION);
            set.setInterpolator(new LinearOutSlowInInterpolator());
            set.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    frameMaster.setVisibility(View.GONE);
                }
            });
            set.start();
        }
    });
}
 
Example 5
Project: Material-Motion   File: PlayerFragment.java   Source Code and License 6 votes vote down vote up
private void runIconScale(int delay, @DrawableRes int drawable, int color){
    soundPlay.animate()
            .scaleY(0)
            .scaleX(0)
            .setDuration(duration(R.integer.short_delay))
            .setStartDelay(delay)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    trackTitle.setTextColor(color);
                    soundPlay.setImageDrawable(ContextCompat.getDrawable(getContext(),drawable));
                    soundPlay.animate()
                            .scaleX(1)
                            .scaleY(1)
                            .setDuration(duration(R.integer.scale_duration))
                            .setListener(null).start();
                }
            }).start();
}
 
Example 6
Project: ExpectAnim   File: ExpectAnimCameraDistanceManager.java   Source Code and License 6 votes vote down vote up
@Override
public List<Animator> getAnimators() {
    final List<Animator> animations = new ArrayList<>();
    calculate();
    if (mCameraDistance != null) {
        final ValueAnimator animator = ValueAnimator.ofFloat(mCurrentCameraDistance, mCameraDistance);
        animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator valueAnimator) {
                viewToMove.setCameraDistance((float) valueAnimator.getAnimatedValue());
            }
        });
        animations.add(animator);
    }
    return animations;
}
 
Example 7
Project: javaide   File: ProgressIndicatorView.java   Source Code and License 6 votes vote down vote up
public List<Animator> createAnimation() {
    List<Animator> animators = new ArrayList<>();
    int[] delays = new int[]{120, 240, 360};
    for (int i = 0; i < 3; i++) {
        final int index = i;

        ValueAnimator scaleAnim = ValueAnimator.ofFloat(1, 0.3f, 1);

        scaleAnim.setDuration(750);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);

        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();

            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
Example 8
Project: chromium-for-android-56-debug-video   File: ToolbarPhone.java   Source Code and License 6 votes vote down vote up
private ObjectAnimator createEnterTabSwitcherModeAnimation() {
    ObjectAnimator enterAnimation =
            ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 1.f);
    enterAnimation.setDuration(TAB_SWITCHER_MODE_ENTER_ANIMATION_DURATION_MS);
    enterAnimation.setInterpolator(new LinearInterpolator());
    enterAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            // This is to deal with the view going invisible when resuming the activity and
            // running this animation.  The view is still there and clickable but does not
            // render and only a layout triggers a refresh.  See crbug.com/306890.
            if (!mToggleTabStackButton.isEnabled()) requestLayout();
        }
    });

    return enterAnimation;
}
 
Example 9
Project: PlusGram   File: PhotoPaintView.java   Source Code and License 6 votes vote down vote up
private void setDimVisibility(final boolean visible) {
    Animator animator;
    if (visible) {
        dimView.setVisibility(VISIBLE);
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 0.0f, 1.0f);
    } else {
        animator = ObjectAnimator.ofFloat(dimView, "alpha", 1.0f, 0.0f);
    }
    animator.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (!visible) {
                dimView.setVisibility(GONE);
            }
        }
    });
    animator.setDuration(200);
    animator.start();
}
 
Example 10
Project: Android-Code-Demos   File: CircularAnimUtil.java   Source Code and License 6 votes vote down vote up
/**
 * 向四周伸张,直到完成显示。
 */
@SuppressLint("NewApi")
public static void show(View myView, float startRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.VISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;

    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int finalRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, startRadius, finalRadius);
    myView.setVisibility(View.VISIBLE);
    anim.setDuration(durationMills);
    anim.start();
}
 
Example 11
Project: airgram   File: ChatActivityEnterView.java   Source Code and License 6 votes vote down vote up
private void hideRecordedAudioPanel() {
    audioToSendPath = null;
    audioToSend = null;
    audioToSendMessageObject = null;
    AnimatorSet AnimatorSet = new AnimatorSet();
    AnimatorSet.playTogether(
            ObjectAnimator.ofFloat(recordedAudioPanel, "alpha", 0.0f)
    );
    AnimatorSet.setDuration(200);
    AnimatorSet.addListener(new AnimatorListenerAdapterProxy() {
        @Override
        public void onAnimationEnd(Animator animation) {
            recordedAudioPanel.setVisibility(GONE);

        }
    });
    AnimatorSet.start();
}
 
Example 12
Project: app_secompufscar   File: MainActivity.java   Source Code and License 6 votes vote down vote up
private void fadeOut() {
    contentView.setAlpha(0f);
    contentView.setVisibility(View.VISIBLE);

    contentView.animate()
            .alpha(1f)
            .setDuration(getResources().getInteger(
                    android.R.integer.config_longAnimTime))
            .setListener(null);

    loadingView.animate()
            .alpha(0f)
            .setDuration(getResources().getInteger(
                    android.R.integer.config_longAnimTime))
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    loadingView.setVisibility(View.GONE);
                }
            });
}
 
Example 13
Project: Expert-Android-Programming   File: HomeActivity.java   Source Code and License 6 votes vote down vote up
private void exitReveal(final View icon, final View toolbar) {

        // get the center for the clipping circle
        int cx = getRelativeLeft(icon) + icon.getMeasuredWidth() / 2;
        int cy = getRelativeTop(icon);

        // get the initial radius for the clipping circle
        int initialRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());

        // create the animation (the final radius is zero)
        Animator anim =
                ViewAnimationUtils.createCircularReveal(toolbar, cx, cy, initialRadius, 0);

        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                toolbar.setVisibility(View.INVISIBLE);
            }
        });

        anim.setDuration(Constant.SEARCH_REVEAL_DURATION);
        // start the animation
        anim.start();
    }
 
Example 14
Project: InstaFlickr   File: FeedContextMenuManager.java   Source Code and License 6 votes vote down vote up
private void performShowAnimation() {
    contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
    contextMenuView.setPivotY(contextMenuView.getHeight());
    contextMenuView.setScaleX(0.1f);
    contextMenuView.setScaleY(0.1f);
    contextMenuView.animate()
            .scaleX(1f).scaleY(1f)
            .setDuration(150)
            .setInterpolator(new OvershootInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    isContextMenuShowing = false;
                }
            });
}
 
Example 15
Project: Android-Music-Player   File: imgSlider.java   Source Code and License 6 votes vote down vote up
void Play(int val){
    final ImageView iv = top;
    top = btm;
    btm = creatImg();
    btm.setImageBitmap(BM);
    addView(btm,0);
    Set = new AnimatorSet();
    Set.setInterpolator(Ui.cd.TH);
    Set.playTogether(ObjectAnimator.ofFloat(iv, "X",val));
    Set.setDuration(500).start();
    Set.addListener(new animLis(){
        @Override
        public void onAnimationEnd(Animator animation) {
            imgSlider.this.removeView(iv);
        }
    });
}
 
Example 16
Project: GitHub   File: BaseQuickAdapter.java   Source Code and License 6 votes vote down vote up
/**
 * add animation when you want to show time
 *
 * @param holder
 */
private void addAnimation(RecyclerView.ViewHolder holder) {
    if (mOpenAnimationEnable) {
        if (!mFirstOnlyEnable || holder.getLayoutPosition() > mLastPosition) {
            BaseAnimation animation = null;
            if (mCustomAnimation != null) {
                animation = mCustomAnimation;
            } else {
                animation = mSelectAnimation;
            }
            for (Animator anim : animation.getAnimators(holder.itemView)) {
                startAnim(anim, holder.getLayoutPosition());
            }
            mLastPosition = holder.getLayoutPosition();
        }
    }
}
 
Example 17
Project: buildAPKsSamples   File: PropertyAnimations.java   Source Code and License 6 votes vote down vote up
private void setupAnimation(View view, final Animator animation, final int animationID) {
    view.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            // If the button is checked, load the animation from the given resource
            // id instead of using the passed-in animation parameter. See the xml files
            // for the details on those animations.
            if (mCheckBox.isChecked()) {
                Animator anim = AnimatorInflater.loadAnimator(PropertyAnimations.this, animationID);
                anim.setTarget(v);
                anim.start();
                return;
            }
            animation.start();
        }
    });
}
 
Example 18
Project: SRecyclerView   File: LineScaleIndicator.java   Source Code and License 6 votes vote down vote up
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    long[] delays=new long[]{100,200,300,400,500};
    for (int i = 0; i < 5; i++) {
        final int index=i;
        ValueAnimator scaleAnim=ValueAnimator.ofFloat(1, 0.4f, 1);
        scaleAnim.setDuration(1000);
        scaleAnim.setRepeatCount(-1);
        scaleAnim.setStartDelay(delays[i]);
        scaleAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                scaleYFloats[index] = (float) animation.getAnimatedValue();
                postInvalidate();
            }
        });
        scaleAnim.start();
        animators.add(scaleAnim);
    }
    return animators;
}
 
Example 19
Project: SmartRefresh   File: FunGameHeader.java   Source Code and License 6 votes vote down vote up
private void doStart(long delay) {
    ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight);
    ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight);
    ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator);
    animatorSet.setDuration(800);
    animatorSet.setStartDelay(delay);
    animatorSet.start();

    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            topMaskView.setVisibility(View.GONE);
            bottomMaskView.setVisibility(View.GONE);
            maskReLayout.setVisibility(View.GONE);
            onGameStart();
        }
    });
}
 
Example 20
Project: LaunchEnr   File: LauncherStateTransitionAnimation.java   Source Code and License 6 votes vote down vote up
/**
 * Plays animations used by various transitions.
 */
private void playCommonTransitionAnimations(
        Workspace.State toWorkspaceState,
        boolean animated, boolean initialized, AnimatorSet animation,
        AnimationLayerSet layerViews) {
    // Create the workspace animation.
    // NOTE: this call apparently also sets the state for the workspace if !animated
    Animator workspaceAnim = mLauncher.startWorkspaceStateChangeAnimation(toWorkspaceState,
            animated, layerViews);

    if (animated && initialized) {
        // Play the workspace animation
        if (workspaceAnim != null) {
            animation.play(workspaceAnim);
        }
    }
}
 
Example 21
Project: PreviewSeekBar   File: PreviewAnimatorLollipopImpl.java   Source Code and License 5 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void startUnreveal() {
    Animator animator = ViewAnimationUtils.createCircularReveal(previewChildView,
            getCenterX(previewChildView),
            getCenterY(previewChildView),
            getRadius(previewChildView), morphView.getWidth() * 2);
    animator.setTarget(previewChildView);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            previewChildView.animate().setListener(null);
            frameView.setVisibility(View.INVISIBLE);
            previewChildView.setVisibility(View.INVISIBLE);
            morphView.setVisibility(View.VISIBLE);
            morphView.animate()
                    .y(getHideY())
                    .scaleY(0.5f)
                    .scaleX(0.5f)
                    .setDuration(UNMORPH_MOVE_DURATION)
                    .setInterpolator(new AccelerateInterpolator())
                    .setListener(hideListener);
        }
    });
    frameView.animate().alpha(1f).setDuration(UNMORPH_UNREVEAL_DURATION)
            .setInterpolator(new AccelerateInterpolator());
    animator.setDuration(UNMORPH_UNREVEAL_DURATION)
            .setInterpolator(new AccelerateInterpolator());
    animator.start();
}
 
Example 22
Project: Cable-Android   File: DeviceAddFragment.java   Source Code and License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup viewGroup, Bundle bundle) {
  this.container    = ViewUtil.inflate(inflater, viewGroup, R.layout.device_add_fragment);
  this.overlay      = ViewUtil.findById(this.container, R.id.overlay);
  this.scannerView  = ViewUtil.findById(this.container, R.id.scanner);
  this.devicesImage = ViewUtil.findById(this.container, R.id.devices);

  if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
    this.overlay.setOrientation(LinearLayout.HORIZONTAL);
  } else {
    this.overlay.setOrientation(LinearLayout.VERTICAL);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    this.container.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      @Override
      public void onLayoutChange(View v, int left, int top, int right, int bottom,
                                 int oldLeft, int oldTop, int oldRight, int oldBottom)
      {
        v.removeOnLayoutChangeListener(this);

        Animator reveal = ViewAnimationUtils.createCircularReveal(v, right, bottom, 0, (int) Math.hypot(right, bottom));
        reveal.setInterpolator(new DecelerateInterpolator(2f));
        reveal.setDuration(800);
        reveal.start();
      }
    });
  }

  return this.container;
}
 
Example 23
Project: airgram   File: MediaActivity.java   Source Code and License 5 votes vote down vote up
private boolean onItemLongClick(MessageObject item, View view, int a) {
    if (actionBar.isActionModeShowed()) {
        return false;
    }
    AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
    selectedFiles[item.getDialogId() == dialog_id ? 0 : 1].put(item.getId(), item);
    if (!item.canDeleteMessage(null)) {
        cantDeleteMessagesCount++;
    }
    actionBar.createActionMode().getItem(delete).setVisibility(cantDeleteMessagesCount == 0 ? View.VISIBLE : View.GONE);
    selectedMessagesCountTextView.setNumber(1, false);
    AnimatorSet animatorSet = new AnimatorSet();
    ArrayList<Animator> animators = new ArrayList<>();
    for (int i = 0; i < actionModeViews.size(); i++) {
        View view2 = actionModeViews.get(i);
        AndroidUtilities.clearDrawableAnimation(view2);
        animators.add(ObjectAnimator.ofFloat(view2, "scaleY", 0.1f, 1.0f));
    }
    animatorSet.playTogether(animators);
    animatorSet.setDuration(250);
    animatorSet.start();
    scrolling = false;
    if (view instanceof SharedDocumentCell) {
        ((SharedDocumentCell) view).setChecked(true, true);
    } else if (view instanceof SharedPhotoVideoCell) {
        ((SharedPhotoVideoCell) view).setChecked(a, true, true);
    } else if (view instanceof SharedLinkCell) {
        ((SharedLinkCell) view).setChecked(true, true);
    }
    actionBar.showActionMode();
    return true;
}
 
Example 24
Project: Depth   File: WindFragment.java   Source Code and License 5 votes vote down vote up
@Override
public void animateTOMenu() {
    TransitionHelper.animateToMenuState(root, new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            bearsScene.setPause(false);
        }
    });
    menuIcon.animateIconState(MaterialMenuDrawable.IconState.ARROW);
    hideShadow();
    bearsScene.setPause(true);
}
 
Example 25
Project: boohee_v5.6   File: AnimatedVectorDrawableCompat.java   Source Code and License 5 votes vote down vote up
public AnimatedVectorDrawableCompatState(Context context, AnimatedVectorDrawableCompatState copy, Callback owner, Resources res) {
    if (copy != null) {
        this.mChangingConfigurations = copy.mChangingConfigurations;
        if (copy.mVectorDrawable != null) {
            ConstantState cs = copy.mVectorDrawable.getConstantState();
            if (res != null) {
                this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable(res);
            } else {
                this.mVectorDrawable = (VectorDrawableCompat) cs.newDrawable();
            }
            this.mVectorDrawable = (VectorDrawableCompat) this.mVectorDrawable.mutate();
            this.mVectorDrawable.setCallback(owner);
            this.mVectorDrawable.setBounds(copy.mVectorDrawable.getBounds());
            this.mVectorDrawable.setAllowCaching(false);
        }
        if (copy.mAnimators != null) {
            int numAnimators = copy.mAnimators.size();
            this.mAnimators = new ArrayList(numAnimators);
            this.mTargetNameMap = new ArrayMap(numAnimators);
            for (int i = 0; i < numAnimators; i++) {
                Animator anim = (Animator) copy.mAnimators.get(i);
                Animator animClone = anim.clone();
                String targetName = (String) copy.mTargetNameMap.get(anim);
                animClone.setTarget(this.mVectorDrawable.getTargetByName(targetName));
                this.mAnimators.add(animClone);
                this.mTargetNameMap.put(animClone, targetName);
            }
        }
    }
}
 
Example 26
Project: Flubber   File: Fall.java   Source Code and License 5 votes vote down vote up
@Override
public Animator getAnimationFor(AnimationBody animationBody, View view) {
    final AnimatorSet animatorSet = new AnimatorSet();

    final ObjectAnimator translateAnimation = getTranslation(animationBody, view);
    final ObjectAnimator rotateAnimation = getRotation(view);

    animatorSet
            .play(translateAnimation)
            .with(rotateAnimation);

    return animatorSet;
}
 
Example 27
Project: OmegaRoundingImageView   File: RoundingImageTransition.java   Source Code and License 5 votes vote down vote up
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues, TransitionValues endValues) {
    if (endValues == null || startValues == null) {
        return null;
    }
    return RoundingImageTransitionHelper.createAnimator(endValues.view, startValues.values, endValues.values);
}
 
Example 28
Project: GracefulMovies   File: SideFragment.java   Source Code and License 5 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.cloneInContext(new ContextThemeWrapper(getContext(), getTheme()))
            .inflate(R.layout.fragment_side, container, false);
    final Bundle args = getArguments();
    if (args != null) {
        rootView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop,
                                       int oldRight, int oldBottom) {
                v.removeOnLayoutChangeListener(this);
                int cx = args.getInt("cx");
                int cy = args.getInt("cy");
                // get the hypotheses so the mRadius is from one corner to the other
                float radius = (float) Math.hypot(right, bottom);

                // Hardware-supported clipPath()
                // http://developer.android.com/guide/topics/graphics/hardware-accel.html
                if (Build.VERSION.SDK_INT >= 18) {
                    isAnimRunning = true;
                    Animator reveal = createCheckoutRevealAnimator((ClipRevealFrame) v, cx, cy, 28f, radius);
                    reveal.start();
                } else {
                    removeOldSideFragment();
                }
            }
        });
    }

    ButterKnife.bind(this, rootView);

    return rootView;
}
 
Example 29
Project: Alerter   File: SwipeDismissTouchListener.java   Source Code and License 5 votes vote down vote up
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void performDismiss() {
    // Animate the dismissed view to zero-height and then fire the dismiss callback.
    // This triggers layout on each animation frame; in the future we may want to do something
    // smarter and more performant.

    final ViewGroup.LayoutParams lp = mView.getLayoutParams();
    final int originalHeight = mView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(mAnimationTime);

    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mCallbacks.onDismiss(mView, mToken);
            // Reset view presentation
            mView.setAlpha(1f);
            mView.setTranslationX(0);
            lp.height = originalHeight;
            mView.setLayoutParams(lp);
        }
    });

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            mView.setLayoutParams(lp);
        }
    });

    animator.start();
}
 
Example 30
Project: ViewTooltip   File: ViewTooltip.java   Source Code and License 5 votes vote down vote up
protected void startExitAnimation(final Animator.AnimatorListener animatorListener) {
    tooltipAnimation.animateExit(this, new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            animatorListener.onAnimationEnd(animation);
            if (listenerHide != null) {
                listenerHide.onHide(TooltipView.this);
            }
        }
    });
}
 
Example 31
Project: TripleTap   File: SetGameCardView.java   Source Code and License 5 votes vote down vote up
/**
 * Change card color. This method wraps the Property Animation API mentioned here
 * https://stackoverflow.com/a/14467625/7009268
 */
public void animateFailedSet() {
    int colorFrom = ContextCompat.getColor(getContext(), R.color.card_background_normal);
    int colorTo = ContextCompat.getColor(getContext(), R.color.fbutton_color_carrot);
    final SetGameCardView card = this;

    int duration = getContext().getResources().getInteger(R.integer.card_fail_animation_duration_flash);

    ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
    colorAnimation.setDuration(duration); // milliseconds
    colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animator) {
            card.setCardBackgroundColor((int) animator.getAnimatedValue());
        }
    });
    colorAnimation.setRepeatMode(ValueAnimator.REVERSE);
    colorAnimation.setRepeatCount(2);
    colorAnimation.start();

    colorAnimation.addListener(new AnimatorListenerAdapter()
    {
        @Override
        public void onAnimationEnd(Animator animation)
        {
            // Once animation is over, animate back to selected or highlighted or normal
            card.setChecked(false, false);
            if (isHighlighted()) {
                animateColorChange(R.color.fbutton_color_alizarin, R.color.card_background_highlighted);
            } else {
                animateColorChange(R.color.fbutton_color_alizarin, R.color.card_background_normal);
            }
        }
    });
}
 
Example 32
Project: Android-Code-Demos   File: CircularAnimUtil.java   Source Code and License 5 votes vote down vote up
/**
 * 由满向中间收缩,直到隐藏。
 */
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
        myView.setVisibility(View.INVISIBLE);
        return;
    }

    int cx = (myView.getLeft() + myView.getRight()) / 2;
    int cy = (myView.getTop() + myView.getBottom()) / 2;
    int w = myView.getWidth();
    int h = myView.getHeight();

    // 勾股定理 & 进一法
    int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;

    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
    anim.setDuration(durationMills);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    anim.start();
}
 
Example 33
Project: GitHub   File: RevealVisibilityTransition.java   Source Code and License 5 votes vote down vote up
@Override
public Animator onAppear(ViewGroup sceneRoot, final View view, TransitionValues startValues,
                         TransitionValues endValues) {

    Animator reveal = ViewAnimationUtils.createCircularReveal(view, 140, 200,
        0, 1000);
    return new NoPauseAnimator(reveal);

}
 
Example 34
Project: GitHub   File: AnimProcessor.java   Source Code and License 5 votes vote down vote up
/**
 * 4.加载更多完成或者不满足进入加载更多模式的条件时,收起尾部(当前位置 ~ 0)
 */
public void animBottomBack() {
    isAnimBottomBack = true;
    animLayoutByTime(getVisibleFootHeight(), 0, animBottomUpListener, new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            isAnimBottomBack = false;
        }
    });
}
 
Example 35
Project: OSchina_resources_android   File: PubActivity.java   Source Code and License 5 votes vote down vote up
private void close() {
    mBtnPub.clearAnimation();
    mBtnPub.animate()
            .rotation(0f)
            .setDuration(180)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    finish();
                }
            })
            .start();
}
 
Example 36
Project: Material-Motion   File: DotsFragment.java   Source Code and License 5 votes vote down vote up
private Animator createRevealAnimator(FloatingActionButton dot, float offsetY){
    ViewCompat.setElevation(dot,0);
    dot.setVisibility(View.INVISIBLE);
    lastDot=dot;
    int cx=(int)(dot.getX()+dot.getHeight()/2);
    int cy=(int)(dot.getY()+dot.getHeight()/2+offsetY);
    int w = topPanel.getWidth();
    int h = topPanel.getHeight();
    final int endRadius = !isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    final int startRadius=isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    topPanel.setVisibility(View.VISIBLE);
    Animator animator= ViewAnimationUtils.createCircularReveal(topPanel,cx,cy,startRadius,endRadius);
    animator.setDuration(duration(R.integer.reveal_duration));
    return animator;
}
 
Example 37
Project: SmartRefresh   File: WaterDropView.java   Source Code and License 5 votes vote down vote up
/**
 * 创建回弹动画
 * 上圆半径减速恢复至最大半径
 * 下圆半径减速恢复至最大半径
 * 圆心距减速从最大值减到0(下圆Y从当前位置移动到上圆Y)。
 */
public Animator createAnimator() {
    ValueAnimator valueAnimator = ValueAnimator.ofFloat(1, 0.001f).setDuration(BACK_ANIM_DURATION);
    valueAnimator.setInterpolator(new DecelerateInterpolator());
    valueAnimator.addUpdateListener(valueAnimator1 -> {
        updateComleteState((float) valueAnimator1.getAnimatedValue());
        postInvalidate();
    });
    return valueAnimator;
}
 
Example 38
Project: UltimateRecyclerView   File: SlideInLeftAnimation.java   Source Code and License 5 votes vote down vote up
@Override
public Animator[] getAnimators(View view) {
    return new Animator[]{
            ObjectAnimator.ofFloat(view, "translationX",
                    -view.getRootView().getWidth(), 0)
    };
}
 
Example 39
Project: OpenHub   File: SettingsActivity.java   Source Code and License 5 votes vote down vote up
private void startAnimation(){
    int cx = rootLayout.getWidth() / 2;
    int cy = rootLayout.getHeight() / 2;
    float finalRadius = (float) Math.hypot(cx, cy);
    Animator anim = ViewAnimationUtils.createCircularReveal(rootLayout, cx, cy, 0f, finalRadius);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
        }
    });
    rootLayout.setVisibility(View.VISIBLE);
    anim.start();
}
 
Example 40
Project: wulkanowy   File: LoginTask.java   Source Code and License 5 votes vote down vote up
private void changeLoginFormVisibility(final boolean show, final int animTime) {
    loginFormView.get().setVisibility(show ? View.GONE : View.VISIBLE);
    loginFormView.get().animate().setDuration(animTime).alpha(
            show ? 0 : 1).setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            loginFormView.get().setVisibility(show ? View.GONE : View.VISIBLE);
        }
    });
}
 
Example 41
Project: ScrollShapeUI   File: CustomChangeBounds.java   Source Code and License 5 votes vote down vote up
@Override
    public Animator createAnimator(final ViewGroup sceneRoot,
                                   TransitionValues startValues,
                                   final TransitionValues endValues) {

        Animator changeBounds = super.createAnimator(sceneRoot, startValues, endValues);
        if (startValues == null || endValues == null || changeBounds == null)
            return null;

//        if (endValues.view instanceof ViewGroup) {
//            ViewGroup vg = (ViewGroup) endValues.view;
//            float offset = vg.getHeight() / 3;
//            for (int i = 0; i < vg.getChildCount(); i++) {
//                View v = vg.getChildAt(i);
//                v.setTranslationY(offset);
//                v.setAlpha(0f);
//                v.animate()
//                        .alpha(1f)
//                        .translationY(0f)
//                        .setDuration(150)
//                        .setStartDelay(150)
//                        .setInterpolator(AnimationUtils.loadInterpolator(vg.getContext(),
//                                android.R.interpolator.fast_out_slow_in));
//                offset *= 1.8f;
//            }
//        }

        changeBounds.setDuration(500);
        changeBounds.setInterpolator(AnimationUtils.loadInterpolator(sceneRoot.getContext(),
                android.R.interpolator.fast_out_slow_in));
        return changeBounds;
    }
 
Example 42
Project: RetroMusicPlayer   File: PlayPauseDrawable.java   Source Code and License 5 votes vote down vote up
@NonNull
private Animator getPausePlayAnimator() {
    isPlaySet = !isPlaySet;
    final Animator anim = ObjectAnimator.ofFloat(this, PROGRESS, isPlay ? 1f : 0f, isPlay ? 0f : 1f);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            isPlay = !isPlay;
        }
    });
    return anim;
}
 
Example 43
Project: WaveView-RN   File: WaveHelper.java   Source Code and License 5 votes vote down vote up
private void initAnimation() {
    List<Animator> animators = new ArrayList<>();

    // horizontal animation.
    // wave waves infinitely.
    ObjectAnimator waveShiftAnim = ObjectAnimator.ofFloat(
            mWaveView, "waveShiftRatio", 0f, 1f);
    waveShiftAnim.setRepeatCount(ValueAnimator.INFINITE);
    waveShiftAnim.setDuration(1000);
    waveShiftAnim.setInterpolator(new LinearInterpolator());
    animators.add(waveShiftAnim);

    // vertical animation.
    // water level increases from 0 to center of WaveView
    ObjectAnimator waterLevelAnim = ObjectAnimator.ofFloat(
            mWaveView, "waterLevelRatio", 0f, 0.5f);
    waterLevelAnim.setDuration(1000);
    waterLevelAnim.setInterpolator(new DecelerateInterpolator());
    animators.add(waterLevelAnim);

    // amplitude animation.
    // wave grows big then grows small, repeatedly
    ObjectAnimator amplitudeAnim = ObjectAnimator.ofFloat(
            mWaveView, "amplitudeRatio", 0.0001f, 0.05f);
    amplitudeAnim.setRepeatCount(ValueAnimator.INFINITE);
    amplitudeAnim.setRepeatMode(ValueAnimator.REVERSE);
    amplitudeAnim.setDuration(5000);
    amplitudeAnim.setInterpolator(new LinearInterpolator());
    animators.add(amplitudeAnim);

    mAnimatorSet = new AnimatorSet();
    mAnimatorSet.playTogether(animators);
}
 
Example 44
Project: AnimationShowcase   File: RecyclerViewAnimationActivity.java   Source Code and License 5 votes vote down vote up
public AnimatorInfo(Animator overallAnim,
                    ObjectAnimator fadeToBlackAnim, ObjectAnimator fadeFromBlackAnim,
                    ObjectAnimator oldTextRotator, ObjectAnimator newTextRotator) {
    this.overallAnim = overallAnim;
    this.fadeToBlackAnim = fadeToBlackAnim;
    this.fadeFromBlackAnim = fadeFromBlackAnim;
    this.oldTextRotator = oldTextRotator;
    this.newTextRotator = newTextRotator;
}
 
Example 45
Project: YCUtils   File: MaterialRippleLayout.java   Source Code and License 5 votes vote down vote up
private void startRipple(final Runnable animationEndRunnable) {
    if (eventCancelled) return;

    float endRadius = getEndRadius();

    cancelAnimations();

    rippleAnimator = new AnimatorSet();
    rippleAnimator.addListener(new AnimatorListenerAdapter() {
        @Override public void onAnimationEnd(Animator animation) {
            if (!ripplePersistent) {
                setRadius(0);
                setRippleAlpha(rippleAlpha);
            }
            if (animationEndRunnable != null && rippleDelayClick) {
                animationEndRunnable.run();
            }
            childView.setPressed(false);
        }
    });

    ObjectAnimator ripple = ObjectAnimator.ofFloat(this, radiusProperty, radius, endRadius);
    ripple.setDuration(rippleDuration);
    ripple.setInterpolator(new DecelerateInterpolator());
    ObjectAnimator fade = ObjectAnimator.ofInt(this, circleAlphaProperty, rippleAlpha, 0);
    fade.setDuration(rippleFadeDuration);
    fade.setInterpolator(new AccelerateInterpolator());
    fade.setStartDelay(rippleDuration - rippleFadeDuration - FADE_EXTRA_DELAY);

    if (ripplePersistent) {
        rippleAnimator.play(ripple);
    } else if (getRadius() > endRadius) {
        fade.setStartDelay(0);
        rippleAnimator.play(fade);
    } else {
        rippleAnimator.playTogether(ripple, fade);
    }
    rippleAnimator.start();
}
 
Example 46
Project: GitHub   File: MaterialLoadingRenderer.java   Source Code and License 5 votes vote down vote up
@Override
public void onAnimationRepeat(Animator animator) {
    super.onAnimationRepeat(animator);
    storeOriginals();
    goToNextColor();

    mStartDegrees = mEndDegrees;
    mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
}
 
Example 47
Project: FancyShowCaseView-master   File: FancyShowCaseView.java   Source Code and License 5 votes vote down vote up
/**
 * Circular reveal enter animation
 */
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
private void doCircularEnterAnimation() {
    getViewTreeObserver().addOnPreDrawListener(
            new ViewTreeObserver.OnPreDrawListener() {
                @Override
                public boolean onPreDraw() {
                    getViewTreeObserver().removeOnPreDrawListener(this);

                    final int revealRadius = (int) Math.hypot(
                            getWidth(), getHeight());
                    int startRadius = 0;
                    if (mView != null) {
                        startRadius = mView.getWidth() / 2;
                    } else if (mFocusCircleRadius > 0 || mFocusRectangleWidth > 0 || mFocusRectangleHeight > 0) {
                        mCenterX = mFocusPositionX;
                        mCenterY = mFocusPositionY;
                    }
                    Animator enterAnimator = ViewAnimationUtils.createCircularReveal(FancyShowCaseView.this,
                            mCenterX, mCenterY, startRadius, revealRadius);
                    enterAnimator.setDuration(mAnimationDuration);
                    enterAnimator.setInterpolator(AnimationUtils.loadInterpolator(mActivity,
                            android.R.interpolator.accelerate_cubic));
                    enterAnimator.start();
                    return false;
                }
            });

}
 
Example 48
Project: LaunchEnr   File: Launcher.java   Source Code and License 5 votes vote down vote up
/**
 * Updates the workspace and interaction state on state change, and return the animation to this
 * new state.
 */
public Animator startWorkspaceStateChangeAnimation(Workspace.State toState,
        boolean animated, AnimationLayerSet layerViews) {
    Workspace.State fromState = mWorkspace.getState();
    Animator anim = mWorkspace.setStateWithAnimation(toState, animated, layerViews);
    updateInteraction(fromState, toState);
    return anim;
}
 
Example 49
Project: SimpleUILauncher   File: Workspace.java   Source Code and License 5 votes vote down vote up
private void fadeAndRemoveEmptyScreen(int delay, int duration, final Runnable onComplete,
        final boolean stripEmptyScreens) {
    // XXX: Do we need to update LM workspace screens below?
    PropertyValuesHolder alpha = PropertyValuesHolder.ofFloat("alpha", 0f);
    PropertyValuesHolder bgAlpha = PropertyValuesHolder.ofFloat("backgroundAlpha", 0f);

    final CellLayout cl = mWorkspaceScreens.get(EXTRA_EMPTY_SCREEN_ID);

    mRemoveEmptyScreenRunnable = new Runnable() {
        @Override
        public void run() {
            if (hasExtraEmptyScreen()) {
                mWorkspaceScreens.remove(EXTRA_EMPTY_SCREEN_ID);
                mScreenOrder.remove(EXTRA_EMPTY_SCREEN_ID);
                removeView(cl);
                if (stripEmptyScreens) {
                    stripEmptyScreens();
                }
                // Update the page indicator to reflect the removed page.
                showPageIndicatorAtCurrentScroll();
            }
        }
    };

    ObjectAnimator oa = ObjectAnimator.ofPropertyValuesHolder(cl, alpha, bgAlpha);
    oa.setDuration(duration);
    oa.setStartDelay(delay);
    oa.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (mRemoveEmptyScreenRunnable != null) {
                mRemoveEmptyScreenRunnable.run();
            }
            if (onComplete != null) {
                onComplete.run();
            }
        }
    });
    oa.start();
}
 
Example 50
Project: FirebasePost   File: MainActivity.java   Source Code and License 5 votes vote down vote up
private void startIntroAnimation() {
    fabCreate.setTranslationY(2 * getResources().getDimensionPixelOffset(R.dimen.btn_fab_size));

    int actionbarSize = Utils.dpToPx(56);
    getToolbar().setTranslationY(-actionbarSize);
    getIvLogo().setTranslationY(-actionbarSize);
    getInboxMenuItem().getActionView().setTranslationY(-actionbarSize);

    getToolbar().animate()
            .translationY(0)
            .setDuration(ANIM_DURATION_TOOLBAR)
            .setStartDelay(300);
    getIvLogo().animate()
            .translationY(0)
            .setDuration(ANIM_DURATION_TOOLBAR)
            .setStartDelay(400);
    getInboxMenuItem().getActionView().animate()
            .translationY(0)
            .setDuration(ANIM_DURATION_TOOLBAR)
            .setStartDelay(500)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    startContentAnimation();
                }
            })
            .start();
}
 
Example 51
Project: FindX   File: CircleIndicator.java   Source Code and License 5 votes vote down vote up
private void addIndicator(@DrawableRes int backgroundDrawableId, Animator animator) {
    if (animator.isRunning()) animator.end();

    View Indicator = new View(getContext());
    Indicator.setBackgroundResource(backgroundDrawableId);
    addView(Indicator, mIndicatorWidth, mIndicatorHeight);
    LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
    lp.leftMargin = mIndicatorMargin;
    lp.rightMargin = mIndicatorMargin;
    Indicator.setLayoutParams(lp);

    animator.setTarget(Indicator);
    animator.start();
}
 
Example 52
Project: animator   File: FAnimatorSet.java   Source Code and License 5 votes vote down vote up
/**
 * 对target截图然后设置给ImageView,让ImageView镜像在android.R.id.content的FrameLayout里面执行动画
 */
public void startAsPop()
{
    final AnimatorSet animatorSet = getSet();
    final ArrayList<Animator> listChild = animatorSet.getChildAnimations();
    if (listChild == null || listChild.isEmpty())
    {
        return;
    }
    final HashMap<View, ImageView> mapTargetPoper = new HashMap<>();
    for (Animator animator : listChild)
    {
        View target = (View) ((ObjectAnimator) animator).getTarget();
        if (target == null)
        {
            continue;
        }
        if (!mapTargetPoper.containsKey(target))
        {
            final Context context = target.getContext();
            if (context instanceof Activity)
            {
                PopImageView imageView = new PopImageView(context);
                imageView.setDrawingCacheView(target);
                imageView.attachTarget(target);

                animator.setTarget(imageView);
                mapTargetPoper.put(target, imageView);
            }
        } else
        {
            animator.setTarget(mapTargetPoper.get(target));
        }
    }
    start();
}
 
Example 53
Project: DailyStudy   File: AnimationDemoActivity.java   Source Code and License 5 votes vote down vote up
/**
 * keyframe
 */
private void keyFrame() {
    Keyframe keyframe0 = Keyframe.ofFloat(0f, 0);
    Keyframe keyframe1 = Keyframe.ofFloat(0.1f, 20f);
    Keyframe keyframe2 = Keyframe.ofFloat(0.2f, -20f);
    Keyframe keyframe3 = Keyframe.ofFloat(0.3f, 20f);
    Keyframe keyframe4 = Keyframe.ofFloat(0.4f, -20f);
    Keyframe keyframe5 = Keyframe.ofFloat(0.5f, 20f);
    Keyframe keyframe6 = Keyframe.ofFloat(0.6f, -20f);
    Keyframe keyframe7 = Keyframe.ofFloat(0.7f, 20f);
    Keyframe keyframe8 = Keyframe.ofFloat(0.8f, -20f);
    Keyframe keyframe9 = Keyframe.ofFloat(0.9f, 20f);
    Keyframe keyframe10 = Keyframe.ofFloat(1f, 0);
    PropertyValuesHolder holder = PropertyValuesHolder.ofKeyframe("rotation",
            keyframe0, keyframe1, keyframe2, keyframe3, keyframe4, keyframe5,
            keyframe6, keyframe7, keyframe8, keyframe9, keyframe10);
    Animator animator = ObjectAnimator.ofPropertyValuesHolder(content, holder);
    animator.setDuration(2000);
    animator.start();
}
 
Example 54
Project: JewelryUI   File: SupportAnimatorLollipop.java   Source Code and License 5 votes vote down vote up
@Override
public void setInterpolator(Interpolator value) {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setInterpolator(value);
    }
}
 
Example 55
Project: GitHub   File: ListPopup.java   Source Code and License 5 votes vote down vote up
@Override
public Animator initShowAnimator() {
    AnimatorSet set = new AnimatorSet();
    set.playTogether(ObjectAnimator.ofFloat(mAnimaView, "rotationX", 90f, 0f).setDuration(400),
            ObjectAnimator.ofFloat(mAnimaView, "translationY", 250f, 0f).setDuration(400),
            ObjectAnimator.ofFloat(mAnimaView, "alpha", 0f, 1f).setDuration(400 * 3 / 2));
    return set;
}
 
Example 56
Project: LuaViewPlayground   File: AnimatorUtil.java   Source Code and License 5 votes vote down vote up
/**
 * resume animator
 *
 * @param animators
 * @return
 */
public static boolean resume(List<Animator> animators) {
    boolean isResumeCalled = false;
    if (animators != null) {
        for (Animator animator : animators) {
            if (resume(animator)) {
                isResumeCalled = true;
            }
        }
    }
    return isResumeCalled;
}
 
Example 57
Project: GitHub   File: TriangleSkewSpinIndicator.java   Source Code and License 5 votes vote down vote up
@Override
public List<Animator> createAnimation() {
    List<Animator> animators=new ArrayList<>();
    PropertyValuesHolder rotation5=PropertyValuesHolder.ofFloat("rotationX",0,180,180,0,0);
    PropertyValuesHolder rotation6=PropertyValuesHolder.ofFloat("rotationY",0,0,180,180,0);
    
    ObjectAnimator animator=ObjectAnimator.ofPropertyValuesHolder(getTarget(), rotation6,rotation5);
    animator.setInterpolator(new LinearInterpolator());
    animator.setRepeatCount(-1);
    animator.setDuration(2500);
    animator.start();

    animators.add(animator);
    return animators;
}
 
Example 58
Project: boohee_v5.6   File: AnimatedVectorDrawableCompat.java   Source Code and License 5 votes vote down vote up
public boolean isRunning() {
    if (this.mDelegateDrawable != null) {
        return ((AnimatedVectorDrawable) this.mDelegateDrawable).isRunning();
    }
    ArrayList<Animator> animators = this.mAnimatedVectorState.mAnimators;
    int size = animators.size();
    for (int i = 0; i < size; i++) {
        if (((Animator) animators.get(i)).isRunning()) {
            return true;
        }
    }
    return false;
}
 
Example 59
Project: android-SpringAnimator   File: ComboSliderView.java   Source Code and License 5 votes vote down vote up
@SuppressWarnings("deprecation")
private void hideInputView() {
    if (!mIsInputViewVisible) {
        return;
    }

    mIsInputViewVisible = false;

    mEditButton.setImageResource(R.drawable.ic_mode_edit_black_16dp);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        mEditButton.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.colorSecondaryGray)));
    }

    mSliderLayout.setVisibility(VISIBLE);
    mSliderLayout
            .animate()
            .alpha(1)
            .setListener(null)
            .setDuration(200)
            .start();

    mInputViewLayout
            .animate()
            .alpha(0)
            .setListener(new SimpleAnimatorListener() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mInputViewLayout.setVisibility(INVISIBLE);
                }
            })
            .setDuration(200)
            .start();

    mImm.hideSoftInputFromWindow(getWindowToken(), 0, null);
    notifyFocusChange(false);
}
 
Example 60
Project: FancyAccordionView   File: CollapsedViewHolder.java   Source Code and License 5 votes vote down vote up
@Override
public Animator onAnimateChange(final ViewHolder oldHolder, ViewHolder newHolder,
                                long duration) {
    if (!(oldHolder instanceof ArrowItemViewHolder)
            || !(newHolder instanceof ArrowItemViewHolder)) {
        return null;
    }

    final boolean isCollapsing = this == newHolder;
    setChangingViewsAlpha(isCollapsing ? 0f : 1f);

    final Animator changeAnimatorSet = isCollapsing
            ? createCollapsingAnimator((ArrowItemViewHolder) oldHolder, duration)
            : createExpandingAnimator((ArrowItemViewHolder) newHolder, duration);
    changeAnimatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animator) {
            if (arrow != null) {
                arrow.setVisibility(View.VISIBLE);
                arrow.setTranslationY(0f);
                arrow.jumpDrawablesToCurrentState();
            }
            setChangingViewsAlpha(1f);
        }
    });
    return changeAnimatorSet;
}