Java Code Examples for android.view.animation.AccelerateInterpolator

The following are top voted examples for showing how to use android.view.animation.AccelerateInterpolator. 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: GitHub   File: SmoothProgressDrawable.java   Source Code and License 6 votes vote down vote up
private void initValues(Context context, boolean editMode) {
  Resources res = context.getResources();
  mInterpolator = new AccelerateInterpolator();
  if (!editMode) {
    mSectionsCount = res.getInteger(R.integer.spb_default_sections_count);
    mSpeed = Float.parseFloat(res.getString(R.string.spb_default_speed));
    mReversed = res.getBoolean(R.bool.spb_default_reversed);
    mProgressiveStartActivated = res.getBoolean(R.bool.spb_default_progressiveStart_activated);
    mColors = new int[]{res.getColor(R.color.spb_default_color)};
    mStrokeSeparatorLength = res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length);
    mStrokeWidth = res.getDimensionPixelOffset(R.dimen.spb_default_stroke_width);
  } else {
    mSectionsCount = 4;
    mSpeed = 1f;
    mReversed = false;
    mProgressiveStartActivated = false;
    mColors = new int[]{0xff33b5e5};
    mStrokeSeparatorLength = 4;
    mStrokeWidth = 4;
  }
  mProgressiveStartSpeed = mSpeed;
  mProgressiveStopSpeed = mSpeed;
  mGradients = false;
}
 
Example 2
Project: DailyStudy   File: ScanImageviewActivity.java   Source Code and License 6 votes vote down vote up
private void hideSystemUI() {
    runOnUiThread(new Runnable() {
        public void run() {
            toolbar.animate().translationY(-toolbar.getHeight()).setInterpolator(new AccelerateInterpolator())
                    .setDuration(200).start();
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION // hide nav bar
                            | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
                            | View.SYSTEM_UI_FLAG_IMMERSIVE);

            fullScreenMode = true;
            changeBackGroundColor();
        }
    });
}
 
Example 3
Project: GitHub   File: FlyRefreshStyleActivity.java   Source Code and License 6 votes vote down vote up
private void bounceAnimateView(final View view) {
    if (view == null) {
        return;
    }

    ValueAnimator swing = ValueAnimator.ofFloat(0, 60, -40, 0);
    swing.setDuration(400);
    swing.setInterpolator(new AccelerateInterpolator());
    swing.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            view.setRotationX((float)animation.getAnimatedValue());
        }
    });
    swing.start();
}
 
Example 4
Project: FlickLauncher   File: ToggleOnTapCallback.java   Source Code and License 6 votes vote down vote up
@Override
public void onTouchDown() {
    if (mAnim != null) {
        mAnim.cancel();
    }
    if (mViewtoToggle.getAlpha() == 1f) {
        mIgnoreNextTap = true;
    }

    mAnim = mViewtoToggle.animate();
    mAnim.alpha(0f)
            .setDuration(150)
            .withEndAction(new Runnable() {
                public void run() {
                    mViewtoToggle.setVisibility(View.INVISIBLE);
                }
            });

    mAnim.setInterpolator(new AccelerateInterpolator(0.75f));
    mAnim.start();
}
 
Example 5
Project: Cluttr   File: ViewActivity.java   Source Code and License 6 votes vote down vote up
public void toggleToolbar(boolean show) {
    if (show==showToolbar || toolbarGroup==null) {
        return;
    }

    showToolbar=show;
    if (showToolbar) {
        startTimeOut();
        showSystemUI();
        toolbarGroup.animate().translationY(0).setInterpolator(new DecelerateInterpolator()).start();
    } else {
        if (timeoutSubscription!=null) {
            timeoutSubscription.unsubscribe();
        }
        toolbarGroup.animate().translationY(-toolbarGroup.getBottom()).setInterpolator(new AccelerateInterpolator()).start();
        hideSystemUI();
    }
}
 
Example 6
Project: mapbox-navigation-android   File: InstructionView.java   Source Code and License 6 votes vote down vote up
/**
 * Hide the instruction list and show the sound button.
 * <p>
 * This is based on orientation so the different layouts (for portrait vs. landscape)
 * can be animated appropriately.
 */
public void hideInstructionList() {
  int orientation = getContext().getResources().getConfiguration().orientation;
  if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
    ConstraintSet collapsed = new ConstraintSet();
    collapsed.clone(getContext(), R.layout.instruction_layout);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      TransitionManager.beginDelayedTransition(InstructionView.this);
    }
    collapsed.applyTo(instructionLayout);
    instructionListLayout.setVisibility(INVISIBLE);
  } else {
    Animation slideUp = AnimationUtils.loadAnimation(getContext(), R.anim.slide_up_top);
    slideUp.setInterpolator(new AccelerateInterpolator());
    instructionListLayout.startAnimation(slideUp);
    instructionListLayout.setVisibility(INVISIBLE);
  }
}
 
