use of android.animation.ValueAnimator.AnimatorUpdateListener in project android_packages_apps_Dialer by MoKee.
the class ActionBarController method slideActionBar.
public void slideActionBar(boolean slideUp, boolean animate) {
if (DEBUG) {
Log.d(TAG, "Sliding actionBar - up: " + slideUp + " animate: " + animate);
}
if (animate) {
ValueAnimator animator = slideUp ? ValueAnimator.ofFloat(0, 1) : ValueAnimator.ofFloat(1, 0);
animator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
final float value = (float) animation.getAnimatedValue();
setHideOffset((int) (mActivityUi.getActionBarHeight() * value));
}
});
animator.start();
} else {
setHideOffset(slideUp ? mActivityUi.getActionBarHeight() : 0);
}
mIsActionBarSlidUp = slideUp;
}
use of android.animation.ValueAnimator.AnimatorUpdateListener in project Xposed-Tinted-Status-Bar by MohammadAG.
the class OverlayDrawable method setOverrideColor.
public void setOverrideColor(final int color) {
int animateFrom;
final int animateTo;
if (mOverrideColor != -3) {
animateFrom = mOverrideColor;
} else {
animateFrom = mColor;
}
if (color == -3) {
animateTo = mColor;
} else {
animateTo = color;
}
if (mAnimator != null && mAnimator.isRunning()) {
mAnimator.cancel();
animateFrom = mOverrideColor;
mAnimator = null;
}
mAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), animateFrom, animateTo);
mAnimator.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mOverrideColor = (Integer) animator.getAnimatedValue();
invalidateSelf();
}
});
mAnimator.addListener(new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
@Override
public void onAnimationEnd(Animator animation) {
if (color == -3) {
mOverrideColor = -3;
mColor = animateTo;
invalidateSelf();
}
mAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
}
});
mAnimator.start();
}
use of android.animation.ValueAnimator.AnimatorUpdateListener in project Xposed-Tinted-Status-Bar by MohammadAG.
the class ColourChangerMod method setStatusBarTint.
@SuppressLint("NewApi")
public void setStatusBarTint(final int tintColor) {
if (mStatusBarView == null)
return;
log("Setting statusbar color to " + tintColor);
if (mSettingsHelper.animateStatusBarTintChange()) {
int animateFrom = mLastSetColor == KITKAT_TRANSPARENT_COLOR ? Color.TRANSPARENT : mLastSetColor;
int animateTo = tintColor == KITKAT_TRANSPARENT_COLOR ? Color.TRANSPARENT : tintColor;
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), animateFrom, animateTo);
colorAnimation.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mGradientDrawable.setColor((Integer) animator.getAnimatedValue());
}
});
Utils.setViewBackground(mStatusBarView, mGradientDrawable);
colorAnimation.start();
} else {
mStatusBarView.setAlpha(1f);
if (tintColor == KITKAT_TRANSPARENT_COLOR) {
Utils.setViewBackground(mStatusBarView, mGradientDrawable);
mGradientDrawable.setColor(Color.TRANSPARENT);
} else {
Utils.setViewBackground(mStatusBarView, mGradientDrawable);
mGradientDrawable.setColor(tintColor);
}
}
mGradientDrawable.setMode(mSettingsHelper.getOverlayMode(), mSettingsHelper.getSemiTransparentOverlayOpacity());
mGradientDrawable.setIsTransparentCauseOfKitKatApi(tintColor == KITKAT_TRANSPARENT_COLOR && mSettingsHelper.isLegacyGradientMode());
mLastSetColor = tintColor;
if (mSettingsHelper.shouldLinkStatusBarAndNavBar() && !mKeyboardUp) {
mNavigationBarTint = tintColor;
setNavigationBarTint(tintColor, true);
}
}
use of android.animation.ValueAnimator.AnimatorUpdateListener in project Launcher3 by chislon.
the class AppWidgetResizeFrame method snapToWidget.
public void snapToWidget(boolean animate) {
final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
int newWidth = mWidgetView.getWidth() + 2 * mBackgroundPadding - mWidgetPaddingLeft - mWidgetPaddingRight;
int newHeight = mWidgetView.getHeight() + 2 * mBackgroundPadding - mWidgetPaddingTop - mWidgetPaddingBottom;
mTmpPt[0] = mWidgetView.getLeft();
mTmpPt[1] = mWidgetView.getTop();
mDragLayer.getDescendantCoordRelativeToSelf(mCellLayout.getShortcutsAndWidgets(), mTmpPt);
int newX = mTmpPt[0] - mBackgroundPadding + mWidgetPaddingLeft;
int newY = mTmpPt[1] - mBackgroundPadding + mWidgetPaddingTop;
// down accordingly to provide a proper touch target.
if (newY < 0) {
// In this case we shift the touch region down to start at the top of the DragLayer
mTopTouchRegionAdjustment = -newY;
} else {
mTopTouchRegionAdjustment = 0;
}
if (newY + newHeight > mDragLayer.getHeight()) {
// In this case we shift the touch region up to end at the bottom of the DragLayer
mBottomTouchRegionAdjustment = -(newY + newHeight - mDragLayer.getHeight());
} else {
mBottomTouchRegionAdjustment = 0;
}
if (!animate) {
lp.width = newWidth;
lp.height = newHeight;
lp.x = newX;
lp.y = newY;
mLeftHandle.setAlpha(1.0f);
mRightHandle.setAlpha(1.0f);
mTopHandle.setAlpha(1.0f);
mBottomHandle.setAlpha(1.0f);
requestLayout();
} else {
PropertyValuesHolder width = PropertyValuesHolder.ofInt("width", lp.width, newWidth);
PropertyValuesHolder height = PropertyValuesHolder.ofInt("height", lp.height, newHeight);
PropertyValuesHolder x = PropertyValuesHolder.ofInt("x", lp.x, newX);
PropertyValuesHolder y = PropertyValuesHolder.ofInt("y", lp.y, newY);
ObjectAnimator oa = LauncherAnimUtils.ofPropertyValuesHolder(lp, this, width, height, x, y);
ObjectAnimator leftOa = LauncherAnimUtils.ofFloat(mLeftHandle, "alpha", 1.0f);
ObjectAnimator rightOa = LauncherAnimUtils.ofFloat(mRightHandle, "alpha", 1.0f);
ObjectAnimator topOa = LauncherAnimUtils.ofFloat(mTopHandle, "alpha", 1.0f);
ObjectAnimator bottomOa = LauncherAnimUtils.ofFloat(mBottomHandle, "alpha", 1.0f);
oa.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
requestLayout();
}
});
AnimatorSet set = LauncherAnimUtils.createAnimatorSet();
if (mResizeMode == AppWidgetProviderInfo.RESIZE_VERTICAL) {
set.playTogether(oa, topOa, bottomOa);
} else if (mResizeMode == AppWidgetProviderInfo.RESIZE_HORIZONTAL) {
set.playTogether(oa, leftOa, rightOa);
} else {
set.playTogether(oa, leftOa, rightOa, topOa, bottomOa);
}
set.setDuration(SNAP_DURATION);
set.start();
}
}
use of android.animation.ValueAnimator.AnimatorUpdateListener in project NotificationPeekPort by lzanita09.
the class SwipeHelper method snapChild.
public void snapChild(final View view, float velocity) {
final View animView = mCallback.getChildContentView(view);
final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(animView);
ObjectAnimator anim = createTranslationAnimation(animView, 0);
anim.setInterpolator(new OvershootInterpolator(2.5f));
int duration = OVERSHOOT_DURATION;
anim.setDuration(duration);
anim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
updateAlphaFromOffset(animView, canAnimViewBeDismissed);
}
});
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animator) {
updateAlphaFromOffset(animView, canAnimViewBeDismissed);
}
});
anim.start();
}
Aggregations