use of com.nineoldandroids.animation.ObjectAnimator in project Rashr by DsLNeXuS.
the class CardStack method getClickListener.
private OnClickListener getClickListener(final CardStack cardStack, final RelativeLayout container, final int index) {
return new OnClickListener() {
@Override
public void onClick(View v) {
// init views array
View[] views = new View[container.getChildCount()];
for (int i = 0; i < views.length; i++) {
views[i] = container.getChildAt(i);
}
int last = views.length - 1;
if (index != last) {
if (index == 0) {
onClickFirstCard(cardStack, container, index, views);
} else if (index < last) {
onClickOtherCard(cardStack, container, index, views, last);
}
}
}
public void onClickFirstCard(final CardStack cardStack, final RelativeLayout frameLayout, final int index, View[] views) {
// run through all the cards
for (int i = 0; i < views.length; i++) {
ObjectAnimator anim = null;
if (i == 0) {
// the first goes all the way down
float downFactor = 0;
if (views.length > 2) {
downFactor = convertDpToPixel((_45F) * (views.length - 1) - 1);
} else {
downFactor = convertDpToPixel(_45F);
}
anim = ObjectAnimator.ofFloat(views[i], NINE_OLD_TRANSLATION_Y, 0, downFactor);
anim.addListener(getAnimationListener(cardStack, frameLayout, index, views[index]));
} else if (i == 1) {
// the second goes up just a bit
float upFactor = convertDpToPixel(-17f);
anim = ObjectAnimator.ofFloat(views[i], NINE_OLD_TRANSLATION_Y, 0, upFactor);
} else {
// the rest go up by one card
float upFactor = convertDpToPixel(-1 * _45F);
anim = ObjectAnimator.ofFloat(views[i], NINE_OLD_TRANSLATION_Y, 0, upFactor);
}
if (anim != null)
anim.start();
}
}
public void onClickOtherCard(final CardStack cardStack, final RelativeLayout frameLayout, final int index, View[] views, int last) {
// if clicked card is in middle
for (int i = index; i <= last; i++) {
// run through the cards from the clicked position
// and on until the end
ObjectAnimator anim = null;
if (i == index) {
// the selected card goes all the way down
float downFactor = convertDpToPixel(_45F * (last - i) + _12F);
anim = ObjectAnimator.ofFloat(views[i], NINE_OLD_TRANSLATION_Y, 0, downFactor);
anim.addListener(getAnimationListener(cardStack, frameLayout, index, views[index]));
} else {
// the rest go up by one
float upFactor = convertDpToPixel(_45F * -1);
anim = ObjectAnimator.ofFloat(views[i], NINE_OLD_TRANSLATION_Y, 0, upFactor);
}
if (anim != null)
anim.start();
}
}
};
}
use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.
the class MenuRVAdapter method animation.
private void animation(MenuVH menuVH) {
ViewHelper.setAlpha(menuVH.itemView, 0);
ViewHelper.setTranslationY(menuVH.itemView, 300);
ObjectAnimator translationY = ObjectAnimator.ofFloat(menuVH.itemView, "translationY", 500, 0);
translationY.setDuration(300);
translationY.setInterpolator(new OvershootInterpolator(1.6f));
ObjectAnimator alphaIn = ObjectAnimator.ofFloat(menuVH.itemView, "alpha", 0, 1);
alphaIn.setDuration(100);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(translationY, alphaIn);
animatorSet.setStartDelay(30 * menuVH.getAdapterPosition());
animatorSet.start();
}
use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.
the class Delegate method dismissShowdown.
/**
* 隐藏模糊背景
*/
protected void dismissShowdown() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(mBg, "alpha", 1, 0);
objectAnimator.setDuration(400);
objectAnimator.start();
objectAnimator.addListener(new SimpleAnimationListener() {
@Override
public void onAnimationEnd(Animator animation) {
mParentVG.removeView(mBg);
}
});
}
use of com.nineoldandroids.animation.ObjectAnimator in project AndroidSweetSheet by zzz40500.
the class IndicatorView method alphaShow.
public void alphaShow(boolean isAnimation) {
if (isAnimation) {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "alpha", 0, 1);
objectAnimator.setDuration(300);
objectAnimator.start();
} else {
ViewHelper.setAlpha(this, 1);
}
}
use of com.nineoldandroids.animation.ObjectAnimator in project MaterialCalendar by Haoxiqiang.
the class MemoFragment method release.
void release() {
ObjectAnimator objectAnimator = ObjectAnimator.ofInt(mBluePair, "bottom", mBluePair.getBottom(), startBluePairBottom);
objectAnimator.addListener(new SimpleListener() {
@Override
public void onAnimationEnd(Animator animator) {
disappearBluePair();
}
});
objectAnimator.setInterpolator(ACCELERATE_DECELERATE);
objectAnimator.start();
}
Aggregations