Java Code Examples for android.view.View.getAnimation()

The following are Jave code examples for showing how to use getAnimation() of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: LuaViewPlayground   File: AnimatorProxy.java   Source Code and License Vote up 6 votes
/**
 * Create a proxy to allow for modifying post-3.0 view properties on all
 * pre-3.0 platforms. <strong>DO NOT</strong> wrap your views if you are
 * using {@code ObjectAnimator} as it will handle that itself.
 *
 * @param view View to wrap.
 * @return Proxy to post-3.0 properties.
 */
public static AnimatorProxy wrap(View view) {
    AnimatorProxy proxy = PROXIES.get(view);
    // This checks if the proxy already exists and whether it still is the animation of the given view
    if (proxy == null || proxy != view.getAnimation()) {
        proxy = new AnimatorProxy(view);
        PROXIES.put(view, proxy);
    }
    return proxy;
}
 
Example 2
Project: airgram   File: View10.java   Source Code and License Vote up 6 votes
public static View10 wrap(View view) {
    View10 proxy = PROXIES.get(view);
    Animation animation = view.getAnimation();
    if (proxy == null || proxy != animation && animation != null) {
        proxy = new View10(view);
        PROXIES.put(view, proxy);
    } else if (animation == null) {
        view.setAnimation(proxy);
    }
    return proxy;
}
 
Example 3
Project: letv   File: UIs.java   Source Code and License Vote up 6 votes
public static void animTop(Context context, final View view) {
    if (view == null) {
        return;
    }
    if (view.getAnimation() == null || view.getAnimation().hasEnded()) {
        view.post(new Runnable() {
            public void run() {
                UIs.animCollection(view, UIs.collectionAniScaleRec, 0);
            }
        });
    }
}
 
Example 4
Project: exciting-app   File: AnimatorProxy.java   Source Code and License Vote up 6 votes
/**
 * Create a proxy to allow for modifying post-3.0 view properties on all
 * pre-3.0 platforms. <strong>DO NOT</strong> wrap your views if you are
 * using {@code ObjectAnimator} as it will handle that itself.
 *
 * @param view View to wrap.
 * @return Proxy to post-3.0 properties.
 */
public static AnimatorProxy wrap(View view) {
    AnimatorProxy proxy = PROXIES.get(view);
    // This checks if the proxy already exists and whether it still is the animation of the given view
    if (proxy == null || proxy != view.getAnimation()) {
        proxy = new AnimatorProxy(view);
        PROXIES.put(view, proxy);
    }
    return proxy;
}
 
Example 5
Project: mvvm-template   File: AnimHelper.java   Source Code and License Vote up 6 votes
@UiThread public static void startBeatsAnimation(@NonNull View view) {
    view.clearAnimation();
    if (view.getAnimation() != null) {
        view.getAnimation().cancel();
    }
    List<ObjectAnimator> animators = getBeats(view);
    for (ObjectAnimator anim : animators) {
        anim.setDuration(300).start();
        anim.setInterpolator(interpolator);
    }
}
 
Example 6
Project: PlusGram   File: View10.java   Source Code and License Vote up 6 votes
public static View10 wrap(View view) {
    View10 proxy = PROXIES.get(view);
    Animation animation = view.getAnimation();
    if (proxy == null || proxy != animation && animation != null) {
        proxy = new View10(view);
        PROXIES.put(view, proxy);
    } else if (animation == null) {
        view.setAnimation(proxy);
    }
    return proxy;
}
 
Example 7
Project: boohee_v5.6   File: AnimatorProxy.java   Source Code and License Vote up 6 votes
public static AnimatorProxy wrap(View view) {
    Animation proxy = (AnimatorProxy) PROXIES.get(view);
    if (proxy != null && proxy == view.getAnimation()) {
        return proxy;
    }
    AnimatorProxy proxy2 = new AnimatorProxy(view);
    PROXIES.put(view, proxy2);
    return proxy2;
}
 
Example 8
Project: boohee_v5.6   File: StateListAnimator.java   Source Code and License Vote up 6 votes
private void clearTarget() {
    View view = getTarget();
    int size = this.mTuples.size();
    for (int i = 0; i < size; i++) {
        if (view.getAnimation() == ((Tuple) this.mTuples.get(i)).mAnimation) {
            view.clearAnimation();
        }
    }
    this.mViewRef = null;
    this.mLastMatch = null;
    this.mRunningAnimation = null;
}
 