Example 7
Project: SliderImageLayout   File: SliderImageLayout.java   Source Code and License 6 votes vote down vote up
private void initView()
{
    mListImgView = new ArrayList<>();
    titleTexts = new ArrayList<>();

    mInflater = LayoutInflater.from(mContext);
    View view = mInflater.inflate(R.layout.view_slider_layout , this);
    mDotLayout = (LinearLayout) view.findViewById(R.id.ll_dot_group);
    mTitleTV = (TextView) view.findViewById(R.id.tv_img_desc);
    mViewPager = (ViewPager) view.findViewById(R.id.viewPager);
    mViewPager.setPageTransformer(true , new DepthPageTransformer());
    mViewPager.setOnPageChangeListener(this);

    try
    {
        Field mField = ViewPager.class.getDeclaredField("mScroller");
        mField.setAccessible(true);
        mScroller = new FixedSpeedScroller(mContext ,new AccelerateInterpolator());
        mField.set(mViewPager , mScroller);
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
Example 8
Project: HoldingButton   File: HoldingDrawable.java   Source Code and License 6 votes vote down vote up
private ValueAnimator createCollapseValueAnimator() {
    ValueAnimator animator = ValueAnimator.ofFloat(1f, 0f);
    animator.setDuration(DEFAULT_ANIMATION_DURATION_COLLAPSE);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mExpandedScaleFactor[0] = (float) valueAnimator.getAnimatedValue();
            invalidateSelf();
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            notifyCollapsed();
        }
    });
    return animator;
}
 
Example 9
Project: AssistantBySDK   File: NaviSetLineActivity.java   Source Code and License 6 votes vote down vote up
@Override
public void switchShowRouteLineDetail() {
    if (showState == ShowState.showing || showState == ShowState.unshowing)
        return;
    height = mAnslMapBox.getHeight();

    if (showState == ShowState.unshow) {
        if (showState == ShowState.showed)
            return;
        mAnslOutBottomBox.setVisibility(View.GONE);
        mAnslVoiceBt.setVisibility(View.GONE);
        findViewById(R.id.ansl_route_detail_list_box).setVisibility(View.VISIBLE);
        startHeight = mAnslRouteLineBox.getHeight();
        mAnslRouteLineBox.getLayoutParams().height = startHeight;
        RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) mAnslRouteDetailBottomBox.getLayoutParams();
        layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
        layoutParams.height = RelativeLayout.LayoutParams.MATCH_PARENT;
    }

    mAnimateToTargetPosition.reset();
    mAnimateToTargetPosition.setInterpolator(new AccelerateInterpolator());
    mAnimateToTargetPosition.setDuration(300);
    mAnimateToTargetPosition.setAnimationListener(animationListener);
    mAnslRouteDetailBottomBox.startAnimation(mAnimateToTargetPosition);
}
 
Example 10
Project: TimeTicker   File: FlipClockView.java   Source Code and License 6 votes vote down vote up
public void init(Context context) {
	mScroller = new Scroller(context, new AccelerateInterpolator());// 加速 // 动画插入器

	mInvisibleTextView = new MyTextView(context);
	mInvisibleTextView.setText("0");
	mInvisibleTextView.setGravity(Gravity.CENTER);
	mInvisibleTextView.setIncludeFontPadding(false);
	addView(mInvisibleTextView);

	mVisibleTextView = new MyTextView(context);
	mVisibleTextView.setText("0");
	mVisibleTextView.setGravity(Gravity.CENTER);
	mVisibleTextView.setIncludeFontPadding(false);
	addView(mVisibleTextView);

	mShadePaint.setColor(Color.BLACK);
	mShadePaint.setStyle(Paint.Style.FILL);
	mShinePaint.setColor(Color.WHITE);
	mShinePaint.setStyle(Paint.Style.FILL);
}
 
Example 11
Project: file.io-app   File: MaterialIn.java   Source Code and License 6 votes vote down vote up
public static void startAnimators(final View view, int startOffsetX, int startOffsetY, long delay) {
    if (view.getVisibility() == View.VISIBLE && view.getAlpha() != 0f) {
        view.clearAnimation();
        view.animate().cancel();
        final Resources res = view.getResources();
        final float endAlpha = view.getAlpha();
        final float endTranslateX = view.getTranslationX();
        final float endTranslateY = view.getTranslationY();
        view.setAlpha(0);
        final Animator fade = ObjectAnimator.ofFloat(view, View.ALPHA, endAlpha);
        fade.setDuration(res.getInteger(R.integer.material_in_fade_anim_duration));
        fade.setInterpolator(new AccelerateInterpolator());
        fade.setStartDelay(delay);
        fade.start();
        ViewPropertyAnimator slide = view.animate();
        if (startOffsetY != 0) {
            view.setTranslationY(startOffsetY);
            slide.translationY(endTranslateY);
        } else {
            view.setTranslationX(startOffsetX);
            slide.translationX(endTranslateX);
        }
        slide.setInterpolator(new DecelerateInterpolator(2));
        slide.setDuration(res.getInteger(R.integer.material_in_slide_anim_duration));
        slide.setStartDelay(delay);
        slide.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationCancel(Animator animation) {
                if (fade.isStarted()) {
                    fade.cancel();
                }
                view.setAlpha(endAlpha);
                view.setTranslationX(endTranslateX);
                view.setTranslationY(endTranslateY);
            }
        });
        slide.start();
    }
}
 
