Search in sources :

Example 51 with RotateAnimation

use of android.view.animation.RotateAnimation in project QLibrary by DragonsQC.

the class AnimationUtils method getRotateAnimation.

/**
     * 获取一个旋转动画
     *
     * @param fromDegrees       开始角度
     * @param toDegrees         结束角度
     * @param pivotXType        旋转中心点X轴坐标相对类型
     * @param pivotXValue       旋转中心点X轴坐标
     * @param pivotYType        旋转中心点Y轴坐标相对类型
     * @param pivotYValue       旋转中心点Y轴坐标
     * @param durationMillis    持续时间
     * @param animationListener 动画监听器
     * @return 一个旋转动画
     */
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation)

Example 52 with RotateAnimation

use of android.view.animation.RotateAnimation in project WordPress-Android by wordpress-mobile.

the class StatsUIHelper method setGroupChevron.

/*
     * shows the correct up/down chevron for the passed group
     */
private static void setGroupChevron(final boolean isGroupExpanded, View groupView, int groupPosition, boolean animate) {
    final ImageView chevron = (ImageView) groupView.findViewById(R.id.stats_list_cell_chevron);
    if (chevron == null) {
        return;
    }
    if (isGroupExpanded) {
        // change the background of the parent
        setViewBackgroundWithoutResettingPadding(groupView, R.drawable.stats_list_item_expanded_background);
    } else {
        setViewBackgroundWithoutResettingPadding(groupView, groupPosition == 0 ? 0 : R.drawable.stats_list_item_background);
    }
    // Remove any other prev animations set on the chevron
    chevron.clearAnimation();
    if (animate) {
        // make sure we start with the correct chevron for the prior state before animating it
        chevron.setImageResource(isGroupExpanded ? R.drawable.ic_chevron_right_blue_wordpress_24dp : R.drawable.ic_chevron_down_blue_wordpress_24dp);
        float start = (isGroupExpanded ? 0.0f : 0.0f);
        float end = (isGroupExpanded ? 90.0f : -90.0f);
        Animation rotate = new RotateAnimation(start, end, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        rotate.setDuration(ANIM_DURATION);
        rotate.setInterpolator(getInterpolator());
        rotate.setFillAfter(true);
        chevron.startAnimation(rotate);
    } else {
        chevron.setImageResource(isGroupExpanded ? R.drawable.ic_chevron_down_blue_wordpress_24dp : R.drawable.ic_chevron_right_blue_wordpress_24dp);
    }
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) ImageView(android.widget.ImageView)

Example 53 with RotateAnimation

use of android.view.animation.RotateAnimation in project CloudReader by youlookwhat.

the class EverydayFragment method onActivityCreated.

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    //        showLoading();
    showContentView();
    bindingView.llLoading.setVisibility(View.VISIBLE);
    animation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    //设置动画持续时间
    animation.setDuration(3000);
    //不停顿
    animation.setInterpolator(new LinearInterpolator());
    animation.setRepeatCount(10);
    bindingView.ivLoading.setAnimation(animation);
    animation.startNow();
    maCache = ACache.get(getContext());
    mEverydayModel = new EverydayModel();
    mBannerImages = (ArrayList<String>) maCache.getAsObject(Constants.BANNER_PIC);
    //        mLists = (ArrayList<List<AndroidBean>>) maCache.getAsObject(Constants.EVERYDAY_CONTENT);
    DebugUtil.error("----mBannerImages: " + (mBannerImages == null));
    DebugUtil.error("----mLists: " + (mLists == null));
    mHeaderBinding = DataBindingUtil.inflate(LayoutInflater.from(getContext()), R.layout.header_item_everyday, null, false);
    // 设置本地数据点击事件等
    initLocalSetting();
    initRecyclerView();
    mIsPrepared = true;
    /**
         * 因为启动时先走loadData()再走onActivityCreated,
         * 所以此处要额外调用load(),不然最初不会加载内容
         */
    loadData();
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) EverydayModel(com.example.jingbin.cloudreader.model.EverydayModel)

Example 54 with RotateAnimation

use of android.view.animation.RotateAnimation in project ABPlayer by winkstu.

