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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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   View source code 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: GitHub   File: SimpleAnimUtil.java   View source code 5 votes vote down vote up
/**
 * 生成自定义ScaleAnimation
 */
public static Animation getDefaultScaleAnimation() {
    Animation scaleAnimation = new ScaleAnimation(0f, 1f, 0f, 1f, Animation.RELATIVE_TO_SELF, 0.5f,
                                                  Animation.RELATIVE_TO_SELF, 0.5f
    );
    scaleAnimation.setDuration(300);
    scaleAnimation.setInterpolator(new AccelerateInterpolator());
    scaleAnimation.setFillEnabled(true);
    scaleAnimation.setFillAfter(true);
    return scaleAnimation;
}