android.view.View#getAnimation ( )源码实例Demo

下面列出了android.view.View#getAnimation ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: appcan-android   文件: EBrowserWindow.java
public void removeViewFromCurrentWindow(View child) {
//        Message msg = mWindLoop.obtainMessage();
//        msg.what = F_WHANDLER_REMOVE_VIEW;
//        msg.obj = child;
//        mWindLoop.sendMessage(msg);
//         Animation removeAnim = child.getAnimation();
//         if (null != removeAnim) {
//         removeAnim.start();
//         }
//         removeView(child);

//        View children = (View) msg.obj;
        Animation removeAnim = child.getAnimation();
        if (null != removeAnim) {
            removeAnim.start();
        }
        removeViewList(child);
//        msg.obj = null;
    }
 
源代码2 项目: sa-sdk-android   文件: ViewUtil.java
@SuppressLint("NewApi")
public static boolean isViewSelfVisible(View view) {
    if (view == null || view.getWindowVisibility() == View.GONE) {
        return false;
    }
    if (WindowHelper.isDecorView(view.getClass())) {
        return true;
    }
    if (view.getWidth() <= 0 || view.getHeight() <= 0 || view.getAlpha() <= 0.0f || !view.getLocalVisibleRect(new Rect())) {
        return false;
    }
    if ((view.getVisibility() == View.VISIBLE || view.getAnimation() == null || !view.getAnimation().getFillAfter()) && view.getVisibility() != View.VISIBLE) {
        return false;
    }
    return true;
}
 
源代码3 项目: UltimateAndroid   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码4 项目: imsdk-android   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码5 项目: Popeens-DSub   文件: FadeOutAnimation.java
/**
 * Creates and starts the fade out animation.
 *
 * @param view           The view to fade out (or display).
 * @param fadeOut        If true, the view is faded out. Otherwise it is immediately made visible.
 * @param durationMillis Fade duration.
 */
public static void createAndStart(View view, boolean fadeOut, long durationMillis) {
    if (fadeOut) {
        view.clearAnimation();
        view.startAnimation(new FadeOutAnimation(view, durationMillis));
    } else {
        Animation animation = view.getAnimation();
        if (animation instanceof FadeOutAnimation) {
            ((FadeOutAnimation) animation).cancelFadeOut();
        }
        view.clearAnimation();
        view.setVisibility(View.VISIBLE);
    }
}
 
源代码6 项目: AndroidNavigation   文件: SwipeBackLayout.java
@Override
public boolean tryCaptureView(@NonNull View view, int pointerId) {
    if (view.getAnimation() != null) {
        return false;
    }

    boolean ret = mDragHelper.isEdgeTouched(ViewDragHelper.EDGE_LEFT, pointerId);
    boolean directionCheck = !mDragHelper.checkTouchSlop(ViewDragHelper.DIRECTION_VERTICAL, pointerId);
    return mDragHelper.getViewDragState() != ViewDragHelper.STATE_SETTLING && (ret & directionCheck);
}
 
@Override
public void showOnlyNoAnimation(final int previousIndex, final int childIndex) {
    for (int i = 0; i < parent.getChildCount(); i++) {
        View child = parent.getChildAt(i);
        child.setVisibility(i == childIndex ? View.VISIBLE : View.GONE);
        if (child.getAnimation() == parent.mInAnimation) {
            parent.mInAnimation.setAnimationListener(null);
            child.clearAnimation();
        } else if (child.getAnimation() == parent.mOutAnimation) {
            child.clearAnimation();
        }
    }
}
 
@Override
public void showOnly(final int previousChild, final int childIndex, @Nullable final Point origin) {
    if (DBG) {
        Log.i(TAG, "showOnly: " + previousChild + " >> " + childIndex);
    }

    parent.mInAnimation.setAnimationListener(new MyAnimationListener(previousChild, childIndex));

    final int count = parent.getChildCount();
    for (int i = 0; i < count; i++) {
        final View child = parent.getChildAt(i);
        if (i == childIndex) {
            if (parent.mInAnimation != null) {
                child.startAnimation(parent.mInAnimation);
            }
            child.setVisibility(View.VISIBLE);
            parent.mFirstTime = false;
        } else {
            if (parent.mOutAnimation != null && child.getVisibility() == View.VISIBLE) {
                child.startAnimation(parent.mOutAnimation);
            } else if (child.getAnimation() == parent.mInAnimation) {
                parent.mInAnimation.setAnimationListener(null);
                child.clearAnimation();
            }
            child.setVisibility(View.GONE);
        }
    }
}
 
