Esempio n. 1
0
		internal override void transformViewForTransition(int fromIndex, int toIndex, android.view.View
			 view, bool animate_1)
		{
			if (!animate_1)
			{
				((android.widget.StackView.StackFrame)view).cancelSliderAnimator();
				view.setRotationX(0f);
				android.widget.StackView.LayoutParams lp = (android.widget.StackView.LayoutParams
					)view.getLayoutParams();
				lp.setVerticalOffset(0);
				lp.setHorizontalOffset(0);
			}
			if (fromIndex == -1 && toIndex == getNumActiveViews() - 1)
			{
				transformViewAtIndex(toIndex, view, false);
				view.setVisibility(VISIBLE);
				view.setAlpha(1.0f);
			}
			else
			{
				if (fromIndex == 0 && toIndex == 1)
				{
					((android.widget.StackView.StackFrame)view).cancelSliderAnimator();
					view.setVisibility(VISIBLE);
					int duration = Sharpen.Util.Round(mStackSlider.getDurationForNeutralPosition(mYVelocity
						));
					android.widget.StackView.StackSlider animationSlider = new android.widget.StackView
						.StackSlider(this, mStackSlider);
					animationSlider.setView(view);
					if (animate_1)
					{
						android.animation.PropertyValuesHolder slideInY = android.animation.PropertyValuesHolder
							.ofFloat("YProgress", 0.0f);
						android.animation.PropertyValuesHolder slideInX = android.animation.PropertyValuesHolder
							.ofFloat("XProgress", 0.0f);
						android.animation.ObjectAnimator slideIn = android.animation.ObjectAnimator.ofPropertyValuesHolder
							(animationSlider, slideInX, slideInY);
						slideIn.setDuration(duration);
						slideIn.setInterpolator(new android.view.animation.LinearInterpolator());
						((android.widget.StackView.StackFrame)view).setSliderAnimator(slideIn);
						slideIn.start();
					}
					else
					{
						animationSlider.setYProgress(0f);
						animationSlider.setXProgress(0f);
					}
				}
				else
				{
					if (fromIndex == 1 && toIndex == 0)
					{
						((android.widget.StackView.StackFrame)view).cancelSliderAnimator();
						int duration = Sharpen.Util.Round(mStackSlider.getDurationForOffscreenPosition(mYVelocity
							));
						android.widget.StackView.StackSlider animationSlider = new android.widget.StackView
							.StackSlider(this, mStackSlider);
						animationSlider.setView(view);
						if (animate_1)
						{
							android.animation.PropertyValuesHolder slideOutY = android.animation.PropertyValuesHolder
								.ofFloat("YProgress", 1.0f);
							android.animation.PropertyValuesHolder slideOutX = android.animation.PropertyValuesHolder
								.ofFloat("XProgress", 0.0f);
							android.animation.ObjectAnimator slideOut = android.animation.ObjectAnimator.ofPropertyValuesHolder
								(animationSlider, slideOutX, slideOutY);
							slideOut.setDuration(duration);
							slideOut.setInterpolator(new android.view.animation.LinearInterpolator());
							((android.widget.StackView.StackFrame)view).setSliderAnimator(slideOut);
							slideOut.start();
						}
						else
						{
							animationSlider.setYProgress(1.0f);
							animationSlider.setXProgress(0f);
						}
					}
					else
					{
						if (toIndex == 0)
						{
							view.setAlpha(0.0f);
							view.setVisibility(INVISIBLE);
						}
						else
						{
							if ((fromIndex == 0 || fromIndex == 1) && toIndex > 1)
							{
								view.setVisibility(VISIBLE);
								view.setAlpha(1.0f);
								view.setRotationX(0f);
								android.widget.StackView.LayoutParams lp = (android.widget.StackView.LayoutParams
									)view.getLayoutParams();
								lp.setVerticalOffset(0);
								lp.setHorizontalOffset(0);
							}
							else
							{
								if (fromIndex == -1)
								{
									view.setAlpha(1.0f);
									view.setVisibility(VISIBLE);
								}
								else
								{
									if (toIndex == -1)
									{
										if (animate_1)
										{
											postDelayed(new _Runnable_294(view), STACK_RELAYOUT_DURATION);
										}
										else
										{
											view.setAlpha(0f);
										}
									}
								}
							}
						}
					}
				}
			}
			// Implement the faked perspective
			if (toIndex != -1)
			{
				transformViewAtIndex(toIndex, view, animate_1);
			}
		}
Esempio n. 2
0
			internal virtual android.graphics.Bitmap createOutline(android.view.View v, int type
				, int color)
			{
				mHolographicPaint.setColor(color);
				if (type == RES_OUT)
				{
					mBlurPaint.setMaskFilter(mSmallBlurMaskFilter);
				}
				else
				{
					if (type == CLICK_FEEDBACK)
					{
						mBlurPaint.setMaskFilter(mLargeBlurMaskFilter);
					}
				}
				if (v.getMeasuredWidth() == 0 || v.getMeasuredHeight() == 0)
				{
					return null;
				}
				android.graphics.Bitmap bitmap = android.graphics.Bitmap.createBitmap(v.getMeasuredWidth
					(), v.getMeasuredHeight(), android.graphics.Bitmap.Config.ARGB_8888);
				mCanvas.setBitmap(bitmap);
				float rotationX = v.getRotationX();
				float rotation = v.getRotation();
				float translationY = v.getTranslationY();
				float translationX = v.getTranslationX();
				v.setRotationX(0);
				v.setRotation(0);
				v.setTranslationY(0);
				v.setTranslationX(0);
				v.draw(mCanvas);
				v.setRotationX(rotationX);
				v.setRotation(rotation);
				v.setTranslationY(translationY);
				v.setTranslationX(translationX);
				drawOutline(mCanvas, bitmap);
				mCanvas.setBitmap(null);
				return bitmap;
			}