Search in sources :

Example 31 with RotateAnimation

use of android.view.animation.RotateAnimation in project fresco by facebook.

the class WelcomeFragment method onViewCreated.

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    final SimpleDraweeView draweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
    draweeView.setActualImageResource(R.drawable.logo);
    draweeView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            final RotateAnimation rotateAnimation = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            rotateAnimation.setDuration(1000);
            rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
            draweeView.startAnimation(rotateAnimation);
        }
    });
    final Button buttonGitHub = (Button) view.findViewById(R.id.button_github);
    setUriIntent(buttonGitHub, URL_GITHUB);
    final Button buttonDocumentation = (Button) view.findViewById(R.id.button_documentation);
    setUriIntent(buttonDocumentation, URL_DOCUMENTATION);
}
Also used : SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) RotateAnimation(android.view.animation.RotateAnimation) Button(android.widget.Button) AccelerateDecelerateInterpolator(android.view.animation.AccelerateDecelerateInterpolator) SimpleDraweeView(com.facebook.drawee.view.SimpleDraweeView) View(android.view.View)

Example 32 with RotateAnimation

use of android.view.animation.RotateAnimation in project android-app by eoecn.

the class XListViewHeader method initView.

private void initView(Context context) {
    // 初始情况,设置下拉刷新view高度为0
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 0);
    mContainer = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.xlistview_header, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);
    mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
    mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview);
    mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar);
    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearLayout(android.widget.LinearLayout)

Example 33 with RotateAnimation

use of android.view.animation.RotateAnimation in project android-common by Trinea.

the class DropDownListView method initDropDownStyle.

/**
 * init drop down style, only init once
 */
private void initDropDownStyle() {
    if (headerLayout != null) {
        if (isDropDownStyle) {
            addHeaderView(headerLayout);
        } else {
            removeHeaderView(headerLayout);
        }
        return;
    }
    if (!isDropDownStyle) {
        return;
    }
    headerReleaseMinDistance = context.getResources().getDimensionPixelSize(R.dimen.drop_down_list_header_release_min_distance);
    flipAnimation = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    flipAnimation.setInterpolator(new LinearInterpolator());
    flipAnimation.setDuration(250);
    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(250);
    reverseFlipAnimation.setFillAfter(true);
    headerDefaultText = context.getString(R.string.drop_down_list_header_default_text);
    headerPullText = context.getString(R.string.drop_down_list_header_pull_text);
    headerReleaseText = context.getString(R.string.drop_down_list_header_release_text);
    headerLoadingText = context.getString(R.string.drop_down_list_header_loading_text);
    LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    headerLayout = (RelativeLayout) inflater.inflate(R.layout.drop_down_list_header, this, false);
    headerText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_default_text);
    headerImage = (ImageView) headerLayout.findViewById(R.id.drop_down_list_header_image);
    headerProgressBar = (ProgressBar) headerLayout.findViewById(R.id.drop_down_list_header_progress_bar);
    headerSecondText = (TextView) headerLayout.findViewById(R.id.drop_down_list_header_second_text);
    headerLayout.setClickable(true);
    headerLayout.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            onDropDown();
        }
    });
    headerText.setText(headerDefaultText);
    addHeaderView(headerLayout);
    measureHeaderLayout(headerLayout);
    headerOriginalHeight = headerLayout.getMeasuredHeight();
    headerOriginalTopPadding = headerLayout.getPaddingTop();
    currentHeaderStatus = HEADER_STATUS_CLICK_TO_LOAD;
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator) LayoutInflater(android.view.LayoutInflater) ImageView(android.widget.ImageView) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) View(android.view.View) ListView(android.widget.ListView)

Example 34 with RotateAnimation

use of android.view.animation.RotateAnimation in project Libraries-for-Android-Developers by eoecn.

the class XListViewHeader method initView.

private void initView(Context context) {
    // 初始情况,设置下拉刷新view高度为0
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, 0);
    mContainer = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.xlistview_header, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);
    mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
    mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview);
    mProgressBar = (ProgressBar) findViewById(R.id.xlistview_header_progressbar);
    mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearLayout(android.widget.LinearLayout)

Example 35 with RotateAnimation

use of android.view.animation.RotateAnimation in project Lazy by l123456789jy.

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)

Aggregations

RotateAnimation (android.view.animation.RotateAnimation)111 LinearInterpolator (android.view.animation.LinearInterpolator)38 Animation (android.view.animation.Animation)27 AnimationSet (android.view.animation.AnimationSet)24 ScaleAnimation (android.view.animation.ScaleAnimation)17 ImageView (android.widget.ImageView)15 View (android.view.View)14 TextView (android.widget.TextView)14 AlphaAnimation (android.view.animation.AlphaAnimation)13 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)12 TranslateAnimation (android.view.animation.TranslateAnimation)9 Context (android.content.Context)5 LinearLayout (android.widget.LinearLayout)5 Intent (android.content.Intent)4 AccelerateDecelerateInterpolator (android.view.animation.AccelerateDecelerateInterpolator)4 IOException (java.io.IOException)4 Paint (android.graphics.Paint)3 Drawable (android.graphics.drawable.Drawable)3 RecyclerView (android.support.v7.widget.RecyclerView)3 AttributeSet (android.util.AttributeSet)3