源代码9 项目: SmoothRefreshLayout   文件: SmoothRefreshLayout.java
protected View ensureScrollTargetView(View target, boolean noTransform, float x, float y) {
    if (target instanceof IRefreshView
            || target.getVisibility() != VISIBLE
            || target.getAnimation() != null) {
        return null;
    }
    if (isScrollingView(target)) {
        return target;
    }
    if (target instanceof ViewGroup) {
        ViewGroup group = (ViewGroup) target;
        final int count = group.getChildCount();
        for (int i = count - 1; i >= 0; i--) {
            View child = group.getChildAt(i);
            if (noTransform || isTransformedTouchPointInView(x, y, group, child)) {
                View view =
                        ensureScrollTargetView(
                                child,
                                noTransform,
                                x + mCachedFloatPoint[0],
                                y + mCachedFloatPoint[1]);
                if (view != null) {
                    return view;
                }
            }
        }
    }
    return null;
}
 
源代码10 项目: ripple   文件: AnimationHelpers.java
static void addAnimation(View view, Animation animation, boolean first) {
    Animation previousAnimation = view.getAnimation();
    if (previousAnimation == null || previousAnimation.getClass() == animation.getClass()) {
        if (animation.getStartTime() == Animation.START_ON_FIRST_FRAME)
            view.startAnimation(animation);
        else
            view.setAnimation(animation);
        return;
    }

    if (!(previousAnimation instanceof AnimationSet)) {
        AnimationSet newSet = new AnimationSet(false);
        newSet.addAnimation(previousAnimation);
        previousAnimation = newSet;
    }

    // Remove old of same type
    //
    AnimationSet set = (AnimationSet) previousAnimation;
    for (int i = 0; i < set.getAnimations().size(); i++) {
        Animation anim = set.getAnimations().get(i);
        if (anim.getClass() == animation.getClass()) {
            set.getAnimations().remove(i);
            break;
        }
    }

    // Add this (first if it is a scale animation ,else at end)
    if (animation instanceof ScaleAnimation || first) {
        set.getAnimations().add(0, animation);
    } else {
        set.getAnimations().add(animation);
    }

    animation.startNow();
    view.setAnimation(set);
}
 
源代码11 项目: mvvm-template   文件: AnimHelper.java
@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);
    }
}
 
源代码12 项目: KJFrameForAndroid   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码13 项目: AndroidLinkup   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码14 项目: Pharmacy-Android   文件: OrdersAdapter.java
private void clearAnimation(View View) {
    View.clearAnimation();
    if (View.getAnimation() != null) {
        View.getAnimation().cancel();
    }

}
 
源代码15 项目: Mover   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码16 项目: android-project-wo2b   文件: AnimatorProxy.java
/**
 * 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;
}
 
源代码17 项目: sa-sdk-android   文件: ViewUtil.java
/**
 * View 自身是否可见
 *
 * @return View 宽、高、透明度 有一个 < 0 时,或 getLocalVisibleRect 为 false 时;返回 false 。
 * View getVisibility 不可见,且有 Animation getFillAfter 为  false 时;返回 false 。
 * View 无 Animation 时 getVisibility 不可见时返回 false 。
 */
@RequiresApi(api = 11)
public static boolean isViewSelfVisible(View view) {
    if (view == null) {
        return false;
    }
    if (view.getWidth() <= 0 || view.getHeight() <= 0 || view.getAlpha() <= 0.0f || !view.getLocalVisibleRect(new Rect())) {
        return false;
    }
    return (view.getVisibility() != VISIBLE && view.getAnimation() != null && view.getAnimation().getFillAfter()) || view.getVisibility() == VISIBLE;
}
 