Example 12
Project: FirebasePost   File: CommentsActivity.java   Source Code and License 6 votes vote down vote up
private void startIntroAnimation() {
    ViewCompat.setElevation(getToolbar(), 0);
    contentRoot.setScaleY(0.1f);
    contentRoot.setPivotY(drawingStartLocation);
    llAddComment.setTranslationY(200);

    contentRoot.animate()
            .scaleY(1)
            .setDuration(200)
            .setInterpolator(new AccelerateInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    ViewCompat.setElevation(getToolbar(), Utils.dpToPx(8));
                    animateContent();
                }
            })
            .start();
}
 
Example 13
Project: InstaFlickr   File: FeedContextMenuManager.java   Source Code and License 6 votes vote down vote up
private void performDismissAnimation() {
    contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
    contextMenuView.setPivotY(contextMenuView.getHeight());
    contextMenuView.animate()
            .scaleX(0.1f).scaleY(0.1f)
            .setDuration(150)
            .setInterpolator(new AccelerateInterpolator())
            .setStartDelay(100)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (contextMenuView != null) {
                        contextMenuView.dismiss();
                    }
                    isContextMenuDismissing = false;
                }
            });
}
 
Example 14
Project: InstaFlickr   File: CommentsActivity.java   Source Code and License 6 votes vote down vote up
private void startIntroAnimation() {
    contentRoot.setScaleY(0.1f);
    contentRoot.setPivotY(drawingStartLocation);//设置reyclerview的父view展开动画的起始位置(中心线)为上一activity的点击位置
    llAddComment.setTranslationY(200);//设置地下发送评论的控件的Y坐标初始位置(隐藏在屏幕底下100dp为起始位置)

    contentRoot.animate()
            .scaleY(1)
            .setDuration(200)
            .setInterpolator(new AccelerateInterpolator())
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    animateContent();
                }
            })
            .start();
}
 
Example 15
Project: AndroidSkinAnimator   File: TranslationHideAnimator2.java   Source Code and License 6 votes vote down vote up
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationY", 0, view.getHeight()));
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
 
Example 16
Project: AndroidSkinAnimator   File: TranslationAnimator2.java   Source Code and License 6 votes vote down vote up
@Override
public SkinAnimator apply(@NonNull View view, @Nullable final Action action) {
    this.targetView = view;
    preAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft(), view.getRight()))
            .setDuration(PRE_DURATION * 3);
    preAnimator.setInterpolator(new AccelerateInterpolator());
    afterAnimator = ObjectAnimator.ofPropertyValuesHolder(targetView,
            PropertyValuesHolder.ofFloat("translationX",
                    view.getLeft() - view.getWidth(), view.getLeft()))
            .setDuration(AFTER_DURATION * 3);
    afterAnimator.setInterpolator(new BounceInterpolator());

    preAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            if (action != null) {
                action.action();
            }
            afterAnimator.start();
        }
    });
    return this;
}
 
Example 17
Project: Rx2Animations   File: RxAnimations.java   Source Code and License 6 votes vote down vote up
public static Completable leave(final View view, final int xOffset, final int yOffset) {
    final float startingX = view.getX();
    final float startingY = view.getY();
    return animate(view, new AccelerateInterpolator())
            .fadeOut()
            .translateBy(xOffset, yOffset)
            .onAnimationCancel(aView -> set(aView, startingX, startingY, TRANSPARENT))
            .schedule(false);
}
 
Example 18
Project: text_converter   File: FloatingView.java   Source Code and License 6 votes vote down vote up
private void hideDeleteBox(boolean shrink) {
    if (mDeleteBoxVisible) {
        mDeleteBoxVisible = false;
        if (mDeleteView != null) {
            mDeleteBoxView.animate()
                    .alpha(0)
                    .setDuration(DELETE_ANIM_DURATION);
            mDeleteIconHolder.animate()
                    .scaleX(shrink ? 0.3f : 1)
                    .scaleY(shrink ? 0.3f : 1)
                    .translationYBy(CLOSE_ANIMATION_DISTANCE)
                    .setDuration(DELETE_ANIM_DURATION)
                    .setInterpolator(new AccelerateInterpolator())
                    .setListener(new AnimationFinishedListener() {
                        @Override
                        public void onAnimationFinished() {
                            if (mDeleteView != null) {
                                mDeleteView.setVisibility(View.GONE);
                            }
                        }
                    });
        }
    }
}
 
Example 19
Project: LittleFlickr   File: DetailActivity.java   Source Code and License 6 votes vote down vote up
void startHideAnimation() {
    float toolBarYStart = mDetailToolBar.getTop();
    float toolBarYEnd = mDetailToolBar.getTop() - mDetailToolBar.getBottom();

    float floatingButtonYStart = mFloatingActionButton.getTop();
    float floatingButtonYEnd = mViewPager.getBottom();

    ObjectAnimator toolBarAnimator = ObjectAnimator
            .ofFloat(mDetailToolBar, "y", toolBarYStart, toolBarYEnd)
            .setDuration(500);
    toolBarAnimator.setInterpolator(new AccelerateInterpolator());

    ObjectAnimator floatingButtonAnimator = ObjectAnimator
            .ofFloat(mFloatingActionButton, "y", floatingButtonYStart, floatingButtonYEnd)
            .setDuration(500);
    floatingButtonAnimator.setInterpolator(new AccelerateInterpolator());

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet
            .play(toolBarAnimator)
            .before(floatingButtonAnimator);
    animatorSet.start();
}
 
