List of usage examples for android.support.v4.view.animation FastOutSlowInInterpolator FastOutSlowInInterpolator
public FastOutSlowInInterpolator()
From source file:fr.francetv.zoom.share.loader.ZoomLoaderView.java
private void init() { mIsRunning = false;/*from ww w . j a v a 2 s . c o m*/ mViewWidthPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, VIEW_WIDTH_DP, getResources().getDisplayMetrics()); mViewHeightPx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, VIEW_HEIGHT_DP, getResources().getDisplayMetrics()); mRadiusPx = mViewHeightPx / 2; mMaskBitmap = Bitmap.createBitmap(mViewWidthPx, mViewHeightPx, Bitmap.Config.ARGB_8888); new Canvas(mMaskBitmap).drawBitmap( BitmapFactory.decodeResource(getContext().getResources(), R.drawable.img_loader_mask), 0, 0, null); mMaskPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mMaskPaint.setFilterBitmap(false); mMaskPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN)); mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mBackgroundPaint.setFilterBitmap(false); mBackgroundPaint.setXfermode(null); mBackgroundPaint.setColor(ContextCompat.getColor(getContext(), android.R.color.darker_gray)); // Circles mAnimPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mAnimPaint.setXfermode(null); mAnimPaint.setColor(ContextCompat.getColor(getContext(), android.R.color.holo_green_light)); mLeftCircleArc = new RectF(0, 0, 2 * mRadiusPx, 2 * mRadiusPx); mRightCircleArc = new RectF(mViewWidthPx - 2 * mRadiusPx, 0, mViewWidthPx, 2 * mRadiusPx); //Anims mAnimationIn = ValueAnimator.ofInt(0, 361 + LEFT_START_DEGRE); mAnimationIn.setInterpolator(new FastOutSlowInInterpolator()); mAnimationIn.addUpdateListener(mAnimationInUpdateListener); mAnimationIn.addListener(mAnimationInListener); mAnimationIn.setDuration(ANIMATION_IN_DURATION_MS); mAnimationOut = ValueAnimator.ofInt(0, 361 + LEFT_START_DEGRE); mAnimationOut.setInterpolator(new FastOutSlowInInterpolator()); mAnimationOut.addUpdateListener(mAnimationOutUpdateListener); mAnimationOut.addListener(mAnimationOutListener); mAnimationOut.setDuration(ANIMATION_OUT_DURATION_MS); mDelayHandler = new DelayHandler(mAnimationOut); }
From source file:com.ofalvai.bpinfo.ui.alert.AlertDetailFragment.java
public void updateAlert(final Alert alert) { mAlert = alert;/*from ww w .java2 s.com*/ mDisplayedRoutes.clear(); mRouteIconsLayout.removeAllViews(); // Updating views displayAlert(alert); // View animations // For some reason, ObjectAnimator doesn't work here (skips animation states, just shows the // last frame), we need to use ValueAnimators. AnimatorSet animatorSet = new AnimatorSet(); animatorSet.setDuration(300); animatorSet.setInterpolator(new FastOutSlowInInterpolator()); // We can't measure the TextView's height before a layout happens because of the setText() call // Note: even though displayAlert() was called earlier, the TextView's height is still 0. int heightEstimate = mDescriptionTextView.getLineHeight() * mDescriptionTextView.getLineCount() + 10; ValueAnimator descriptionHeight = ValueAnimator.ofInt(mDescriptionTextView.getHeight(), heightEstimate); descriptionHeight.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mDescriptionTextView.getLayoutParams().height = (int) animation.getAnimatedValue(); mDescriptionTextView.requestLayout(); } }); descriptionHeight.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mDescriptionTextView.setAlpha(1.0f); mDescriptionTextView.setVisibility(View.VISIBLE); } }); ValueAnimator descriptionAlpha = ValueAnimator.ofFloat(0, 1.0f); descriptionAlpha.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mDescriptionTextView.setAlpha((float) animation.getAnimatedValue()); } }); ValueAnimator progressHeight = ValueAnimator.ofInt(mProgressBar.getHeight(), 0); progressHeight.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mProgressBar.getLayoutParams().height = (int) animation.getAnimatedValue(); mProgressBar.requestLayout(); } }); progressHeight.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { mProgressBar.hide(); } }); animatorSet.playTogether(progressHeight, descriptionHeight, descriptionAlpha); animatorSet.start(); }
From source file:uk.co.samuelwall.materialtaptargetprompt.sample.EmptyActivity.java
public void showNoAutoDismiss(View view) { if (mFabPrompt != null) { return;/*from ww w . jav a 2s . c om*/ } mFabPrompt = new MaterialTapTargetPrompt.Builder(EmptyActivity.this).setTarget(findViewById(R.id.fab)) .setPrimaryText("No Auto Dismiss") .setSecondaryText("This prompt will only be removed after tapping the envelop") .setAnimationInterpolator(new FastOutSlowInInterpolator()).setAutoDismiss(false) .setAutoFinish(false).setCaptureTouchEventOutsidePrompt(true) .setOnHidePromptListener(new MaterialTapTargetPrompt.OnHidePromptListener() { @Override public void onHidePrompt(MotionEvent event, boolean tappedTarget) { if (tappedTarget) { mFabPrompt.finish(); mFabPrompt = null; } } @Override public void onHidePromptComplete() { } }).show(); }
From source file:com.brettyin.cardshelper.fragment.SignInFragment.java
private void removeDoneFab(@Nullable Runnable endAction) { mDoneFab.animate().scaleX(0).scaleY(0).setInterpolator(new FastOutSlowInInterpolator()) .withEndAction(endAction).start(); }
From source file:com.telenav.expandablepager.SlidingContainer.java
/** * Convenience method, uses FastOutSlowInInterpolator. See {@link SlidingContainer#animate(float, int, Interpolator)} * @param amount translationY amount// ww w . j a v a 2 s. co m * @param duration animation duration */ private void animate(float amount, int duration) { animate(amount, duration, new FastOutSlowInInterpolator()); }
From source file:com.google.samples.apps.topeka.fragment.SignInFragment.java
private void removeDoneFab(@Nullable Runnable endAction) { ViewCompat.animate(mDoneFab).scaleX(0).scaleY(0).setInterpolator(new FastOutSlowInInterpolator()) .withEndAction(endAction).start(); }
From source file:uk.co.samuelwall.materialtaptargetprompt.sample.EmptyActivity.java
public void showActionModePrompt(View view) { mActionMode = this.startSupportActionMode(mActionModeCallback); new MaterialTapTargetPrompt.Builder(EmptyActivity.this) .setPrimaryText(R.string.action_mode_tick_prompt_title) .setSecondaryText(R.string.action_mode_tick_prompt_description) .setAnimationInterpolator(new FastOutSlowInInterpolator()) .setMaxTextWidth(R.dimen.tap_target_menu_max_width).setTarget(findViewById(R.id.action_tick)) .setIcon(R.drawable.ic_check).show(); }
From source file:com.telenav.nodeflow.NodeFlowLayout.java
/** * perform closing animation for the specified node * * @param node node to be animated// w w w . j ava 2 s . co m */ private void animateDrillOut(final Node<?> node) { final Node<?> parent = node.getParent(); if (parent.getDepth() > 0) addView(_getHeaderView(node.getParent()), 0);//add parent if (nodeChangeListener != null && node.getParent().getDepth() > 0) nodeChangeListener.onParentNodeOpening(getChildAt(0), node.getParent()); for (int i = 0; i < node.getParent().getChildCount(); ++i) { if (i != node.getIndex()) addView(_getHeaderView(node.getParent().getChildAt(i)), i + (parent.getDepth() > 0 ? 1 : 0)); } final int newIndex = node.getIndex() + (parent.getDepth() > 0 ? 1 : 0); final int aux = parent.getChildCount() + (parent.getDepth() > 0 ? 1 : 0); ValueAnimator animator = ValueAnimator.ofFloat(1); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { for (int i = 0; i < aux; ++i) { if (i < newIndex) { getChildAt(i).setTranslationY(headerHeight * (-newIndex + i) + headerHeight * newIndex * ((Float) animation.getAnimatedValue())); } else if (i > newIndex) { getChildAt(i) .setTranslationY((getHeight() + headerHeight * (i - (newIndex + 1))) - ((getHeight() - (node.getIndex() + 1 + (parent.getDepth() > 0 ? 1 : 0)) * headerHeight) * ((Float) animation.getAnimatedValue()))); } else { getChildAt(newIndex) .setTranslationY(headerHeight * newIndex * ((Float) animation.getAnimatedValue())); } } } }); animator.addListener(new CustomAnimationListener() { @Override public void onAnimationEnd(Animator animator) { activeNode = parent; updateViews(node, false); } }); animator.setDuration(duration); animator.setInterpolator(new FastOutSlowInInterpolator()); animator.start(); animateDrillAlpha(newIndex + 1, aux, 1); }
From source file:com.savvasdalkitsis.betwixt.Interpolators.java
/** * <strong>ANDROID INTERPOLATOR</strong><br/><br/> * Interpolator corresponding to fast_out_slow_in. Uses a lookup table for the Bezier curve * from (0,0) to (1,1) with control points: P0 (0, 0) P1 (0.4, 0) P2 (0.2, 1.0) P3 (1.0, 1.0) *///w ww. jav a 2 s .co m @NonNull public static Interpolator fastOutSlowIn() { return new FastOutSlowInInterpolator(); }
From source file:com.rexmtorres.android.patternlock.PatternLockView.java
@SuppressWarnings("deprecation") public PatternLockView(Context context, AttributeSet attrs) { super(context, attrs); mContext = getContext();//from w ww. j a va2s . c om TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PatternLockView, R.attr.patternLockViewStyle, 0); final String aspect = a.getString(R.styleable.PatternLockView_aspect); if ("square".equals(aspect)) { mAspect = ASPECT_SQUARE; } else if ("lock_width".equals(aspect)) { mAspect = ASPECT_LOCK_WIDTH; } else if ("lock_height".equals(aspect)) { mAspect = ASPECT_LOCK_HEIGHT; } else { mAspect = ASPECT_SQUARE; } setClickable(true); mPathPaint.setAntiAlias(true); mPathPaint.setDither(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { mRegularColor = context.getColor(R.color.lock_pattern_view_regular_color); mErrorColor = context.getColor(R.color.lock_pattern_view_error_color); mSuccessColor = context.getColor(R.color.lock_pattern_view_success_color); } else { Resources resources = context.getResources(); mRegularColor = resources.getColor(R.color.lock_pattern_view_regular_color); mErrorColor = resources.getColor(R.color.lock_pattern_view_error_color); mSuccessColor = resources.getColor(R.color.lock_pattern_view_success_color); } mRegularColor = a.getColor(R.styleable.PatternLockView_regularColor, mRegularColor); mErrorColor = a.getColor(R.styleable.PatternLockView_errorColor, mErrorColor); mSuccessColor = a.getColor(R.styleable.PatternLockView_successColor, mSuccessColor); int pathColor = a.getColor(R.styleable.PatternLockView_pathColor, mRegularColor); // [START rexmtorres 20160401] If set, replaces the pattern dots with the specified bitmap. Drawable oDotDrawable = a.getDrawable(R.styleable.PatternLockView_dotBitmap); if (oDotDrawable != null) { if (oDotDrawable instanceof BitmapDrawable) { m_oDotBitmap = ((BitmapDrawable) oDotDrawable).getBitmap(); m_oBigDotBitmap = Bitmap.createScaledBitmap(m_oDotBitmap, (int) (m_oDotBitmap.getWidth() * 1.25), (int) (m_oDotBitmap.getHeight() * 1.25), false); } } // [END rexmtorres 20160401] a.recycle(); mPathPaint.setColor(pathColor); mPathPaint.setStyle(Paint.Style.STROKE); mPathPaint.setStrokeJoin(Paint.Join.ROUND); mPathPaint.setStrokeCap(Paint.Cap.ROUND); mPathWidth = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_line_width); mPathPaint.setStrokeWidth(mPathWidth); mDotSize = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_size); mDotSizeActivated = getResources().getDimensionPixelSize(R.dimen.lock_pattern_dot_size_activated); mPaint.setAntiAlias(true); mPaint.setDither(true); mCellStates = new CellState[3][3]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { mCellStates[i][j] = new CellState(); mCellStates[i][j].radius = mDotSize / 2; mCellStates[i][j].row = i; mCellStates[i][j].col = j; mCellStates[i][j].bitmapDot = m_oDotBitmap; } } mFastOutSlowInInterpolator = new FastOutSlowInInterpolator(); mLinearOutSlowInInterpolator = new LinearOutSlowInInterpolator(); mExploreByTouchHelper = new PatternExploreByTouchHelper(this); ViewCompat.setAccessibilityDelegate(this, mExploreByTouchHelper); mAccessibilityManager = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); }