Example 9
Project: boohee_v5.6   File: StateListAnimator.java   Source Code and License Vote up 6 votes
private void cancel() {
    if (this.mRunningAnimation != null) {
        View view = getTarget();
        if (view != null && view.getAnimation() == this.mRunningAnimation) {
            view.clearAnimation();
        }
        this.mRunningAnimation = null;
    }
}
 
Example 10
Project: boohee_v5.6   File: StateListAnimator.java   Source Code and License Vote up 6 votes
public void jumpToCurrentState() {
    if (this.mRunningAnimation != null) {
        View view = getTarget();
        if (view != null && view.getAnimation() == this.mRunningAnimation) {
            view.clearAnimation();
        }
    }
}
 
Example 11
Project: android-project-gallery   File: AnimatorProxy.java   Source Code and License Vote up 6 votes
/**
 * Create a proxy to allow for modifying post-3.0 view properties on all
 * pre-3.0 platforms. <strong>DO NOT</strong> wrap your views if you are
 * using {@code ObjectAnimator} as it will handle that itself.
 *
 * @param view View to wrap.
 * @return Proxy to post-3.0 properties.
 */
public static AnimatorProxy wrap(View view) {
    AnimatorProxy proxy = PROXIES.get(view);
    // This checks if the proxy already exists and whether it still is the animation of the given view
    if (proxy == null || proxy != view.getAnimation()) {
        proxy = new AnimatorProxy(view);
        PROXIES.put(view, proxy);
    }
    return proxy;
}
 
