use of android.view.animation.OvershootInterpolator in project ahbottomnavigation by aurelhubert.
the class AHBottomNavigation method updateNotifications.
/**
* Update notifications
*/
private void updateNotifications(boolean updateStyle, int itemPosition) {
for (int i = 0; i < views.size(); i++) {
if (itemPosition != UPDATE_ALL_NOTIFICATIONS && itemPosition != i) {
continue;
}
final AHNotification notificationItem = notifications.get(i);
final int currentTextColor = AHNotificationHelper.getTextColor(notificationItem, notificationTextColor);
final int currentBackgroundColor = AHNotificationHelper.getBackgroundColor(notificationItem, notificationBackgroundColor);
TextView notification = (TextView) views.get(i).findViewById(R.id.bottom_navigation_notification);
String currentValue = notification.getText().toString();
boolean animate = !currentValue.equals(String.valueOf(notificationItem.getText()));
if (updateStyle) {
notification.setTextColor(currentTextColor);
if (notificationTypeface != null) {
notification.setTypeface(notificationTypeface);
} else {
notification.setTypeface(null, Typeface.BOLD);
}
if (notificationBackgroundDrawable != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
Drawable drawable = notificationBackgroundDrawable.getConstantState().newDrawable();
notification.setBackground(drawable);
} else {
notification.setBackgroundDrawable(notificationBackgroundDrawable);
}
} else if (currentBackgroundColor != 0) {
Drawable defautlDrawable = ContextCompat.getDrawable(context, R.drawable.notification_background);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
notification.setBackground(AHHelper.getTintDrawable(defautlDrawable, currentBackgroundColor, forceTint));
} else {
notification.setBackgroundDrawable(AHHelper.getTintDrawable(defautlDrawable, currentBackgroundColor, forceTint));
}
}
}
if (notificationItem.isEmpty() && notification.getText().length() > 0) {
notification.setText("");
if (animate) {
notification.animate().scaleX(0).scaleY(0).alpha(0).setInterpolator(new AccelerateInterpolator()).setDuration(150).start();
}
} else if (!notificationItem.isEmpty()) {
notification.setText(String.valueOf(notificationItem.getText()));
if (animate) {
notification.setScaleX(0);
notification.setScaleY(0);
notification.animate().scaleX(1).scaleY(1).alpha(1).setInterpolator(new OvershootInterpolator()).setDuration(150).start();
}
}
}
}
use of android.view.animation.OvershootInterpolator in project kickmaterial by byoutline.
the class CategoriesListActivity method launchPostTransitionAnimations.
private void launchPostTransitionAnimations() {
if (category != null) {
int color = ContextCompat.getColor(this, category.colorResId);
binding.categoryCircleIv.setColorFilter(color);
binding.selectedCategoryIv.setImageResource(category.drawableResId);
binding.selectCategoryTv.setBackgroundColor(color);
binding.selectCategoryTv.getBackground().setAlpha(85);
}
if (LUtils.hasL()) {
binding.closeCategoriesIv.setScaleX(0);
binding.closeCategoriesIv.setScaleY(0);
ActivityCompat.setEnterSharedElementCallback(this, new SharedElementCallback() {
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
binding.closeCategoriesIv.postDelayed(() -> {
// remove listener, we do not want to trigger this animation on exit
ActivityCompat.setEnterSharedElementCallback(CategoriesListActivity.this, null);
if (isFinishing()) {
return;
}
AnimatorSet closeCategoryAnim = AnimatorUtils.getScaleAnimator(binding.closeCategoriesIv, 0, 1);
closeCategoryAnim.setInterpolator(new OvershootInterpolator());
closeCategoryAnim.start();
}, 160);
}
});
}
binding.categoriesRv.post(() -> binding.categoriesRv.startAnimation(LUtils.loadAnimationWithLInterpolator(getApplicationContext(), R.anim.slide_from_bottom)));
}
use of android.view.animation.OvershootInterpolator in project ENViews by codeestX.
the class ENDownloadView method reset.
public void reset() {
if (mCurrentState != STATE_RESET) {
return;
}
ValueAnimator resetAnim = ValueAnimator.ofFloat(1.f, 100.f);
resetAnim.setDuration(500);
resetAnim.setInterpolator(new OvershootInterpolator());
resetAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
resetAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mFraction = 0;
mCurrentState = STATE_PRE;
if (onDownloadStateListener != null) {
onDownloadStateListener.onResetFinish();
}
}
});
resetAnim.start();
}
use of android.view.animation.OvershootInterpolator in project ENViews by codeestX.
the class ENDownloadView method start.
public void start() {
if (mCurrentState != STATE_PRE) {
return;
}
mCurrentState = STATE_PRE;
ValueAnimator preAnim = ValueAnimator.ofFloat(1.f, 100.f);
preAnim.setDuration(1500);
preAnim.setInterpolator(new OvershootInterpolator());
preAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mFraction = valueAnimator.getAnimatedFraction();
invalidate();
}
});
preAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mCurrentState = STATE_DOWNLOADING;
downloadAnim();
}
});
preAnim.start();
}
use of android.view.animation.OvershootInterpolator in project InstaMaterial by frogermcs.
the class FeedContextMenuManager method performShowAnimation.
private void performShowAnimation() {
contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
contextMenuView.setPivotY(contextMenuView.getHeight());
contextMenuView.setScaleX(0.1f);
contextMenuView.setScaleY(0.1f);
contextMenuView.animate().scaleX(1f).scaleY(1f).setDuration(150).setInterpolator(new OvershootInterpolator()).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
isContextMenuShowing = false;
}
});
}
Aggregations