the class MultiColumnPullToRefreshListView method init.

private void init() {
    setVerticalFadingEdgeEnabled(false);
    headerContainer = (LinearLayout) LayoutInflater.from(getContext()).inflate(R.layout.ptr_header, null);
    header = (RelativeLayout) headerContainer.findViewById(R.id.ptr_id_header);
    text = (TextView) header.findViewById(R.id.ptr_id_text);
    lastUpdatedTextView = (TextView) header.findViewById(R.id.ptr_id_last_updated);
    image = (ImageView) header.findViewById(R.id.ptr_id_image);
    refreshingIcon = header.findViewById(R.id.ptr_id_spinner);
    pullToRefreshText = getContext().getString(R.string.ptr_pull_to_refresh);
    releaseToRefreshText = getContext().getString(R.string.ptr_release_to_refresh);
    refreshingText = getContext().getString(R.string.ptr_refreshing);
    lastUpdatedText = getContext().getString(R.string.ptr_last_updated);
    flipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    flipAnimation.setInterpolator(new LinearInterpolator());
    flipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    flipAnimation.setFillAfter(true);
    reverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    reverseFlipAnimation.setInterpolator(new LinearInterpolator());
    reverseFlipAnimation.setDuration(ROTATE_ARROW_ANIMATION_DURATION);
    reverseFlipAnimation.setFillAfter(true);
    refreshingAnimation = new RotateAnimation(0, 720, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    refreshingAnimation.setDuration(1200);
    refreshingAnimation.setInterpolator(new LinearInterpolator());
    refreshingAnimation.setRepeatCount(Integer.MAX_VALUE);
    refreshingAnimation.setRepeatMode(Animation.RESTART);
    addHeaderView(headerContainer);
    setState(State.PULL_TO_REFRESH);
    scrollbarEnabled = isVerticalScrollBarEnabled();
    ViewTreeObserver vto = header.getViewTreeObserver();
    vto.addOnGlobalLayoutListener(new PTROnGlobalLayoutListener());
//super.setOnItemClickListener(new PTROnItemClickListener());
//super.setOnItemLongClickListener(new PTROnItemLongClickListener());
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) ViewTreeObserver(android.view.ViewTreeObserver)

Example 55 with RotateAnimation

use of android.view.animation.RotateAnimation in project UltimateAndroid by cymcsg.

the class RayLayout method createShrinkAnimation.

private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, Interpolator interpolator) {
    AnimationSet animationSet = new AnimationSet(false);
    animationSet.setFillAfter(true);
    final long preDuration = duration / 2;
    Animation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotateAnimation.setStartOffset(startOffset);
    rotateAnimation.setDuration(preDuration);
    rotateAnimation.setInterpolator(new LinearInterpolator());
    rotateAnimation.setFillAfter(true);
    animationSet.addAnimation(rotateAnimation);
    Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720);
    translateAnimation.setStartOffset(startOffset + preDuration);
    translateAnimation.setDuration(duration - preDuration);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setFillAfter(true);
    animationSet.addAnimation(translateAnimation);
    return animationSet;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) RotateAnimation(android.view.animation.RotateAnimation) Animation(android.view.animation.Animation) AnimationSet(android.view.animation.AnimationSet)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)63 LinearInterpolator (android.view.animation.LinearInterpolator)24 Animation (android.view.animation.Animation)15 AnimationSet (android.view.animation.AnimationSet)14 ScaleAnimation (android.view.animation.ScaleAnimation)12 AlphaAnimation (android.view.animation.AlphaAnimation)10 View (android.view.View)8 TranslateAnimation (android.view.animation.TranslateAnimation)6 ImageView (android.widget.ImageView)6 TextView (android.widget.TextView)5 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)4 LinearLayout (android.widget.LinearLayout)4 Paint (android.graphics.Paint)3 LayoutInflater (android.view.LayoutInflater)3 SimpleDraweeView (com.facebook.drawee.view.SimpleDraweeView)3 Context (android.content.Context)2 Intent (android.content.Intent)2 AbsListView (android.widget.AbsListView)2 ListView (android.widget.ListView)2 IOException (java.io.IOException)2