use of android.animation.ArgbEvaluator in project ahbottomnavigation by aurelhubert.
the class AHHelper method updateTextColor.
/**
* Update text color with animation
*/
public static void updateTextColor(final TextView textView, @ColorInt int fromColor, @ColorInt int toColor) {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
colorAnimation.setDuration(150);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
textView.setTextColor((Integer) animator.getAnimatedValue());
}
});
colorAnimation.start();
}
use of android.animation.ArgbEvaluator in project packages_apps_Contacts by AOKP.
the class QuickContactActivity method updateStatusBarColor.
private void updateStatusBarColor() {
if (mScroller == null || !CompatUtils.isLollipopCompatible()) {
return;
}
final int desiredStatusBarColor;
// Only use a custom status bar color if QuickContacts touches the top of the viewport.
if (mScroller.getScrollNeededToBeFullScreen() <= 0) {
desiredStatusBarColor = mStatusBarColor;
} else {
desiredStatusBarColor = Color.TRANSPARENT;
}
// Animate to the new color.
final ObjectAnimator animation = ObjectAnimator.ofInt(getWindow(), "statusBarColor", getWindow().getStatusBarColor(), desiredStatusBarColor);
animation.setDuration(ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION);
animation.setEvaluator(new ArgbEvaluator());
animation.start();
}
use of android.animation.ArgbEvaluator in project SMSBlocker by sagarpawardev.
the class RVThreadAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(final SMSViewHolder holder, int position) {
final String methodName = "onBindViewHolder()";
log.justEntered(methodName);
// Adi changes Start
Typeface myFont = Typeface.createFromAsset(context.getAssets(), "fonts/VarelaRound-Regular.ttf");
holder.tvBody.setTypeface(myFont);
holder.tvTime.setTypeface(myFont);
// Adi changes End
SMS sms = smses.get(position);
String body = sms.getBody();
long time = sms.getDateTime();
long type = sms.getType();
boolean isRead = sms.isRead();
String socialDate = DateUtilSingleton.getInstance().socialFormat(time);
boolean isReplySupported = sms.isReplySupported();
if (type == SMS.TYPE_QUEUED) {
holder.tvSending.setVisibility(View.VISIBLE);
} else {
holder.tvSending.setVisibility(View.GONE);
}
// If SMS is among saved SMS
log.debug(methodName, "Checking Saved SMS: " + sms.isSaved() + " id: " + sms.getId());
if (sms.isSaved()) {
holder.btnStar.setVisibility(View.VISIBLE);
// If marked for Unstar
if (markedForUnstar.contains(position)) {
holder.btnStar.setLiked(false);
} else {
holder.btnStar.setLiked(true);
}
} else {
holder.btnStar.setVisibility(View.GONE);
}
// If SMS is selected in RecyclerView
boolean isSelected = selectedSMSes.contains(sms);
setViewSelected(holder, isSelected);
holder.tvBody.setText(body);
holder.tvTime.setText(socialDate);
if (!replyNotSupportedTold && type == SMS.TYPE_RECEIVED && !isReplySupported) {
callback.onReplyNotSupported();
}
// Highlight Item if required
if (highlightPosition == position) {
int colorFrom = context.getResources().getColor(R.color.orangeA200, null);
int colorTo = context.getResources().getColor(R.color.transparent_light_grey, null);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
// milliseconds
colorAnimation.setDuration(HIGHLIGHT_DURATION);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
holder.llParent.setBackgroundColor((int) animator.getAnimatedValue());
}
});
colorAnimation.addListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
final String methodName = "onAnimationStart()";
log.justEntered(methodName);
// Nothing here
log.returning(methodName);
}
@Override
public void onAnimationEnd(Animator animator) {
final String methodName = "onAnimationEnd()";
log.justEntered(methodName);
log.info(methodName, "Resetting Highlight animation");
resetHighlight();
log.returning(methodName);
}
@Override
public void onAnimationCancel(Animator animator) {
final String methodName = "onAnimationCancel()";
log.justEntered(methodName);
// Nothing here
log.returning(methodName);
}
@Override
public void onAnimationRepeat(Animator animator) {
final String methodName = "onAnimationRepeat()";
log.justEntered(methodName);
// Nothing here
log.returning(methodName);
}
});
colorAnimation.start();
}
log.returning(methodName);
}
use of android.animation.ArgbEvaluator in project Transitions-Everywhere by andkulikov.
the class Recolor method createAnimator.
@Nullable
@Override
public Animator createAnimator(@NonNull ViewGroup sceneRoot, @Nullable TransitionValues startValues, @Nullable TransitionValues endValues) {
if (startValues == null || endValues == null) {
return null;
}
final View view = endValues.view;
Drawable startBackground = (Drawable) startValues.values.get(PROPNAME_BACKGROUND);
Drawable endBackground = (Drawable) endValues.values.get(PROPNAME_BACKGROUND);
ObjectAnimator bgAnimator = null;
if (startBackground instanceof ColorDrawable && endBackground instanceof ColorDrawable) {
ColorDrawable startColor = (ColorDrawable) startBackground;
ColorDrawable endColor = (ColorDrawable) endBackground;
if (startColor.getColor() != endColor.getColor()) {
final int finalColor = endColor.getColor();
endColor = (ColorDrawable) endColor.mutate();
endColor.setColor(startColor.getColor());
bgAnimator = ObjectAnimator.ofInt(endColor, COLORDRAWABLE_COLOR, startColor.getColor(), finalColor);
bgAnimator.setEvaluator(new ArgbEvaluator());
}
}
ObjectAnimator textColorAnimator = null;
if (view instanceof TextView) {
TextView textView = (TextView) view;
int start = (Integer) startValues.values.get(PROPNAME_TEXT_COLOR);
int end = (Integer) endValues.values.get(PROPNAME_TEXT_COLOR);
if (start != end) {
textView.setTextColor(end);
textColorAnimator = ObjectAnimator.ofInt(textView, TEXTVIEW_TEXT_COLOR, start, end);
textColorAnimator.setEvaluator(new ArgbEvaluator());
}
}
return TransitionUtils.mergeAnimators(bgAnimator, textColorAnimator);
}
use of android.animation.ArgbEvaluator in project samourai-wallet-android by Samourai-Wallet.
the class TransactionProgressView method offlineMode.
public void offlineMode(int duration) {
int colorFrom = getResources().getColor(R.color.tx_broadcast_normal_bg);
int colorTo = getResources().getColor(R.color.tx_broadcast_offline_bg);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
// milliseconds
colorAnimation.setDuration(duration);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mTransactionProgressContainer.setBackgroundColor((int) animator.getAnimatedValue());
}
});
colorAnimation.start();
}
Aggregations