use of android.animation.ArgbEvaluator in project TransitionHelper by ImmortalZ.
the class ColorShowMethod method translate.
@Override
public void translate(InfoBean bean, RenderView parent, View child) {
if (startColor != 0) {
startColor = parent.getResources().getColor(startColor);
} else {
startColor = parent.getResources().getColor(R.color.showmethod_start_color);
}
if (endColor != 0) {
endColor = parent.getResources().getColor(endColor);
} else {
endColor = parent.getResources().getColor(R.color.showmethod_end_color);
}
parent.setPaintColor(endColor);
ObjectAnimator colorAnimator = ObjectAnimator.ofInt(parent, "backgroundColor", startColor, endColor);
colorAnimator.setEvaluator(new ArgbEvaluator());
set.playTogether(ObjectAnimator.ofFloat(child, "translationX", 0, -bean.translationX), ObjectAnimator.ofFloat(child, "translationY", 0, -bean.translationY), ObjectAnimator.ofFloat(child, "scaleX", 1 / bean.scalling), ObjectAnimator.ofFloat(child, "scaleY", 1 / bean.scalling), colorAnimator);
set.setInterpolator(new AccelerateInterpolator());
set.setDuration(duration).start();
}
use of android.animation.ArgbEvaluator in project AisenWeiBo by wangdan.
the class MaterialSheetAnimation method startColorAnim.
protected void startColorAnim(final View view, final int startColor, final int endColor, long duration, Interpolator interpolator, final AnimationListener listener) {
// Setup animation
ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(), startColor, endColor);
anim.setDuration(duration);
anim.setInterpolator(interpolator);
// Add listeners
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (listener != null) {
listener.onStart();
}
}
@Override
public void onAnimationEnd(Animator animation) {
if (listener != null) {
listener.onEnd();
}
}
});
anim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
// Update background color
Integer color = (Integer) animator.getAnimatedValue();
// https://code.google.com/p/android/issues/detail?id=77843
if (isSupportCardView) {
// Use setCardBackground() method if it is available
if (setCardBackgroundColor != null) {
try {
setCardBackgroundColor.invoke(sheet, color);
} catch (Exception e) {
// Ignore exceptions since there's no other way set a support CardView's
// background color
}
}
} else // Set background color for all other views
{
view.setBackgroundColor(color);
}
}
});
// Start animation
anim.start();
}
use of android.animation.ArgbEvaluator in project TaEmCasa by Dionen.
the class MenuActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_main);
/* ORGANIZA AS ABAS */
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager = (ViewPager) findViewById(R.id.container);
mViewPager.setAdapter(mSectionsPagerAdapter);
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(mViewPager);
AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbar.getLayoutParams();
// clear all scroll flags
params.setScrollFlags(0);
/* BOTAO DE NOTIFICAÇÃO */
fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View view) {
Snackbar.make(view, "Tem pessoas interessadas em algumas de suas vagas!", Snackbar.LENGTH_LONG).setAction("Action", null).show();
animator.setRepeatCount(1);
Animation fadeout = new AlphaAnimation(1.f, 0.f);
fadeout.setDuration(500);
view.startAnimation(fadeout);
view.postDelayed(new Runnable() {
@Override
public void run() {
view.setVisibility(View.GONE);
}
}, 500);
}
});
/* ANIMAÇÃO DO BOTÃO */
animator = ObjectAnimator.ofInt(fab, "backgroundTint", Color.rgb(255, 0, 0), Color.rgb(255, 255, 255), Color.rgb(255, 0, 0));
animator.setDuration(1000);
animator.setEvaluator(new ArgbEvaluator());
animator.setInterpolator(new DecelerateInterpolator(2));
animator.setRepeatCount(Animation.INFINITE);
animator.addUpdateListener(new ObjectAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
int animatedValue = (int) animation.getAnimatedValue();
fab.setBackgroundTintList(ColorStateList.valueOf(animatedValue));
}
});
animator.start();
/* RECEBE OS DADOS DO USUÁRIO */
Intent intent = getIntent();
user_id = intent.getStringExtra("user_id");
user_nome = intent.getStringExtra("nome");
user_sobrenome = intent.getStringExtra("sobrenome");
user_email = intent.getStringExtra("email");
Toast toast = Toast.makeText(MenuActivity.this, "Olá, " + user_nome + " " + user_sobrenome + "!\nSeu ID: " + user_id + "\nSeu email: " + user_email, Toast.LENGTH_LONG);
toast.show();
}
use of android.animation.ArgbEvaluator in project coursera-android by aporter.
the class ValueAnimatorActivity method startAnimation.
public void startAnimation() {
final ImageView imageView = (ImageView) findViewById(R.id.image_view);
ValueAnimator anim = ValueAnimator.ofObject(new ArgbEvaluator(), RED, BLUE);
anim.addUpdateListener(new AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
imageView.setBackgroundColor((Integer) animation.getAnimatedValue());
}
});
anim.setDuration(10000);
anim.start();
}
use of android.animation.ArgbEvaluator in project ahbottomnavigation by aurelhubert.
the class AHHelper method updateDrawableColor.
/**
* Update image view color with animation
*/
public static void updateDrawableColor(final Context context, final Drawable drawable, final ImageView imageView, @ColorInt int fromColor, @ColorInt int toColor, final boolean forceTint) {
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), fromColor, toColor);
colorAnimation.setDuration(150);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
imageView.setImageDrawable(AHHelper.getTintDrawable(drawable, (Integer) animator.getAnimatedValue(), forceTint));
imageView.requestLayout();
}
});
colorAnimation.start();
}
Aggregations