Search in sources :

Example 6 with RotateAnimation

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

the class ArcLayout 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)

Example 7 with RotateAnimation

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

the class ArcMenu method createHintSwitchAnimation.

private static Animation createHintSwitchAnimation(final boolean expanded) {
    Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setStartOffset(0);
    animation.setDuration(100);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setFillAfter(true);
    return animation;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation)

Example 8 with RotateAnimation

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

the class RayMenu method createHintSwitchAnimation.

private static Animation createHintSwitchAnimation(final boolean expanded) {
    Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    animation.setStartOffset(0);
    animation.setDuration(100);
    animation.setInterpolator(new DecelerateInterpolator());
    animation.setFillAfter(true);
    return animation;
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) RotateAnimation(android.view.animation.RotateAnimation) ScaleAnimation(android.view.animation.ScaleAnimation) RotateAnimation(android.view.animation.RotateAnimation) AlphaAnimation(android.view.animation.AlphaAnimation) Animation(android.view.animation.Animation)

Example 9 with RotateAnimation

use of android.view.animation.RotateAnimation in project instructure-android by instructure.

the class StudentListView method initListView.

private void initListView(View popupView) {
    // get the listview inside our popupwindow and set our adapter to it
    mListView = (ListView) popupView.findViewById(R.id.studentList);
    mSubmissionsAdapter = new UserSubmissionsListAdapter(mActivity.getApplicationContext(), mSubmissionsList, mAssignment, mListView, ((App) mActivity.getApplication()).showStudentNames(), mListener);
    if (isSortByName) {
        mSubmissionsAdapter.sortSubmissionsByName(((App) mActivity.getApplication()).showUngradedStudentsFirst());
    } else {
        mSubmissionsAdapter.sortSubmissionsByGrade();
    }
    final ViewGroup header = (ViewGroup) LayoutInflater.from(mActivity).inflate(R.layout.student_list_headerview, mListView, false);
    final RelativeLayout row = (RelativeLayout) header.findViewById(R.id.row);
    final LinearLayout dropDown = (LinearLayout) header.findViewById(R.id.rowDropdown);
    final RadioGroup radioGroup = (RadioGroup) header.findViewById(R.id.radioGroup);
    final ImageView expandArrow = (ImageView) header.findViewById(R.id.expandArrow);
    final TextView sectionTitle = (TextView) header.findViewById(R.id.sectionTitle);
    row.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            ExpandCollapseAnimation.setHeightForWrapContent(mActivity, dropDown);
            ExpandCollapseAnimation expandCollapseAnimation = new ExpandCollapseAnimation(dropDown, 200);
            expandCollapseAnimation.setAnimationListener(new Animation.AnimationListener() {

                @Override
                public void onAnimationStart(Animation animation) {
                }

                @Override
                public void onAnimationEnd(Animation animation) {
                    RotateAnimation rotationAnim;
                    if (dropDown.getHeight() < 50) {
                        // For some reason, onAnimatinoEnd is getting called slightly before the animation actually ends, causing the height to be a value something greater than 0.
                        // currently closed
                        rotationAnim = new RotateAnimation(180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                    } else {
                        // currently open
                        rotationAnim = new RotateAnimation(0, 180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
                    }
                    rotationAnim.setDuration(100);
                    rotationAnim.setFillAfter(true);
                    expandArrow.startAnimation(rotationAnim);
                }

                @Override
                public void onAnimationRepeat(Animation animation) {
                }
            });
            dropDown.startAnimation(expandCollapseAnimation);
        }
    });
    // Set our arrow to gray
    final Drawable d = CanvasContextColor.getColoredDrawable(mApplicationContext, R.drawable.ic_cv_arrow_down_fill, ContextCompat.getColor(mActivity.getApplicationContext(), R.color.lightGray));
    expandArrow.setImageDrawable(d);
    mListView.addHeaderView(header);
    mListView.setTextFilterEnabled(true);
    mListView.setAdapter(mSubmissionsAdapter);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            // show the submission clicked
            dismiss();
            int positionInList = mSubmissionsAdapter.getPositionForSubmission((Submission) mListView.getItemAtPosition(position));
            mListener.onCurrentSubmission(positionInList);
        }
    });
    initSectionsRadioGroup(radioGroup, sectionTitle, header);
}
Also used : App(com.instructure.speedgrader.util.App) RadioGroup(android.widget.RadioGroup) Submission(com.instructure.canvasapi.model.Submission) UserSubmissionsListAdapter(com.instructure.speedgrader.adapters.UserSubmissionsListAdapter) ViewGroup(android.view.ViewGroup) ColorDrawable(android.graphics.drawable.ColorDrawable) Drawable(android.graphics.drawable.Drawable) SearchView(android.support.v7.widget.SearchView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) RotateAnimation(android.view.animation.RotateAnimation) RelativeLayout(android.widget.RelativeLayout) ExpandCollapseAnimation(com.instructure.speedgrader.util.ExpandCollapseAnimation) ExpandCollapseAnimation(com.instructure.speedgrader.util.ExpandCollapseAnimation) Animation(android.view.animation.Animation) RotateAnimation(android.view.animation.RotateAnimation) TextView(android.widget.TextView) AdapterView(android.widget.AdapterView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Example 10 with RotateAnimation

use of android.view.animation.RotateAnimation in project glitch-hq-android by tinyspeck.

the class PullToRefreshScrollView method init.

public void init(Activity context) {
    // Load all of the animations we need in code rather than through XML
    mFlipAnimation = new RotateAnimation(0, -180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mFlipAnimation.setInterpolator(new LinearInterpolator());
    mFlipAnimation.setDuration(250);
    mFlipAnimation.setFillAfter(true);
    mReverseFlipAnimation = new RotateAnimation(-180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
    mReverseFlipAnimation.setDuration(250);
    mReverseFlipAnimation.setFillAfter(true);
    mRefreshView = context.findViewById(R.id.pull_to_refresh_header);
    mRefreshViewText = (TextView) context.findViewById(R.id.pull_to_refresh_text);
    m_rootImage = (View) context.findViewById(R.id.list_footer);
    mRefreshViewText_bottom = (TextView) context.findViewById(R.id.pull_to_load_more_label);
    mRefreshViewImage = (ImageView) context.findViewById(R.id.pull_to_refresh_image);
    mRefreshViewProgress = (ProgressBar) context.findViewById(R.id.pull_to_refresh_progress);
    mRefreshViewProgress_bottom = (ProgressBar) context.findViewById(R.id.pull_to_refresh_progress_bottom);
    mRefreshViewLastUpdated = (TextView) context.findViewById(R.id.pull_to_refresh_updated_at);
    mRefreshViewImage.setMinimumHeight(50);
    mRefreshOriginalTopPadding = mRefreshView.getPaddingTop();
    mRefreshState = TAP_TO_REFRESH;
    // mRefreshView.setVisibility(View.GONE);
    // m_rootImage.setVisibility(View.GONE);
    measureView(mRefreshView);
    mRefreshViewHeight = mRefreshView.getMeasuredHeight();
    setSmoothScrollingEnabled(true);
// setOverScrollMode(  OVER_SCROLL_IF_CONTENT_SCROLLS );
}
Also used : RotateAnimation(android.view.animation.RotateAnimation) LinearInterpolator(android.view.animation.LinearInterpolator)

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