use of android.support.v4.view.ViewPropertyAnimatorListenerAdapter in project philm by chrisbanes.
the class FloatLabelLayout method hideLabel.
/**
* Hide the label
*/
private void hideLabel(boolean animate) {
if (animate) {
float scale = mEditText.getTextSize() / mLabel.getTextSize();
ViewCompat.setScaleX(mLabel, 1f);
ViewCompat.setScaleY(mLabel, 1f);
ViewCompat.setTranslationY(mLabel, 0f);
ViewCompat.animate(mLabel).translationY(mLabel.getHeight()).setDuration(ANIMATION_DURATION).scaleX(scale).scaleY(scale).setListener(new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
mLabel.setVisibility(INVISIBLE);
mEditText.setHint(mHint);
}
}).setInterpolator(mInterpolator).start();
} else {
mLabel.setVisibility(INVISIBLE);
mEditText.setHint(mHint);
}
}
use of android.support.v4.view.ViewPropertyAnimatorListenerAdapter in project MaterialViewPager by florent37.
the class MaterialViewPagerImageHelper method setImageDrawable.
/**
* change the image with a fade
*
* @param drawable
* @param fadeDuration
*/
public static void setImageDrawable(final ImageView imageView, final Drawable drawable, final int fadeDuration) {
final float alpha = ViewCompat.getAlpha(imageView);
final ImageView viewToAnimate = imageView;
fadeOut(viewToAnimate, fadeDuration, new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
super.onAnimationEnd(view);
//change the image when alpha=0
imageView.setImageDrawable(drawable);
//then fade to alpha=1
fadeIn(viewToAnimate, alpha, fadeDuration, new ViewPropertyAnimatorListenerAdapter());
}
});
}
use of android.support.v4.view.ViewPropertyAnimatorListenerAdapter in project MaterialViewPager by florent37.
the class MaterialViewPagerImageHelper method setImageUrl.
/**
* change the image with a fade
*
* @param urlImage
* @param fadeDuration TODO : remove Picasso
*/
public static void setImageUrl(final ImageView imageView, final String urlImage, final int fadeDuration) {
final float alpha = ViewCompat.getAlpha(imageView);
final ImageView viewToAnimate = imageView;
//fade to alpha=0
fadeOut(viewToAnimate, fadeDuration, new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
super.onAnimationEnd(view);
//change the image when alpha=0
Glide.with(imageView.getContext()).load(urlImage).centerCrop().listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
//then fade to alpha=1
fadeIn(viewToAnimate, alpha, fadeDuration, new ViewPropertyAnimatorListenerAdapter());
if (imageLoadListener != null) {
imageLoadListener.OnImageLoad(imageView, ((BitmapDrawable) imageView.getDrawable()).getBitmap());
}
return false;
}
}).into(viewToAnimate);
}
});
}
use of android.support.v4.view.ViewPropertyAnimatorListenerAdapter in project easy by MehdiBenmesa.
the class MaterialViewPagerImageHelper method setImageDrawable.
/**
* change the image with a fade
*
* @param drawable
* @param fadeDuration
*/
public static void setImageDrawable(final ImageView imageView, final Drawable drawable, final int fadeDuration) {
final float alpha = ViewCompat.getAlpha(imageView);
final ImageView viewToAnimate = imageView;
fadeOut(viewToAnimate, fadeDuration, new ViewPropertyAnimatorListenerAdapter() {
@Override
public void onAnimationEnd(View view) {
super.onAnimationEnd(view);
//change the image when alpha=0
imageView.setImageDrawable(drawable);
//then fade to alpha=1
fadeIn(viewToAnimate, alpha, fadeDuration, new ViewPropertyAnimatorListenerAdapter());
}
});
}
Aggregations