private static Animation createHintSwitchAnimation(bool expanded) { Animation animation = new RotateAnimation(expanded ? 45 : 0, expanded ? 0 : 45, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); animation.StartOffset = 0; animation.Duration = 100; animation.Interpolator = new DecelerateInterpolator(); animation.FillAfter = true; return animation; }
public BallService() { this.AniSet = new AnimationSet(true); var rotat = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); rotat.RepeatMode = RepeatMode.Reverse; rotat.Duration = 500; //rotat.AnimationStart += Ani_AnimationStart; //rotat.AnimationEnd += Ani_AnimationEnd; rotat.FillBefore = true; //AccelerateDecelerateInterpolator �ȼ��ٺ���� rotat.Interpolator = new AccelerateDecelerateInterpolator(); this.AniSet.AddAnimation(rotat); }
private void Initialize() { mFlipAnimation = new RotateAnimation(0, -180, Android.Views.Animations.Dimension.RelativeToSelf, 0.5f, Android.Views.Animations.Dimension.RelativeToSelf, 0.5f); mFlipAnimation.Interpolator = new LinearInterpolator(); mFlipAnimation.Duration = 250; mFlipAnimation.FillAfter = true; mReverseFlipAnimation = new RotateAnimation(-180, 0, Android.Views.Animations.Dimension.RelativeToSelf, 0.5f, Android.Views.Animations.Dimension.RelativeToSelf, 0.5f); mReverseFlipAnimation.Interpolator = new LinearInterpolator(); mReverseFlipAnimation.Duration = 250; mReverseFlipAnimation.FillAfter = true; mInflater = Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; mRefreshView = (RelativeLayout)mInflater.Inflate(Resource.Layout.pull_to_refresh_header, this, false); mRefreshViewText = (TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_text); mRefreshViewImage = (ImageView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_image); mRefreshViewProgress = (ProgressBar)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_progress); mRefreshViewLastUpdated = (TextView)mRefreshView.FindViewById(Resource.Id.pull_to_refresh_updated_at); mRefreshViewImage.SetMinimumHeight(50); mRefreshView.SetOnClickListener(new OnClickRefreshListener(this)); mRefreshOriginalTopPadding = mRefreshView.PaddingTop; mRefreshState = TAP_TO_REFRESH; AddHeaderView(mRefreshView); base.SetOnScrollListener(this); MeasureView(mRefreshView); mRefreshViewHeight = mRefreshView.MeasuredHeight; }
public DemoAdapter(Context ctxt, List<string> list) : base(new ArrayAdapter<string>(ctxt, IslamicHadithAND.Resource.Layout.row, global::Android.Resource.Id.Text1, list)) { _rotateAnimation = new RotateAnimation(0f, 360f, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); _rotateAnimation.Duration = 600; _rotateAnimation.RepeatMode = RepeatMode.Restart; _rotateAnimation.RepeatCount = Animation.Infinite; }
public FlipLoadingLayout(Context context, Mode mode, PTROrientation scrollDirection, TypedArray attrs) : base(context, mode, scrollDirection, attrs) { //super(context, mode, scrollDirection, attrs); int rotateAngle = mode == Mode.PULL_FROM_START ? -180 : 180; mRotateAnimation = new RotateAnimation(0, rotateAngle, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR; mRotateAnimation.Duration = FLIP_ANIMATION_DURATION; mRotateAnimation.FillAfter = true; mResetRotateAnimation = new RotateAnimation(rotateAngle, 0, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mResetRotateAnimation.Interpolator = ANIMATION_INTERPOLATOR; mResetRotateAnimation.Duration = FLIP_ANIMATION_DURATION; mResetRotateAnimation.FillAfter = true; }
public override bool OnFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { if (Math.Abs(velocityX) < 500) return false; _lastView = _parentActivity.LastView; var animationSet = new AnimationSet(true) { Interpolator = new AccelerateDecelerateInterpolator(), Duration = 300, FillAfter = true }; var animationRotate = new RotateAnimation(0, Math.Sign(velocityX)*15); var animationTranslate = new TranslateAnimation(0, Math.Sign(velocityX)*400, 0, 10); var animationAlpha = new AlphaAnimation(1, 0); animationSet.AddAnimation(animationRotate); animationSet.AddAnimation(animationTranslate); animationSet.AddAnimation(animationAlpha); animationSet.AnimationEnd += AnimationSet_AnimationEnd; _lastView.StartAnimation(animationSet); return true; }
private static Animation createShrinkAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long startOffset, long duration, IInterpolator interpolator) { AnimationSet animationSet = new AnimationSet(false); animationSet.FillAfter = true; long preDuration = duration / 2; Animation rotateAnimation = new RotateAnimation(0, 360, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); rotateAnimation.StartOffset = startOffset; rotateAnimation.Duration = preDuration; rotateAnimation.Interpolator = new LinearInterpolator(); rotateAnimation.FillAfter = true; animationSet.AddAnimation(rotateAnimation); Animation translateAnimation = new RotateAndTranslateAnimation(0, toXDelta, 0, toYDelta, 360, 720); translateAnimation.StartOffset = startOffset + preDuration; translateAnimation.Duration = duration - preDuration; translateAnimation.Interpolator = interpolator; translateAnimation.FillAfter = true; animationSet.AddAnimation(translateAnimation); return animationSet; }
/** * ��ʼ������ */ private void initHeaderViewAndFooterViewAndListView(Context context) { this.Orientation = Orientation.Vertical; //setDrawingCacheEnabled(false); /* * �Զ���ͷ���ļ� * ������������Ϊ���ǵ��ܶ���涼��Ҫʹ�� * ���Ҫ�ģ�������ص����ö�Ҫ���� */ mHeaderView = LayoutInflater.From(context).Inflate(Resource.Layout.pulldown_header, null); mHeaderViewParams = new LayoutParams(LayoutParams.FillParent, LayoutParams.WrapContent); this.AddView(mHeaderView, 0, mHeaderViewParams); mHeaderTextView = (TextView)mHeaderView.FindViewById<TextView>(Resource.Id.pulldown_header_text); mHeaderArrowView = (ImageView)mHeaderView.FindViewById<ImageView>(Resource.Id.pulldown_header_arrow); mHeaderLoadingView = mHeaderView.FindViewById(Resource.Id.pulldown_header_loading); // ע�⣬ͼƬ��ת֮����ִ����ת����������¿�ʼ���� mRotateOTo180Animation = new RotateAnimation(0, 180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mRotateOTo180Animation.Duration = 250; mRotateOTo180Animation.FillAfter = true; mRotate180To0Animation = new RotateAnimation(0, 180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mRotate180To0Animation.Duration = 250; mRotate180To0Animation.FillAfter = true; /** * �Զ���Ų��ļ� */ mFooterView = LayoutInflater.From(context).Inflate(Resource.Layout.pulldown_footer, null); mFooterTextView = (TextView)mFooterView.FindViewById(Resource.Id.pulldown_footer_text); mFooterLoadingView = mFooterView.FindViewById(Resource.Id.pulldown_footer_loading); //mFooterView.SetOnClickListener(IOnClickListenerDelegate); mFooterView.Click += new EventHandler(mFooterView_Click); mListView = new ScrollOverListView(context); mListView.setOnScrollOverListener(this); mListView.CacheColorHint = Android.Graphics.Color.Argb(0, 0, 0, 0); AddView(mListView, LayoutParams.FillParent, LayoutParams.FillParent); mOnPullDownListener = new PullDownListener(); }
public void AnimateInfiniteRotation () { if (!rotating) { rotating = true; if (animation == null) { animation = new RotateAnimation (359, 0, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); animation.Duration = 1000; animation.FillAfter = true; animation.RepeatCount = Animation.Infinite; animation.Interpolator = new LinearInterpolator (); } StartAnimation (animation); } }
public void OnClick(View v) { if (ParentItemClickListener != null) { if (_clickableView != null) { if (_rotationEnabled) { var rotateAnimation = new RotateAnimation(RotatedPosition, InitialPosition, Dimension.RelativeToSelf, PivotValue, Dimension.RelativeToSelf, PivotValue); _rotation = InitialPosition; rotateAnimation.Duration = _duration; rotateAnimation.FillAfter = true; _clickableView.StartAnimation(rotateAnimation); } } Expanded = !_isExpanded; ParentItemClickListener.OnParentItemClickListener(this.LayoutPosition); } }
public IndicatorLayout(Context context, Mode mode) :base(context) { //super(context); mArrowImageView = new ImageView(context); Drawable arrowD =Resources.GetDrawable(Resource.Drawable.indicator_arrow); mArrowImageView.SetImageDrawable(arrowD); int padding = Resources.GetDimensionPixelSize(Resource.Dimension.indicator_internal_padding); mArrowImageView.SetPadding(padding, padding, padding, padding); AddView(mArrowImageView); int inAnimResId, outAnimResId; switch (mode) { case Mode.PULL_FROM_END: inAnimResId = Resource.Animation.slide_in_from_bottom; outAnimResId = Resource.Animation.slide_out_to_bottom; SetBackgroundResource(Resource.Drawable.indicator_bg_bottom); // Rotate Arrow so it's pointing the correct way mArrowImageView.SetScaleType(Android.Widget.ImageView.ScaleType.Matrix); Matrix matrix = new Matrix(); matrix.SetRotate(180f, arrowD.IntrinsicWidth/ 2f, arrowD.IntrinsicHeight/ 2f); mArrowImageView.ImageMatrix=matrix; break; default: case Mode.PULL_FROM_START: inAnimResId = Resource.Animation.slide_in_from_top; outAnimResId = Resource.Animation.slide_out_to_top; SetBackgroundResource(Resource.Drawable.indicator_bg_top); break; } mInAnim = AnimationUtils.LoadAnimation(context, inAnimResId); mInAnim.SetAnimationListener(this); mOutAnim = AnimationUtils.LoadAnimation(context, outAnimResId); mOutAnim.SetAnimationListener(this); IInterpolator interpolator = new LinearInterpolator(); //mRotateAnimation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f); mRotateAnimation = new RotateAnimation(0, -180, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mRotateAnimation.Interpolator=interpolator; mRotateAnimation.Duration=DEFAULT_ROTATION_ANIMATION_DURATION; mRotateAnimation.FillAfter=true; mResetRotateAnimation = new RotateAnimation(-180, 0, Dimension.RelativeToSelf, 0.5f, Dimension.RelativeToSelf, 0.5f); mResetRotateAnimation.Interpolator=interpolator; mResetRotateAnimation.Duration=DEFAULT_ROTATION_ANIMATION_DURATION; mResetRotateAnimation.FillAfter=true; }