use of android.view.animation.DecelerateInterpolator in project Carbon by ZieIony.
the class Snackbar method dismiss.
public void dismiss() {
synchronized (Snackbar.class) {
handler.removeCallbacks(hideRunnable);
if (onDismissListener != null)
onDismissListener.onDismiss();
AnimUtils.flyOut(content, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
hideInternal();
}
});
for (final View pushedView : pushedViews) {
ValueAnimator animator = ValueAnimator.ofFloat(-1, 0);
animator.setDuration(200);
animator.setInterpolator(new DecelerateInterpolator());
animator.addUpdateListener(valueAnimator -> {
MarginLayoutParams lp = (MarginLayoutParams) content.getLayoutParams();
ViewHelper.setTranslationY(pushedView, (content.getHeight() + lp.bottomMargin) * (Float) valueAnimator.getAnimatedValue());
if (pushedView.getParent() != null)
((View) pushedView.getParent()).postInvalidate();
});
animator.start();
}
}
}
use of android.view.animation.DecelerateInterpolator in project ElasticDownload by Tibolte.
the class ProgressDownloadView method setPercentage.
public void setPercentage(float newProgress) {
if (newProgress < 0 || newProgress > 100) {
throw new IllegalArgumentException("setPercentage not between 0 and 100");
}
mState = State.STATE_WORKING;
mTarget = newProgress;
ObjectAnimator anim = ObjectAnimator.ofFloat(this, "progress", getProgress(), mTarget);
anim.setInterpolator(new DecelerateInterpolator());
anim.setDuration((long) (ANIMATION_DURATION_BASE + Math.abs(mTarget * 10 - getProgress() * 10) / 2));
anim.start();
}
use of android.view.animation.DecelerateInterpolator in project android_frameworks_base by ParanoidAndroid.
the class HaloProperties method setHaloOverlay.
public void setHaloOverlay(Overlay overlay, float overlayAlpha) {
Drawable d = null;
switch(overlay) {
case BLACK_X:
d = mHaloBlackX;
break;
case BACK_LEFT:
d = mHaloBackL;
break;
case BACK_RIGHT:
d = mHaloBackR;
break;
case DISMISS:
d = mHaloDismiss;
break;
case SILENCE_LEFT:
d = mHaloSilenceL;
break;
case SILENCE_RIGHT:
d = mHaloSilenceR;
break;
case CLEAR_ALL:
d = mHaloClearAll;
break;
case MESSAGE:
d = mHaloMessage;
break;
}
if (d != mHaloCurrentOverlay) {
mHaloOverlay.setImageDrawable(d);
mHaloCurrentOverlay = d;
// Fade out number batch
if (overlay != Overlay.NONE) {
msgNumberAlphaAnimator.animate(ObjectAnimator.ofFloat(mHaloNumberContainer, "alpha", 0f).setDuration(100), new DecelerateInterpolator(), null);
}
}
mHaloOverlay.setAlpha(overlayAlpha);
updateResources(mLastContentStateLeft);
}
use of android.view.animation.DecelerateInterpolator in project Anki-Android by Ramblurr.
the class Reviewer method fillFlashcard.
public void fillFlashcard(boolean flip) {
if (!flip) {
Log.i(AnkiDroidApp.TAG, "base url = " + mBaseUrl);
if (mCurrentSimpleInterface && mSimpleCard != null) {
mSimpleCard.setText(mCardContent);
} else if (!mUseQuickUpdate && mCard != null && mNextCard != null) {
mNextCard.setBackgroundColor(mCurrentBackgroundColor);
mNextCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null);
mNextCard.setVisibility(View.VISIBLE);
mCardFrame.removeView(mCard);
mCard.destroy();
mCard = mNextCard;
mNextCard = createWebView();
mNextCard.setVisibility(View.GONE);
mCardFrame.addView(mNextCard, 0);
// hunt for input issue 720, like android issue 3341
if (AnkiDroidApp.SDK_VERSION <= 7) {
mCard.setFocusableInTouchMode(true);
}
} else if (mCard != null) {
mCard.loadDataWithBaseURL(mBaseUrl, mCardContent.toString(), "text/html", "utf-8", null);
mCard.setBackgroundColor(mCurrentBackgroundColor);
}
if (mChangeBorderStyle) {
switch(mCurrentBackgroundColor) {
case Color.WHITE:
if (mInvertedColors) {
mInvertedColors = false;
invertColors(false);
}
break;
case Color.BLACK:
if (!mInvertedColors) {
mInvertedColors = true;
invertColors(true);
}
break;
default:
if (Themes.getTheme() != Themes.THEME_BLUE) {
mMainLayout.setBackgroundColor(mCurrentBackgroundColor);
}
if (mInvertedColors != mNightMode) {
mInvertedColors = mNightMode;
invertColors(mNightMode);
}
}
}
if (!mShowAnimations && mShowTimer && mCardTimer.getVisibility() == View.INVISIBLE) {
switchTopBarVisibility(View.VISIBLE);
}
if (!sDisplayAnswer) {
updateForNewCard();
if (mShowWhiteboard) {
mWhiteboard.clear();
}
setNextCardAnimation(false);
}
} else {
Animation3D rotation;
boolean directionToLeft = true;
switch(mNextAnimation) {
case ANIMATION_TURN:
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 9, Animation3D.ANIMATION_TURN, true, true, this);
rotation.setDuration(mAnimationDurationTurn);
rotation.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case ANIMATION_NEXT_CARD_FROM_LEFT:
directionToLeft = false;
case ANIMATION_NEXT_CARD_FROM_RIGHT:
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_EXCHANGE_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case ANIMATION_SLIDE_OUT_TO_RIGHT:
directionToLeft = false;
case ANIMATION_SLIDE_OUT_TO_LEFT:
fillFlashcard(false);
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_OUT_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new AccelerateInterpolator());
switchTopBarVisibility(View.INVISIBLE);
break;
case ANIMATION_SLIDE_IN_FROM_LEFT:
directionToLeft = false;
case ANIMATION_SLIDE_IN_FROM_RIGHT:
fillFlashcard(false);
rotation = new Animation3D(mCardContainer.getWidth(), mCardContainer.getHeight(), 0, Animation3D.ANIMATION_SLIDE_IN_CARD, directionToLeft, true, this);
rotation.setDuration(mAnimationDurationMove);
rotation.setInterpolator(new DecelerateInterpolator());
switchTopBarVisibility(View.VISIBLE);
break;
case ANIMATION_NO_ANIMATION:
default:
return;
}
rotation.reset();
mCardContainer.setDrawingCacheEnabled(true);
mCardContainer.setDrawingCacheBackgroundColor(Themes.getBackgroundColor());
mCardContainer.clearAnimation();
mCardContainer.startAnimation(rotation);
}
}
use of android.view.animation.DecelerateInterpolator in project folding-cell-android by Ramotion.
the class FoldingCell method startFoldAnimation.
/**
* Start fold animation
*
* @param foldingCellElements ordered list with animation parts from top to bottom
* @param foldingLayout prepared layout for animation parts
* @param part90degreeAnimationDuration animation duration for 90 degree rotation
* @param animationEndListener animation end callback
*/
protected void startFoldAnimation(ArrayList<FoldingCellView> foldingCellElements, ViewGroup foldingLayout, int part90degreeAnimationDuration, AnimationEndListener animationEndListener) {
for (FoldingCellView foldingCellElement : foldingCellElements) foldingLayout.addView(foldingCellElement);
Collections.reverse(foldingCellElements);
int nextDelay = 0;
for (int i = 0; i < foldingCellElements.size(); i++) {
FoldingCellView cell = foldingCellElements.get(i);
cell.setVisibility(VISIBLE);
// not FIRST(BOTTOM) element - animate front view
if (i != 0) {
FoldAnimation foldAnimation = new FoldAnimation(FoldAnimation.FoldAnimationMode.UNFOLD_UP, mCameraHeight, part90degreeAnimationDuration).withStartOffset(nextDelay).withInterpolator(new DecelerateInterpolator());
// if last(top) element - add end listener
if (i == foldingCellElements.size() - 1) {
foldAnimation.setAnimationListener(animationEndListener);
}
cell.animateFrontView(foldAnimation);
nextDelay = nextDelay + part90degreeAnimationDuration;
}
// if not last(top) element - animate whole view
if (i != foldingCellElements.size() - 1) {
cell.startAnimation(new FoldAnimation(FoldAnimation.FoldAnimationMode.FOLD_UP, mCameraHeight, part90degreeAnimationDuration).withStartOffset(nextDelay).withInterpolator(new DecelerateInterpolator()));
nextDelay = nextDelay + part90degreeAnimationDuration;
}
}
}
Aggregations