use of android.view.animation.AlphaAnimation in project Lazy by l123456789jy.
the class ViewAnimationUtils method goneViewByAlpha.
/**
* 将给定视图渐渐隐去最后从界面中移除(view.setVisibility(View.GONE))
*
* @param view 被处理的视图
* @param durationMillis 持续时间,毫秒
* @param isBanClick 在执行动画的过程中是否禁止点击
* @param animationListener 动画监听器
*/
public static void goneViewByAlpha(final View view, long durationMillis, final boolean isBanClick, final AnimationListener animationListener) {
if (view.getVisibility() != View.GONE) {
view.setVisibility(View.GONE);
AlphaAnimation hiddenAlphaAnimation = AnimationUtils.getHiddenAlphaAnimation(durationMillis);
hiddenAlphaAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
if (isBanClick) {
view.setClickable(false);
}
if (animationListener != null) {
animationListener.onAnimationStart(animation);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
if (animationListener != null) {
animationListener.onAnimationRepeat(animation);
}
}
@Override
public void onAnimationEnd(Animation animation) {
if (isBanClick) {
view.setClickable(true);
}
if (animationListener != null) {
animationListener.onAnimationEnd(animation);
}
}
});
view.startAnimation(hiddenAlphaAnimation);
}
}
use of android.view.animation.AlphaAnimation in project SmartAndroidSource by jaychou2012.
the class DragGridView method animateDragged.
// EVENT HELPERS
protected void animateDragged() {
View v = getChildAt(dragged);
int x = getCoorFromIndex(dragged).x + childSize / 2, y = getCoorFromIndex(dragged).y + childSize / 2;
int l = x - (3 * childSize / 4), t = y - (3 * childSize / 4);
v.layout(l, t, l + (childSize * 3 / 2), t + (childSize * 3 / 2));
AnimationSet animSet = new AnimationSet(true);
ScaleAnimation scale = new ScaleAnimation(.667f, 1, .667f, 1, childSize * 3 / 4, childSize * 3 / 4);
scale.setDuration(animT);
AlphaAnimation alpha = new AlphaAnimation(1, .5f);
alpha.setDuration(animT);
animSet.addAnimation(scale);
animSet.addAnimation(alpha);
animSet.setFillEnabled(true);
animSet.setFillAfter(true);
v.clearAnimation();
v.startAnimation(animSet);
}
use of android.view.animation.AlphaAnimation in project SmartAndroidSource by jaychou2012.
the class DragGridViewPager method animateDragged.
private void animateDragged() {
if (mLastDragged >= 0) {
final View v = getChildAt(mLastDragged);
final Rect r = new Rect(v.getLeft(), v.getTop(), v.getRight(), v.getBottom());
r.inset(-r.width() / 20, -r.height() / 20);
v.measure(MeasureSpec.makeMeasureSpec(r.width(), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(r.height(), MeasureSpec.EXACTLY));
v.layout(r.left, r.top, r.right, r.bottom);
AnimationSet animSet = new AnimationSet(true);
ScaleAnimation scale = new ScaleAnimation(0.9091f, 1, 0.9091f, 1, v.getWidth() / 2, v.getHeight() / 2);
scale.setDuration(ANIMATION_DURATION);
AlphaAnimation alpha = new AlphaAnimation(1, .5f);
alpha.setDuration(ANIMATION_DURATION);
animSet.addAnimation(scale);
animSet.addAnimation(alpha);
animSet.setFillEnabled(true);
animSet.setFillAfter(true);
v.clearAnimation();
v.startAnimation(animSet);
}
}
use of android.view.animation.AlphaAnimation in project musicbrainz-android by jdamcd.
the class FadeImageView method fadeIn.
private void fadeIn() {
AlphaAnimation fadeIn = new AlphaAnimation(0, 1);
fadeIn.setDuration(DURATION);
startAnimation(fadeIn);
}
use of android.view.animation.AlphaAnimation in project Signal-Android by WhisperSystems.
the class HidingLinearLayout method show.
public void show() {
if (!isEnabled() || getVisibility() == VISIBLE)
return;
setVisibility(VISIBLE);
AnimationSet animation = new AnimationSet(true);
animation.addAnimation(new ScaleAnimation(0, 1, 1, 1, Animation.RELATIVE_TO_SELF, 1f, Animation.RELATIVE_TO_SELF, 0.5f));
animation.addAnimation(new AlphaAnimation(0, 1));
animation.setDuration(100);
animateWith(animation);
}
Aggregations