use of android.view.animation.AccelerateDecelerateInterpolator in project CompactCalendarView by SundeepK.
the class AnimationHandler method getExposeCollapsingAnimation.
@NonNull
private Animation getExposeCollapsingAnimation(final boolean isCollapsing) {
Animation heightAnim = getCollapsingAnimation(isCollapsing);
heightAnim.setDuration(HEIGHT_ANIM_DURATION_MILLIS);
heightAnim.setInterpolator(new AccelerateDecelerateInterpolator());
return heightAnim;
}
use of android.view.animation.AccelerateDecelerateInterpolator in project CompactCalendarView by SundeepK.
the class AnimationHandler method closeCalendar.
void closeCalendar() {
if (isAnimating) {
return;
}
isAnimating = true;
Animation heightAnim = getCollapsingAnimation(false);
heightAnim.setDuration(HEIGHT_ANIM_DURATION_MILLIS);
heightAnim.setInterpolator(new AccelerateDecelerateInterpolator());
setUpAnimationLisForClose(heightAnim);
compactCalendarController.setAnimationStatus(CompactCalendarController.EXPAND_COLLAPSE_CALENDAR);
compactCalendarView.getLayoutParams().height = compactCalendarView.getHeight();
compactCalendarView.requestLayout();
compactCalendarView.startAnimation(heightAnim);
}
use of android.view.animation.AccelerateDecelerateInterpolator in project Bitocle by mthli.
the class SmoothProgressBar method applyStyle.
public void applyStyle(int styleResId) {
TypedArray a = getContext().obtainStyledAttributes(null, R.styleable.SmoothProgressBar, 0, styleResId);
if (a.hasValue(R.styleable.SmoothProgressBar_spb_color)) {
setSmoothProgressDrawableColor(a.getColor(R.styleable.SmoothProgressBar_spb_color, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_colors)) {
int colorsId = a.getResourceId(R.styleable.SmoothProgressBar_spb_colors, 0);
if (colorsId != 0) {
int[] colors = getResources().getIntArray(colorsId);
if (colors != null && colors.length > 0)
setSmoothProgressDrawableColors(colors);
}
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_sections_count)) {
setSmoothProgressDrawableSectionsCount(a.getInteger(R.styleable.SmoothProgressBar_spb_sections_count, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_separator_length)) {
setSmoothProgressDrawableSeparatorLength(a.getDimensionPixelSize(R.styleable.SmoothProgressBar_spb_stroke_separator_length, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_stroke_width)) {
setSmoothProgressDrawableStrokeWidth(a.getDimension(R.styleable.SmoothProgressBar_spb_stroke_width, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_speed)) {
setSmoothProgressDrawableSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_speed)) {
setSmoothProgressDrawableProgressiveStartSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStart_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStop_speed)) {
setSmoothProgressDrawableProgressiveStopSpeed(a.getFloat(R.styleable.SmoothProgressBar_spb_progressiveStop_speed, 0));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_reversed)) {
setSmoothProgressDrawableReversed(a.getBoolean(R.styleable.SmoothProgressBar_spb_reversed, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_mirror_mode)) {
setSmoothProgressDrawableMirrorMode(a.getBoolean(R.styleable.SmoothProgressBar_spb_mirror_mode, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_progressiveStart_activated)) {
setProgressiveStartActivated(a.getBoolean(R.styleable.SmoothProgressBar_spb_progressiveStart_activated, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_gradients)) {
setSmoothProgressDrawableUseGradients(a.getBoolean(R.styleable.SmoothProgressBar_spb_gradients, false));
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_generate_background_with_colors)) {
if (a.getBoolean(R.styleable.SmoothProgressBar_spb_generate_background_with_colors, false)) {
setSmoothProgressDrawableBackgroundDrawable(SmoothProgressBarUtils.generateDrawableWithColors(checkIndeterminateDrawable().getColors(), checkIndeterminateDrawable().getStrokeWidth()));
}
}
if (a.hasValue(R.styleable.SmoothProgressBar_spb_interpolator)) {
int iInterpolator = a.getInteger(R.styleable.SmoothProgressBar_spb_interpolator, -1);
Interpolator interpolator;
switch(iInterpolator) {
case INTERPOLATOR_ACCELERATEDECELERATE:
interpolator = new AccelerateDecelerateInterpolator();
break;
case INTERPOLATOR_DECELERATE:
interpolator = new DecelerateInterpolator();
break;
case INTERPOLATOR_LINEAR:
interpolator = new LinearInterpolator();
break;
case INTERPOLATOR_ACCELERATE:
interpolator = new AccelerateInterpolator();
break;
default:
interpolator = null;
}
if (interpolator != null) {
setInterpolator(interpolator);
}
}
a.recycle();
}
use of android.view.animation.AccelerateDecelerateInterpolator in project UltimateAndroid by cymcsg.
the class DynamicGridModification method animateReorder.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void animateReorder(final int oldPosition, final int newPosition) {
boolean isForward = newPosition > oldPosition;
List<Animator> resultList = new LinkedList<Animator>();
if (isForward) {
for (int pos = Math.min(oldPosition, newPosition); pos < Math.max(oldPosition, newPosition); pos++) {
View view = getViewForId(getId(pos));
if ((pos + 1) % getColumnCount() == 0) {
resultList.add(createTranslationAnimations(view, -view.getWidth() * (getColumnCount() - 1), 0, view.getHeight(), 0));
} else {
resultList.add(createTranslationAnimations(view, view.getWidth(), 0, 0, 0));
}
}
} else {
for (int pos = Math.max(oldPosition, newPosition); pos > Math.min(oldPosition, newPosition); pos--) {
View view = getViewForId(getId(pos));
if ((pos + getColumnCount()) % getColumnCount() == 0) {
resultList.add(createTranslationAnimations(view, view.getWidth() * (getColumnCount() - 1), 0, -view.getHeight(), 0));
} else {
resultList.add(createTranslationAnimations(view, -view.getWidth(), 0, 0, 0));
}
}
}
AnimatorSet resultSet = new AnimatorSet();
resultSet.playTogether(resultList);
resultSet.setDuration(MOVE_DURATION);
resultSet.setInterpolator(new AccelerateDecelerateInterpolator());
resultSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mReorderAnimation = true;
updateEnableState();
}
@Override
public void onAnimationEnd(Animator animation) {
mReorderAnimation = false;
updateEnableState();
}
});
resultSet.start();
}
use of android.view.animation.AccelerateDecelerateInterpolator in project android_packages_apps_Launcher2 by CyanogenMod.
the class LauncherTransitionable method hideAppsCustomizeHelper.
/**
* Zoom the camera back into the workspace, hiding 'fromView'.
* This is the opposite of showAppsCustomizeHelper.
* @param animated If true, the transition will be animated.
*/
private void hideAppsCustomizeHelper(State toState, final boolean animated, final boolean springLoaded, final Runnable onCompleteRunnable) {
if (mStateAnimation != null) {
mStateAnimation.cancel();
mStateAnimation = null;
}
Resources res = getResources();
final int duration = res.getInteger(R.integer.config_appsCustomizeZoomOutTime);
final int fadeOutDuration = res.getInteger(R.integer.config_appsCustomizeFadeOutTime);
final float scaleFactor = (float) res.getInteger(R.integer.config_appsCustomizeZoomScaleFactor);
final View fromView = mAppsCustomizeTabHost;
final View toView = mWorkspace;
Animator workspaceAnim = null;
if (toState == State.WORKSPACE) {
int stagger = res.getInteger(R.integer.config_appsCustomizeWorkspaceAnimationStagger);
workspaceAnim = mWorkspace.getChangeStateAnimation(Workspace.State.NORMAL, animated, stagger);
} else if (toState == State.APPS_CUSTOMIZE_SPRING_LOADED) {
workspaceAnim = mWorkspace.getChangeStateAnimation(Workspace.State.SPRING_LOADED, animated);
}
setPivotsForZoom(fromView, scaleFactor);
updateWallpaperVisibility(true);
showHotseat(animated);
if (animated) {
final LauncherViewPropertyAnimator scaleAnim = new LauncherViewPropertyAnimator(fromView);
scaleAnim.scaleX(scaleFactor).scaleY(scaleFactor).setDuration(duration).setInterpolator(new Workspace.ZoomInInterpolator());
final ObjectAnimator alphaAnim = ObjectAnimator.ofFloat(fromView, "alpha", 1f, 0f).setDuration(fadeOutDuration);
alphaAnim.setInterpolator(new AccelerateDecelerateInterpolator());
alphaAnim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float t = 1f - (Float) animation.getAnimatedValue();
dispatchOnLauncherTransitionStep(fromView, t);
dispatchOnLauncherTransitionStep(toView, t);
}
});
mStateAnimation = LauncherAnimUtils.createAnimatorSet();
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
mAppsCustomizeContent.pauseScrolling();
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
updateWallpaperVisibility(true);
fromView.setVisibility(View.GONE);
dispatchOnLauncherTransitionEnd(fromView, animated, true);
dispatchOnLauncherTransitionEnd(toView, animated, true);
if (mWorkspace != null) {
mWorkspace.hideScrollingIndicator(false);
}
if (onCompleteRunnable != null) {
onCompleteRunnable.run();
}
mAppsCustomizeContent.updateCurrentPageScroll();
mAppsCustomizeContent.resumeScrolling();
}
});
mStateAnimation.playTogether(scaleAnim, alphaAnim);
if (workspaceAnim != null) {
mStateAnimation.play(workspaceAnim);
}
dispatchOnLauncherTransitionStart(fromView, animated, true);
dispatchOnLauncherTransitionStart(toView, animated, true);
final Animator stateAnimation = mStateAnimation;
mWorkspace.post(new Runnable() {
public void run() {
if (stateAnimation != mStateAnimation)
return;
mStateAnimation.start();
}
});
} else {
fromView.setVisibility(View.GONE);
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionStart(fromView, animated, true);
dispatchOnLauncherTransitionEnd(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
dispatchOnLauncherTransitionStart(toView, animated, true);
dispatchOnLauncherTransitionEnd(toView, animated, true);
mWorkspace.hideScrollingIndicator(false);
}
}
Aggregations