Example 20
Project: RetroMusicPlayer   File: PlayerPlaybackControlsFragment.java   Source Code and License 6 votes vote down vote up
public void showBouceAnimation() {
    playPauseFab.clearAnimation();

    playPauseFab.setScaleX(0.9f);
    playPauseFab.setScaleY(0.9f);
    playPauseFab.setVisibility(View.VISIBLE);
    playPauseFab.setPivotX(playPauseFab.getWidth() / 2);
    playPauseFab.setPivotY(playPauseFab.getHeight() / 2);

    playPauseFab.animate()
            .setDuration(200)
            .setInterpolator(new DecelerateInterpolator())
            .scaleX(1.1f)
            .scaleY(1.1f)
            .withEndAction(() -> playPauseFab.animate()
                    .setDuration(200)
                    .setInterpolator(new AccelerateInterpolator())
                    .scaleX(1f)
                    .scaleY(1f)
                    .alpha(1f)
                    .start())
            .start();
}
 
Example 21
Project: SmartRefreshLayout   File: FlyRefreshStyleActivity.java   Source Code and License 6 votes vote down vote up
private void bounceAnimateView(final View view) {
    if (view == null) {
        return;
    }

    ValueAnimator swing = ValueAnimator.ofFloat(0, 60, -40, 0);
    swing.setDuration(400);
    swing.setInterpolator(new AccelerateInterpolator());
    swing.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            view.setRotationX((float)animation.getAnimatedValue());
        }
    });
    swing.start();
}
 
Example 22
Project: LittleFlickr   File: DetailActivity.java   Source Code and License 6 votes vote down vote up
void startShowAnimation() {
    float toolBarYStart = mDetailToolBar.getTop();
    float toolBarYEnd = mDetailToolBar.getTop() - mDetailToolBar.getBottom();

    float floatingButtonYStart = mFloatingActionButton.getTop();
    float floatingButtonYEnd = mViewPager.getBottom();

    ObjectAnimator toolBarAnimator = ObjectAnimator
            .ofFloat(mDetailToolBar, "y", toolBarYEnd, toolBarYStart)
            .setDuration(500);
    toolBarAnimator.setInterpolator(new AccelerateInterpolator());

    ObjectAnimator floatingButtonAnimator = ObjectAnimator
            .ofFloat(mFloatingActionButton, "y", floatingButtonYEnd, floatingButtonYStart)
            .setDuration(500);
    floatingButtonAnimator.setInterpolator(new AccelerateInterpolator());

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet
            .play(toolBarAnimator)
            .before(floatingButtonAnimator);
    animatorSet.start();
}
 
Example 23
Project: Android-Programming-BigNerd   File: SunsetFragment.java   Source Code and License 6 votes vote down vote up
private void sunsetAnimator() {
    float sunYStart = mSunView.getTop();
    float sunYEnd = mSkyView.getHeight();

    ObjectAnimator heightAnimator = ObjectAnimator.ofFloat(mSunView, "y", sunYStart, sunYEnd)
            .setDuration(3000);

    ObjectAnimator sunsetSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
            mBlueSkyColor, mSunsetSkyColor)
            .setDuration(3000);
    ObjectAnimator nightSkyAnimator = ObjectAnimator.ofInt(mSkyView, "backgroundColor",
            mSunsetSkyColor, mNightSkyColor)
            .setDuration(1500);

    heightAnimator.setInterpolator(new AccelerateInterpolator());
    sunsetSkyAnimator.setEvaluator(new ArgbEvaluator());
    nightSkyAnimator.setEvaluator(new ArgbEvaluator());

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(heightAnimator).with(sunsetSkyAnimator).before(nightSkyAnimator);
    animatorSet.start();
}
 
Example 24
Project: AndroidBasicLibs   File: DrawerToast.java   Source Code and License 6 votes vote down vote up
/**
 * 获得离场动画
 *
 * @return
 */
protected Animation getEndAnimation() {
    AlphaAnimation animAlpha = new AlphaAnimation(1, 0);
    animAlpha.setDuration(TIME_END_ANIM);
    animAlpha.setFillAfter(true);

    TranslateAnimation animTrans = new TranslateAnimation(Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, -1.5f,
            Animation.RELATIVE_TO_PARENT, 0f,
            Animation.RELATIVE_TO_PARENT, 0f);
    animTrans.setDuration(TIME_END_ANIM);
    animTrans.setFillAfter(true);
    animTrans.setInterpolator(new AccelerateInterpolator());

    AnimationSet sets = new AnimationSet(true);
    sets.addAnimation(animAlpha);
    sets.addAnimation(animTrans);

    return sets;
}
 
Example 25
Project: letv   File: BottomRedPointView.java   Source Code and License 6 votes vote down vote up
private void init(Context context, View target) {
    this.context = context;
    this.target = target;
    fadeIn = new AlphaAnimation(0.0f, 1.0f);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(200);
    fadeOut = new AlphaAnimation(1.0f, 0.0f);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setDuration(200);
    this.isShown = false;
    if (this.target != null) {
        applyTo(this.target);
    } else {
        show();
    }
}
 