源代码18 项目: android-empty-layout   文件: EmptyLayout.java
private void changeEmptyType() {
	
	setDefaultValues();
	refreshMessages();

	// insert views in the root view
	if (!mViewsAdded) {
		RelativeLayout.LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
		lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
		lp.addRule(RelativeLayout.CENTER_VERTICAL);
		RelativeLayout rl = new RelativeLayout(mContext);
		rl.setLayoutParams(lp);
		if (mEmptyView!=null) rl.addView(mEmptyView);
		if (mLoadingView!=null) rl.addView(mLoadingView);
		if (mErrorView!=null) rl.addView(mErrorView);
		mViewsAdded = true;			

		ViewGroup parent = (ViewGroup) mListView.getParent();
		parent.addView(rl);
		mListView.setEmptyView(rl);
	}
	
	
	// change empty type
	if (mListView!=null) {
		View loadingAnimationView = null;
		if (mLoadingAnimationViewId > 0) loadingAnimationView = ((Activity) mContext).findViewById(mLoadingAnimationViewId); 
		switch (mEmptyType) {
		case TYPE_EMPTY:
			if (mEmptyView!=null) mEmptyView.setVisibility(View.VISIBLE);
			if (mErrorView!=null) mErrorView.setVisibility(View.GONE);
			if (mLoadingView!=null) {
				mLoadingView.setVisibility(View.GONE); 
				if (loadingAnimationView!=null && loadingAnimationView.getAnimation()!=null) loadingAnimationView.getAnimation().cancel();
			}
			break;
		case TYPE_ERROR:
			if (mEmptyView!=null) mEmptyView.setVisibility(View.GONE);
			if (mErrorView!=null) mErrorView.setVisibility(View.VISIBLE);
			if (mLoadingView!=null) {
				mLoadingView.setVisibility(View.GONE); 
				if (loadingAnimationView!=null && loadingAnimationView.getAnimation()!=null) loadingAnimationView.getAnimation().cancel();
			}
			break;
		case TYPE_LOADING:
			if (mEmptyView!=null) mEmptyView.setVisibility(View.GONE);
			if (mErrorView!=null) mErrorView.setVisibility(View.GONE);
			if (mLoadingView!=null) {
				mLoadingView.setVisibility(View.VISIBLE);
				if (mLoadingAnimation != null && loadingAnimationView!=null) {
					loadingAnimationView.startAnimation(mLoadingAnimation);
				}
				else if (loadingAnimationView!=null) {
					loadingAnimationView.startAnimation(getRotateAnimation());
				}
			}				
			break;
		default:
			break;
		}
	}
}
 
源代码19 项目: AndroidEmptyLayout   文件: EmptyLayout.java
private void changeEmptyType() {

        setDefaultValues();
        refreshMessages();

        // insert views in the root view
        if (!mViewsAdded) {
            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
            lp.addRule(RelativeLayout.CENTER_IN_PARENT);
            mEmptyRelativeLayout = new RelativeLayout(getContext());
            mEmptyRelativeLayout.setGravity(Gravity.CENTER);
            mEmptyRelativeLayout.setLayoutParams(lp);
            if (mEmptyView!=null) mEmptyRelativeLayout.addView(mEmptyView);
            if (mLoadingView!=null) mEmptyRelativeLayout.addView(mLoadingView);
            if (mErrorView!=null) mEmptyRelativeLayout.addView(mErrorView);
            mViewsAdded = true;
            mEmptyRelativeLayout.setVisibility(VISIBLE);
            addView(mEmptyRelativeLayout);
        }


        // change empty type
            View loadingAnimationView = null;
            if (mLoadingAnimationViewId > 0) loadingAnimationView = findViewById(mLoadingAnimationViewId);
            switch (mEmptyType) {
                case TYPE_EMPTY:
                    if (mEmptyView!=null) mEmptyView.setVisibility(View.VISIBLE);
                    if (mErrorView!=null) mErrorView.setVisibility(View.GONE);
                    if (mLoadingView!=null) {
                        mLoadingView.setVisibility(View.GONE);
                        if (loadingAnimationView!=null && loadingAnimationView.getAnimation()!=null) loadingAnimationView.getAnimation().cancel();
                    }
                    break;
                case TYPE_ERROR:
                    if (mEmptyView!=null) mEmptyView.setVisibility(View.GONE);
                    if (mErrorView!=null) mErrorView.setVisibility(View.VISIBLE);
                    if (mLoadingView!=null) {
                        mLoadingView.setVisibility(View.GONE);
                        if (loadingAnimationView!=null && loadingAnimationView.getAnimation()!=null) loadingAnimationView.getAnimation().cancel();
                    }
                    break;
                case TYPE_LOADING:
                    if (mEmptyView!=null) mEmptyView.setVisibility(View.GONE);
                    if (mErrorView!=null) mErrorView.setVisibility(View.GONE);
                    if (mLoadingView!=null) {
                        mLoadingView.setVisibility(View.VISIBLE);
                        if (mLoadingAnimation != null && loadingAnimationView!=null) {
                            loadingAnimationView.startAnimation(mLoadingAnimation);
                        }
                        else if (loadingAnimationView!=null) {
                            loadingAnimationView.startAnimation(getRotateAnimation());
                        }
                    }
                    break;
                default:
                    break;
            }
    }
 
源代码20 项目: px-android   文件: ViewUtils.java
public static void cancelAnimation(@NonNull final View targetView) {
    final Animation animation = targetView.getAnimation();
    if (animation != null) {
        animation.cancel();
    }
}
 
 方法所在类
 同类方法