use of android.view.animation.AlphaAnimation in project mobile-android by photo.
the class IapNotificationLayout method hide.
public void hide(long delayMillis) {
if (getHandler() == null)
return;
if (getParent() == null)
return;
if (getVisibility() == View.GONE)
return;
AnimationListener listener = new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
setVisibility(View.GONE);
}
};
float currentAlpha = 1.0f;
final Animation animation = getAnimation();
if (animation != null) {
if (animation instanceof CustomAlphaAnimation) {
currentAlpha = ((CustomAlphaAnimation) animation).getAlpha();
}
getAnimation().setAnimationListener(null);
clearAnimation();
}
Animation newAnimation = new AlphaAnimation(currentAlpha, 0);
newAnimation.setDuration(mIapHideDuration);
newAnimation.setStartOffset(delayMillis);
newAnimation.setAnimationListener(listener);
startAnimation(newAnimation);
}
use of android.view.animation.AlphaAnimation in project MaterialNavigationDrawer by neokree.
the class Utils method setAlpha.
public static void setAlpha(View v, float alpha) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
v.setAlpha(alpha);
} else {
AlphaAnimation animation = new AlphaAnimation(alpha, alpha);
animation.setDuration(0);
animation.setFillAfter(true);
v.startAnimation(animation);
}
}
use of android.view.animation.AlphaAnimation in project mobile-android by photo.
the class FeatherActivity method createInfoScreenAnimations.
/**
* Creates the info screen animations.
*
* @param isOpening
* the is opening
*/
private void createInfoScreenAnimations(final boolean isOpening) {
final float centerX = mViewFlipper.getWidth() / 2.0f;
final float centerY = mViewFlipper.getHeight() / 2.0f;
Animation mMainViewAnimationIn, mMainViewAnimationOut;
final int duration = getResources().getInteger(R.integer.feather_config_infoscreen_animTime);
// we allow the flip3d animation only if the OS is > android 2.2
if (android.os.Build.VERSION.SDK_INT > 8) {
mMainViewAnimationIn = new Flip3dAnimation(isOpening ? -180 : 180, 0, centerX, centerY);
mMainViewAnimationOut = new Flip3dAnimation(0, isOpening ? 180 : -180, centerX, centerY);
mMainViewAnimationIn.setDuration(duration);
mMainViewAnimationOut.setDuration(duration);
} else {
// otherwise let's just use a regular alpha animation
mMainViewAnimationIn = new AlphaAnimation(0.0f, 1.0f);
mMainViewAnimationOut = new AlphaAnimation(1.0f, 0.0f);
mMainViewAnimationIn.setDuration(duration / 2);
mMainViewAnimationOut.setDuration(duration / 2);
}
mViewFlipper.setInAnimation(mMainViewAnimationIn);
mViewFlipper.setOutAnimation(mMainViewAnimationOut);
}
use of android.view.animation.AlphaAnimation in project mobile-android by photo.
the class FeatherActivity method hideProgressLoader.
/**
* Hide progress loader.
*/
private void hideProgressLoader() {
Animation fadeout = new AlphaAnimation(1, 0);
fadeout.setDuration(getResources().getInteger(R.integer.feather_config_mediumAnimTime));
fadeout.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
mInlineProgressLoader.setVisibility(View.GONE);
}
});
mInlineProgressLoader.startAnimation(fadeout);
}
use of android.view.animation.AlphaAnimation in project QLibrary by DragonsQC.
the class AnimationUtils method getAlphaAnimation.
/**
* 获取一个透明度渐变动画
*
* @param fromAlpha 开始时的透明度
* @param toAlpha 结束时的透明度都
* @param durationMillis 持续时间
* @param animationListener 动画监听器
* @return 一个透明度渐变动画
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, long durationMillis, AnimationListener animationListener) {
AlphaAnimation alphaAnimation = new AlphaAnimation(fromAlpha, toAlpha);
alphaAnimation.setDuration(durationMillis);
if (animationListener != null) {
alphaAnimation.setAnimationListener(animationListener);
}
return alphaAnimation;
}
Aggregations