Example 26
Project: SmartRefreshLayout   File: BezierCircleHeader.java   Source Code and License 6 votes vote down vote up
@Override
public int onFinish(@NonNull RefreshLayout layout, boolean success) {
    mShowOuter = false;
    mShowBoll = false;
    ValueAnimator animator = ValueAnimator.ofFloat(0, 1);
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mFinishRatio = (float) animation.getAnimatedValue();
            BezierCircleHeader.this.invalidate();
        }
    });
    animator.setInterpolator(new AccelerateInterpolator());
    animator.setDuration(DURATION_FINISH);
    animator.start();
    return DURATION_FINISH;
}
 
Example 27
Project: FakeWeather   File: HazeType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);

    ValueAnimator animator1 = ValueAnimator.ofFloat(1, 0);
    animator1.setInterpolator(new AccelerateInterpolator());
    animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            speed = (float) animation.getAnimatedValue() * 32;
            rotate = (float) animation.getAnimatedValue();
        }
    });

    AnimatorSet animSet = new AnimatorSet();
    animSet.play(animator1);
    animSet.setDuration(1000);
    if (listener != null) {
        animSet.addListener(listener);
    }
    animSet.start();
}
 
Example 28
Project: FakeWeather   File: HailType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.25f, getWidth());
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
Example 29
Project: FakeWeather   File: RainType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    dynamicWeatherView.removeCallbacks(flashRunnable);
    ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.2f, getWidth());
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
Example 30
Project: FakeWeather   File: SnowType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    ValueAnimator animator = ValueAnimator.ofFloat(getWidth() - bitmap.getWidth() * 0.25f, getWidth());
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            transFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
Example 31
Project: FakeWeather   File: SandstormType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);

    ValueAnimator animator1 = ValueAnimator.ofFloat(1, 0);
    animator1.setInterpolator(new AccelerateInterpolator());
    animator1.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            speed = (float) animation.getAnimatedValue() * 32;
            rotate = (float) animation.getAnimatedValue();
        }
    });

    AnimatorSet animSet = new AnimatorSet();
    animSet.play(animator1);
    animSet.setDuration(1000);
    if (listener != null) {
        animSet.addListener(listener);
    }
    animSet.start();
}
 
Example 32
Project: FakeWeather   File: OvercastType.java   Source Code and License 6 votes vote down vote up
@Override
public void endAnimation(DynamicWeatherView dynamicWeatherView, Animator.AnimatorListener listener) {
    super.endAnimation(dynamicWeatherView, listener);
    ValueAnimator animator = ValueAnimator.ofFloat(1, -1);
    animator.setDuration(1000);
    animator.setRepeatCount(0);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            hillTransFactor = (float) animation.getAnimatedValue();
        }
    });
    if (listener != null) {
        animator.addListener(listener);
    }
    animator.start();
}
 
Example 33
Project: Garbage_RippleView   File: RippleView.java   Source Code and License 6 votes vote down vote up
private void init() {
    setLayerType(LAYER_TYPE_SOFTWARE,null);
    mPaint = new Paint();
    mPaint.setStyle(Paint.Style.FILL);
    mPaint.setStrokeWidth(1);
    mPaint.setAntiAlias(true);
    mPaint.setColor(Color.RED);

    mPath = new Path();


    anim = ValueAnimator.ofFloat(0f,1f);
    anim.setInterpolator(new AccelerateInterpolator());
    anim.setDuration(5000);
    anim.setRepeatCount(ValueAnimator.INFINITE);
    anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            progress = (float)animation.getAnimatedValue();
            invalidate();
        }
    });

    anim.start();

}
 
Example 34
Project: CalcMate   File: Calculator.java   Source Code and License 6 votes vote down vote up
private Cling initCling(int clingId, int[] positionData, float revealRadius, boolean showHand, boolean animate) {
    setPagingEnabled(false);
    clingActive = true;

    Cling cling = (Cling) findViewById(clingId);
    if(cling != null) {
        //getActionBar().hide();
        getActionBar().hide();
        cling.init(this, positionData, revealRadius, showHand);
        cling.setVisibility(View.VISIBLE);
        cling.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        if(animate) {
            cling.buildLayer();
            cling.setAlpha(0f);
            cling.animate().alpha(1f).setInterpolator(new AccelerateInterpolator()).setDuration(Cling.SHOW_CLING_DURATION).setStartDelay(0).start();
        }
        else {
            cling.setAlpha(1f);
        }
    }
    return cling;
}
 
Example 35
Project: Dachshund-Tab-Layout   File: DachshundIndicator.java   Source Code and License 5 votes vote down vote up
public DachshundIndicator(DachshundTabLayout dachshundTabLayout){
    this.dachshundTabLayout = dachshundTabLayout;

    valueAnimatorLeft = new ValueAnimator();
    valueAnimatorLeft.setDuration(DEFAULT_DURATION);
    valueAnimatorLeft.addUpdateListener(this);

    valueAnimatorRight = new ValueAnimator();
    valueAnimatorRight.setDuration(DEFAULT_DURATION);
    valueAnimatorRight.addUpdateListener(this);

    accelerateInterpolator = new AccelerateInterpolator();
    decelerateInterpolator = new DecelerateInterpolator();

    rectF = new RectF();
    rect = new Rect();

    paint = new Paint();
    paint.setAntiAlias(true);
    paint.setStyle(Paint.Style.FILL);

    leftX = (int) dachshundTabLayout.getChildXCenter(dachshundTabLayout.getCurrentPosition());
    rightX = leftX;
}
 
