use of android.support.v4.view.ViewPropertyAnimatorListener in project animate by hitherejoe.
the class ForegroundFrame method addContentView.
private void addContentView(FrameLayout container) {
inflate(getContext(), R.layout.layout_frame, this);
FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_quiz);
floatingActionButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
ViewPropertyAnimatorCompat animatorCompat = buildAnimation(v);
animatorCompat.setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
}
@Override
public void onAnimationEnd(View view) {
doStuff();
}
@Override
public void onAnimationCancel(View view) {
}
});
}
});
}
use of android.support.v4.view.ViewPropertyAnimatorListener in project BottomNavigation by Ashok-Varma.
the class BadgeItem method hide.
/**
* @param animate whether to animate the change
* @return this, to allow builder pattern
*/
public BadgeItem hide(boolean animate) {
mIsHidden = true;
if (isWeakReferenceValid()) {
TextView textView = mTextViewRef.get();
if (animate) {
ViewPropertyAnimatorCompat animatorCompat = ViewCompat.animate(textView);
animatorCompat.cancel();
animatorCompat.setDuration(mAnimationDuration);
animatorCompat.scaleX(0).scaleY(0);
animatorCompat.setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
// Empty body
}
@Override
public void onAnimationEnd(View view) {
view.setVisibility(View.GONE);
}
@Override
public void onAnimationCancel(View view) {
view.setVisibility(View.GONE);
}
});
animatorCompat.start();
} else {
textView.setVisibility(View.GONE);
}
}
return this;
}
use of android.support.v4.view.ViewPropertyAnimatorListener in project android-advancedrecyclerview by h6ah4i.
the class BaseDraggableItemDecorator method moveToDefaultPosition.
protected void moveToDefaultPosition(View targetView, float initialScale, float initialRotation, float initialAlpha, boolean animate) {
final float initialTranslationZ = ViewCompat.getTranslationZ(targetView);
final float durationFactor = determineMoveToDefaultPositionAnimationDurationFactor(targetView, initialScale, initialRotation, initialAlpha);
final int animDuration = (int) (mReturnToDefaultPositionDuration * durationFactor);
if (supportsViewPropertyAnimation() && animate && (animDuration > RETURN_TO_DEFAULT_POS_ANIMATE_THRESHOLD_MSEC)) {
ViewPropertyAnimatorCompat animator = ViewCompat.animate(targetView);
ViewCompat.setScaleX(targetView, initialScale);
ViewCompat.setScaleY(targetView, initialScale);
ViewCompat.setRotation(targetView, initialRotation);
ViewCompat.setAlpha(targetView, initialAlpha);
// to render on top of other items
ViewCompat.setTranslationZ(targetView, initialTranslationZ + 1);
animator.cancel();
animator.setDuration(animDuration);
animator.setInterpolator(mReturnToDefaultPositionInterpolator);
animator.translationX(0.0f);
animator.translationY(0.0f);
animator.translationZ(initialTranslationZ);
animator.alpha(1.0f);
animator.rotation(0);
animator.scaleX(1.0f);
animator.scaleY(1.0f);
animator.setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
}
@Override
public void onAnimationEnd(View view) {
ViewPropertyAnimatorCompat animator = ViewCompat.animate(view);
animator.setListener(null);
resetDraggingItemViewEffects(view, initialTranslationZ);
// invalidate explicitly to refresh other decorations
if (view.getParent() instanceof RecyclerView) {
ViewCompat.postInvalidateOnAnimation((RecyclerView) view.getParent());
}
}
@Override
public void onAnimationCancel(View view) {
}
});
animator.start();
} else {
resetDraggingItemViewEffects(targetView, initialTranslationZ);
}
}
use of android.support.v4.view.ViewPropertyAnimatorListener in project ToolBarLib by jjhesk.
the class AnimationUtil method fadeInView.
public static void fadeInView(View view, int duration, final AnimationListener listener) {
view.setVisibility(View.VISIBLE);
view.setAlpha(0f);
ViewPropertyAnimatorListener vpListener = null;
if (listener != null) {
vpListener = new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
if (!listener.onAnimationStart(view)) {
//execute Parent MEthod
view.setDrawingCacheEnabled(true);
}
}
@Override
public void onAnimationEnd(View view) {
if (!listener.onAnimationEnd(view)) {
//execute Parent MEthod
view.setDrawingCacheEnabled(false);
}
}
@Override
public void onAnimationCancel(View view) {
if (!listener.onAnimationCancel(view)) {
//execute Parent MEthod
}
}
};
}
ViewCompat.animate(view).alpha(1f).setDuration(duration).setListener(vpListener);
}
use of android.support.v4.view.ViewPropertyAnimatorListener in project Reader by TheKeeperOfPie.
the class FragmentComments method showLayoutActions.
private void showLayoutActions() {
for (int index = layoutActions.getChildCount() - 1; index >= 0; index--) {
final View view = layoutActions.getChildAt(index);
view.setVisibility(View.VISIBLE);
final int finalIndex = index;
ViewCompat.animate(view).alpha(1f).scaleX(1f).scaleY(1f).setInterpolator(fastOutSlowInInterpolator).setDuration(DURATION_ACTIONS_FADE).setStartDelay((long) ((layoutActions.getChildCount() - 1 - index) * DURATION_ACTIONS_FADE * OFFSET_MODIFIER)).setListener(new ViewPropertyAnimatorListener() {
@Override
public void onAnimationStart(View view) {
if (finalIndex == 0) {
buttonExpandActions.setImageResource(android.R.color.transparent);
}
}
@Override
public void onAnimationEnd(View view) {
}
@Override
public void onAnimationCancel(View view) {
}
}).start();
}
}
Aggregations