Example 12
Project: RNLearn_Project1   File: ReactViewGroup.java   Source Code and License Vote up 6 votes
private void updateSubviewClipStatus(Rect clippingRect, int idx, int clippedSoFar) {
  View child = Assertions.assertNotNull(mAllChildren)[idx];
  sHelperRect.set(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
  boolean intersects = clippingRect
      .intersects(sHelperRect.left, sHelperRect.top, sHelperRect.right, sHelperRect.bottom);
  boolean needUpdateClippingRecursive = false;
  // We never want to clip children that are being animated, as this can easily break layout :
  // when layout animation changes size and/or position of views contained inside a listview that
  // clips offscreen children, we need to ensure that, when view exits the viewport, final size
  // and position is set prior to removing the view from its listview parent.
  // Otherwise, when view gets re-attached again, i.e when it re-enters the viewport after scroll,
  // it won't be size and located properly.
  Animation animation = child.getAnimation();
  boolean isAnimating = animation != null && !animation.hasEnded();
  if (!intersects && child.getParent() != null && !isAnimating) {
    // We can try saving on invalidate call here as the view that we remove is out of visible area
    // therefore invalidation is not necessary.
    super.removeViewsInLayout(idx - clippedSoFar, 1);
    needUpdateClippingRecursive = true;
  } else if (intersects && child.getParent() == null) {
    super.addViewInLayout(child, idx - clippedSoFar, sDefaultLayoutParam, true);
    invalidate();
    needUpdateClippingRecursive = true;
  } else if (intersects) {
    // If there is any intersection we need to inform the child to update its clipping rect
    needUpdateClippingRecursive = true;
  }
  if (needUpdateClippingRecursive) {
    if (child instanceof ReactClippingViewGroup) {
      // we don't use {@link sHelperRect} until the end of this loop, therefore it's safe
      // to call this method that may write to the same {@link sHelperRect} object.
      ReactClippingViewGroup clippingChild = (ReactClippingViewGroup) child;
      if (clippingChild.getRemoveClippedSubviews()) {
        clippingChild.updateClippingRect();
      }
    }
  }
}
 
Example 13
Project: RNLearn_Project1   File: ReactViewGroup.java   Source Code and License Vote up 6 votes
private void updateSubviewClipStatus(Rect clippingRect, int idx, int clippedSoFar) {
  View child = Assertions.assertNotNull(mAllChildren)[idx];
  sHelperRect.set(child.getLeft(), child.getTop(), child.getRight(), child.getBottom());
  boolean intersects = clippingRect
      .intersects(sHelperRect.left, sHelperRect.top, sHelperRect.right, sHelperRect.bottom);
  boolean needUpdateClippingRecursive = false;
  // We never want to clip children that are being animated, as this can easily break layout :
  // when layout animation changes size and/or position of views contained inside a listview that
  // clips offscreen children, we need to ensure that, when view exits the viewport, final size
  // and position is set prior to removing the view from its listview parent.
  // Otherwise, when view gets re-attached again, i.e when it re-enters the viewport after scroll,
  // it won't be size and located properly.
  Animation animation = child.getAnimation();
  boolean isAnimating = animation != null && !animation.hasEnded();
  if (!intersects && child.getParent() != null && !isAnimating) {
    // We can try saving on invalidate call here as the view that we remove is out of visible area
    // therefore invalidation is not necessary.
    super.removeViewsInLayout(idx - clippedSoFar, 1);
    needUpdateClippingRecursive = true;
  } else if (intersects && child.getParent() == null) {
    super.addViewInLayout(child, idx - clippedSoFar, sDefaultLayoutParam, true);
    invalidate();
    needUpdateClippingRecursive = true;
  } else if (intersects) {
    // If there is any intersection we need to inform the child to update its clipping rect
    needUpdateClippingRecursive = true;
  }
  if (needUpdateClippingRecursive) {
    if (child instanceof ReactClippingViewGroup) {
      // we don't use {@link sHelperRect} until the end of this loop, therefore it's safe
      // to call this method that may write to the same {@link sHelperRect} object.
      ReactClippingViewGroup clippingChild = (ReactClippingViewGroup) child;
      if (clippingChild.getRemoveClippedSubviews()) {
        clippingChild.updateClippingRect();
      }
    }
  }
}
 
Example 14
Project: q-mail   File: NonLockingScrollView.java   Source Code and License Vote up 5 votes
private static boolean canViewReceivePointerEvents(View child) {
    return child.getVisibility() == VISIBLE || (child.getAnimation() != null);
}
 
Example 15
Project: Android-MorphAnimation   File: MorphAnimation.java   Source Code and License Vote up 5 votes
/**
 * Applied height variation
 * Check the following call conditions
 * 1. Call it after type conversion only if the change in the shape of the view is obvious.
 * 2. It should be the parent's existing View.
 * 3. Recommended for code corresponding to user action.
 * 4. Do not change the shape of the target view's animation in external code. However, it is possible to call the morph () method continuously.
 *
 * @param targetView	target view
 * @param mode
 *            input static define value {@link MorphAnimation#ANIMATION_MODE_WIDTH},
 *            {@link MorphAnimation#ANIMATION_MODE_HEIGHT}.
 * @param duration
 *            Animation duration
 */
public static MorphAnimation morph(final View targetView, int mode, int duration) {

	if (targetView != null && targetView.getParent() != null) {
		if (targetView.getAnimation() != null)
			targetView.getAnimation().cancel();

		if (mMorphMap.containsKey(targetView)) {
			MorphAnimation morphAnimation = mMorphMap.get(targetView);
			morphAnimation.mAnimationStep = ANIMATION_STEP_STOP;
			morphAnimation.mTargetView.getViewTreeObserver().removeOnPreDrawListener(morphAnimation);
			mMorphMap.remove(targetView);
		}

		final MorphAnimation morphView = new MorphAnimation(targetView);

		mMorphMap.put(targetView, morphView);

		morphView.mTargetView = targetView;

		morphView.mOriginalVisibility = morphView.mTargetView.getVisibility();

		morphView.mTargetView.setVisibility(View.VISIBLE);

		morphView.mAnimationMode = mode;

		if (duration > 0) {
			morphView.mAnimationDuration = duration;
		}

		LayoutParams params = morphView.mTargetView.getLayoutParams();
		morphView.mOriginalLayoutWidth = params.width;
		morphView.mOriginalLayoutHeight = params.height;

		morphView.mWidth = morphView.mEndWidth = morphView.mTargetView.getMeasuredWidth();
		morphView.mHeight = morphView.mEndHeight = morphView.mTargetView.getMeasuredHeight();
		morphView.mTargetView.getViewTreeObserver().addOnPreDrawListener(morphView);

		return morphView;
	} else {
		return null;
	}
}
 
Example 16
Project: RNLearn_Project1   File: ClippingDrawCommandManager.java   Source Code and License Vote up 5 votes
/**
 * Returns true if a view is currently animating.
 */
private static boolean animating(View view) {
  Animation animation = view.getAnimation();
  return animation != null && !animation.hasEnded();
}
 
Example 17
Project: RNLearn_Project1   File: ClippingDrawCommandManager.java   Source Code and License Vote up 5 votes
/**
 * Returns true if a view is currently animating.
 */
private static boolean animating(View view) {
  Animation animation = view.getAnimation();
  return animation != null && !animation.hasEnded();
}