Example 36
Project: showroom-android   File: ShowroomActivity.java   Source Code and License 5 votes vote down vote up
private void hideHelpOverlay() {
    if (animationsInProgress) return;
    animationsInProgress = true;
    titleLayout.bringToFront();
    mainLayout.setVisibility(View.VISIBLE);

    Animator hideAnimation;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        hideAnimation = ViewAnimationUtils.createCircularReveal(helpLayout, titleBtnHelpCenterX, titleBtnHelpCenterY, screenDiagonalPx, 0);
    } else {
        hideAnimation = ObjectAnimator.ofFloat(helpLayout, "alpha", 1f, 0f);
    }

    hideAnimation.setInterpolator(new AccelerateInterpolator());
    hideAnimation.setDuration(250);

    hideAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            helpLayout.setVisibility(View.GONE);
            animationsInProgress = false;
            helpLayoutShown = false;
            helpLayoutScrollView.scrollTo(0, 0);
        }
    });
    hideAnimation.start();
}
 
Example 37
Project: GitHub   File: FlipDownItemAnimator.java   Source Code and License 5 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
	return ViewCompat.animate(holder.itemView)
			.rotationY(90)
			.translationX(-(holder.itemView.getMeasuredWidth() / 4))
			.scaleX(0.5F)
			.scaleY(0.5F)
			.setInterpolator(new AccelerateInterpolator());
}
 
Example 38
Project: GitHub   File: FromTopItemAnimator.java   Source Code and License 5 votes vote down vote up
@Override
protected ViewPropertyAnimatorCompat animateRemoveImpl(ViewHolder holder) {
	Point screen = Utils.getScreenDimensions(holder.itemView.getContext());
	int top = holder.itemView.getTop();
	return ViewCompat.animate(holder.itemView)
			.rotation(80)
			.translationY(screen.y - top)
			.setInterpolator(new AccelerateInterpolator());
}
 
Example 39
Project: GitHub   File: MaterialViewPagerImageHelper.java   Source Code and License 5 votes vote down vote up
public static void fadeIn(View view, float alpha, int fadeDuration, ViewPropertyAnimatorListenerAdapter listener) {
    //fade to alpha=0
    ViewCompat.animate(view)
        .alpha(alpha)
        .setDuration(fadeDuration)
        .withLayer()
        .setInterpolator(new AccelerateInterpolator())
        .setListener(listener);
}
 
Example 40
Project: BlogBookApp   File: Animation.java   Source Code and License 5 votes vote down vote up
/**
 *
 * @param view
 * @param scaleInitial
 * @param scaleFinal
 * @param factor
 * @param duration
 * @param <V>
 */
protected static <V extends View>void itemAnimScaleAsc(V view, float scaleInitial, float scaleFinal, float factor, int duration){
    view.setScaleX(scaleInitial);
    view.setScaleY(scaleInitial);
    view.animate()
            .scaleX(scaleFinal)
            .scaleY(scaleFinal)
            .setInterpolator(new AccelerateInterpolator(factor))
            .setDuration(duration)
            .start();
}
 
Example 41
Project: mapbox-navigation-android   File: AlertView.java   Source Code and License 5 votes vote down vote up
private void initAnimations() {
  fadeOut = new AlphaAnimation(1, 0);
  fadeOut.setInterpolator(new AccelerateInterpolator());
  fadeOut.setDuration(300);
  slideDownTop = AnimationUtils.loadAnimation(getContext(), R.anim.slide_down_top);
  slideDownTop.setInterpolator(new OvershootInterpolator(2.0f));
}
 
Example 42
Project: weex-uikit   File: WXAnimationModule.java   Source Code and License 5 votes vote down vote up
private static @Nullable
Interpolator createTimeInterpolator(@NonNull WXAnimationBean animation) {
  String interpolator = animation.timingFunction;
  if (!TextUtils.isEmpty(interpolator)) {
    switch (interpolator) {
      case WXAnimationBean.EASE_IN:
        return new AccelerateInterpolator();
      case WXAnimationBean.EASE_OUT:
        return new DecelerateInterpolator();
      case WXAnimationBean.EASE_IN_OUT:
        return new AccelerateDecelerateInterpolator();
      case WXAnimationBean.LINEAR:
        return new LinearInterpolator();
      default:
        //Parse cubic-bezier
        try {
          SingleFunctionParser<Float> parser = new SingleFunctionParser<>(
              animation.timingFunction,
              new SingleFunctionParser.FlatMapper<Float>() {
                @Override
                public Float map(String raw) {
                  return Float.parseFloat(raw);
                }
              });
          List<Float> params = parser.parse(WXAnimationBean.CUBIC_BEZIER);
          if (params != null && params.size() == WXAnimationBean.NUM_CUBIC_PARAM) {
            return PathInterpolatorCompat.create(
                params.get(0), params.get(1), params.get(2), params.get(3));
          }
          else {
            return null;
          }
        }catch (RuntimeException e){
          return null;
        }
    }
  }
  return null;
}
 
Example 43
Project: ceji_android   File: Animations.java   Source Code and License 5 votes vote down vote up
public static Animation inFromRightAnimation() {

    	Animation inFromRight = new TranslateAnimation(
    			Animation.RELATIVE_TO_PARENT,  +1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
    			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
    	);
    	inFromRight.setDuration(DURATION);
    	inFromRight.setInterpolator(new AccelerateInterpolator());
    	return inFromRight;
    }
 
Example 44
Project: ceji_android   File: Animations.java   Source Code and License 5 votes vote down vote up
public static Animation outToLeftAnimation() {
	Animation outtoLeft = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,  -1.0f,
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
	);
	outtoLeft.setDuration(DURATION);
	outtoLeft.setInterpolator(new AccelerateInterpolator());
	return outtoLeft;
}
 
Example 45
Project: ceji_android   File: Animations.java   Source Code and License 5 votes vote down vote up
public static Animation inFromLeftAnimation() {
	Animation inFromLeft = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT,  -1.0f, Animation.RELATIVE_TO_PARENT,  0.0f,
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
	);
	inFromLeft.setDuration(DURATION);
	inFromLeft.setInterpolator(new AccelerateInterpolator());
	return inFromLeft;
}
 
Example 46
Project: ceji_android   File: Animations.java   Source Code and License 5 votes vote down vote up
public static Animation outToRightAnimation() {
	Animation outtoRight = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,  +1.0f,
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f
	);
	outtoRight.setDuration(DURATION);
	outtoRight.setInterpolator(new AccelerateInterpolator());
	return outtoRight;
}
 
Example 47
Project: NeoTerm   File: PhoneTabSwitcherLayout.java   Source Code and License 5 votes vote down vote up
/**
 * Animates reverting an overshoot at the start.
 */
private void animateRevertStartOvershoot() {
    boolean tilted = animateTilt(new AccelerateInterpolator(), maxStartOvershootAngle,
            createRevertStartOvershootAnimationListener());

    if (!tilted) {
        animateRevertStartOvershoot(new AccelerateDecelerateInterpolator());
    }
}
 
Example 48
Project: BeHealthy   File: DailyButtonTransition.java   Source Code and License 5 votes vote down vote up
public DailyButtonTransition(int mode) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setOrdering(ORDERING_TOGETHER);
        addTransition(new ChangeBounds());
        if (mode == MODE_ENTER) {
            setInterpolator(new DecelerateInterpolator());
            setDuration(400);
        }else{
            setInterpolator(new AccelerateInterpolator());
            setDuration(240);
        }
    }
}
 
Example 49
Project: ceji_android   File: Animations.java   Source Code and License 5 votes vote down vote up
public static Animation inFromBottomAnimation() {
	Animation outtoRight = new TranslateAnimation(
			Animation.RELATIVE_TO_PARENT,  0.0f, Animation.RELATIVE_TO_PARENT,   0.0f,
			Animation.RELATIVE_TO_PARENT,  +1.0f, Animation.RELATIVE_TO_PARENT,  0.0f
	);
	outtoRight.setDuration(DURATION);
	outtoRight.setInterpolator(new AccelerateInterpolator());
	return outtoRight;
}
 
Example 50
Project: Android-Code-Demos   File: ResultAdapter.java   Source Code and License 5 votes vote down vote up
public void bindHolder(String result, int position) {
    mTextView.setText(result);
    Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.anim_item);
    animation.setStartOffset(position * 200);
    animation.setInterpolator(new AccelerateInterpolator());
    itemView.startAnimation(animation);
}
 
Example 51
Project: MyFire   File: IRecyclerView.java   Source Code and License 5 votes vote down vote up
private void startScrollDefaultStatusToRefreshingStatus() {
    mRefreshTrigger.onStart(true, mRefreshHeaderView.getMeasuredHeight(), mRefreshFinalMoveOffset);

    int targetHeight = mRefreshHeaderView.getMeasuredHeight();
    int currentHeight = mRefreshHeaderContainer.getMeasuredHeight();
    startScrollAnimation(400, new AccelerateInterpolator(), currentHeight, targetHeight);
}
 
Example 52
Project: LuaViewPlayground   File: UDInterpolator.java   Source Code and License 5 votes vote down vote up
public static Interpolator parse(Integer type, Float cycles) {
        if (type != null) {
            switch (type) {
                case 0:
                    return new AccelerateDecelerateInterpolator();
                case 1:
                    return new AccelerateInterpolator();
                case 2:
                    return new AnticipateInterpolator();
                case 3:
                    return new AnticipateOvershootInterpolator();
                case 4:
                    return new BounceInterpolator();
                case 5:
                    return new CycleInterpolator((cycles != null && cycles > 0) ? cycles : 1f);
                case 6:
                    return new DecelerateInterpolator();
                case 7:
                    return new LinearInterpolator();
                case 8:
                    return new OvershootInterpolator();
                //暂时不支持的
//            case 7: return new FastOutLinearInterplator();
//            case 8: return new FastOutSlowInInterplator();
//            case 10: return new LinearOutSlowInInterplator();
//            case 12: return new PathInterplator();
                default:
                    return new LinearInterpolator();
            }
        } else {
            return new LinearInterpolator();
        }
    }
 
Example 53
Project: AssistantBySDK   File: PlayerListLrcFragment.java   Source Code and License 5 votes vote down vote up
public void switchLyricBox() {
    if (isRuning.get())
        return;
    listBoxHeight = root.findViewById(R.id.player_list_lrc_listbox).getHeight();
    if (!lyricOpen) {       //展开
        LinearLayout.LayoutParams layout = (LinearLayout.LayoutParams) lyricListView.getLayoutParams();
        if (layout != null) {
            lrcListViewHeight = layout.height;
            Log.e(TAG, "open>>>>lrcListViewHeight====" + lrcListViewHeight);
            animation.reset();
            animation.setDuration(200);
            animation.setInterpolator(new AccelerateInterpolator());
            animation.setAnimationListener(animationListener);
            isRuning.set(true);
            lyricOpen = true;
            lyricListView.startAnimation(animation);
        }
    } else {
        if (lrcListViewHeight > 0) {
            Log.e(TAG, "close>>>>>>lrcListViewHeight====" + lrcListViewHeight);
            animation.reset();
            animation.setDuration(200);
            animation.setInterpolator(new AccelerateInterpolator());
            animation.setAnimationListener(animationListener);
            isRuning.set(true);
            lyricOpen = false;
            lyricListView.startAnimation(animation);
        }
    }
}
 
Example 54
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 55
Project: Expandable-Action-Button   File: ScrollListener.java   Source Code and License 5 votes vote down vote up
@Override
public void onScrollStateChanged(RecyclerView recyclerView, final int newState) {
    super.onScrollStateChanged(recyclerView, newState);
    if (RecyclerView.SCROLL_STATE_IDLE == newState || RecyclerView.SCROLL_STATE_SETTLING == newState) {
        if (Math.abs(offsetY) >= LIMIT) {
            if (expandableButton.getState() == ExpandableButtonView.State.FINISHED) {
                expandableButton.removeBottomToolbar();
                expandableButton.setState(State.IDLE);
                hasStopped = false;
            } else if (hasStopped && expandableButton.getState() == State.IDLE) {
                if (expandableButton.getScaleX() > 0f) {
                    expandableButton.setClickable(false);
                    expandableButton.animate().setInterpolator(new AccelerateInterpolator())
                            .scaleY(0.f).scaleX(0.f).setDuration(FADE_IN_OUT_DURATION).start();
                }
            }

            if (!hasStopped) {
                hasStopped = (newState == RecyclerView.SCROLL_STATE_IDLE)
                        || (Math.abs(offsetY) >= 8 * LIMIT);
            }
            offsetY = 0;
        }

        if (newState == RecyclerView.SCROLL_STATE_IDLE) {
            if (expandableButton.getScaleX() < 1.f) {
                expandableButton.setClickable(true);
                expandableButton.animate().scaleX(1.f).setListener(null).
                        setInterpolator(new DecelerateInterpolator()).scaleY(1.f).
                        setDuration(FADE_IN_OUT_DURATION / 2).start();
            }
        }
    }
}
 
Example 56
Project: AndroidSkinAnimator   File: TranslationRotationHideAnimator2.java   Source Code and License 5 votes vote down vote up
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("rotation", 0, 360),
            PropertyValuesHolder.ofFloat("translationY", 0, view.getHeight()),
            PropertyValuesHolder.ofFloat("translationX", 0, view.getWidth()));
    animator.setDuration(5 * PRE_DURATION);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
 
Example 57
Project: Rx2Animations   File: RxAnimations.java   Source Code and License 5 votes vote down vote up
public static Completable fadeOut(final View view, final int duration) {
    return animate(view, new AccelerateInterpolator())
            .duration(duration)
            .fadeOut()
            .onAnimationCancel(aView -> aView.setAlpha(TRANSPARENT))
            .schedule();
}
 
Example 58
Project: Rx2Animations   File: RxAnimations.java   Source Code and License 5 votes vote down vote up
public static Completable fadeOut(final View view, final int duration, final int delay) {
    return animate(view, duration, delay)
            .interpolator(new AccelerateInterpolator())
            .fadeOut()
            .onAnimationCancel(aView -> aView.setAlpha(TRANSPARENT))
            .schedule();
}
 
Example 59
Project: OSchina_resources_android   File: SolarSystemView.java   Source Code and License 5 votes vote down vote up
private ValueAnimator getDecelerateAnimator() {
    if (mDecelerateAnimator != null) return mDecelerateAnimator;
    mDecelerateAnimator = ValueAnimator.ofFloat(mFlushRate, FLUSH_RATE);
    mDecelerateAnimator.setEvaluator(new FloatEvaluator());
    mDecelerateAnimator.setInterpolator(new AccelerateInterpolator());
    mDecelerateAnimator.setDuration(1000);
    mDecelerateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator animation) {
            mFlushRate = ((Float) animation.getAnimatedValue()).intValue();
        }
    });
    return mDecelerateAnimator;
}
 
Example 60
Project: Hitalk   File: BasePopupWindow.java   Source Code and License 5 votes vote down vote up
/**
 * 生成默认的AlphaAnimation
 */
protected Animation getDefaultAlphaAnimation() {
    Animation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(300);
    alphaAnimation.setInterpolator(new AccelerateInterpolator());
    alphaAnimation.setFillEnabled(true);
    alphaAnimation.setFillAfter(true);
    return alphaAnimation;
}