tabs = (TabLayout) findViewById(R.id.tabs); ViewGroup vg = (ViewGroup) tabs.getChildAt(0); int tabsCount = vg.getChildCount(); for (int i = 0; i < tabsCount; i++) { int delay = (i * 150) + 750; //this is starting delay ViewGroup vgTab = (ViewGroup) vg.getChildAt(i); vgTab.setScaleX(0f); vgTab.setScaleY(0f); vgTab.animate() .scaleX(1f) .scaleY(1f) .setStartDelay(delay) .setInterpolator(new FastOutSlowInInterpolator()) .setDuration(450) .start(); }
@Override public boolean onScale(ScaleGestureDetector detector) { float scale = 1 - detector.getScaleFactor(); mBoardScale += scale; if (mBoardScale < kMinBoardScale) mBoardScale = kMinBoardScale; if (mBoardScale > kMaxBoardScale) mBoardScale = kMaxBoardScale; mBoardContentView.setScaleX(1f / mBoardScale); mBoardContentView.setScaleY(1f / mBoardScale); return true; } });
@Override public void setScaleX(float scaleX) { super.setScaleX(scaleX); if (isReordering(true)) { float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY); mLastMotionX = p[0]; mLastMotionY = p[1]; updateDragViewTranslationDuringDrag(); } }
@Override public void setScaleX(float scaleX) { super.setScaleX(scaleX); if (isReordering(true)) { float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY); mLastMotionX = p[0]; mLastMotionY = p[1]; updateDragViewTranslationDuringDrag(); } }
@Override public void setScaleX(float scaleX) { super.setScaleX(scaleX); if (isReordering(true)) { float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY); mLastMotionX = p[0]; mLastMotionY = p[1]; updateDragViewTranslationDuringDrag(); } }
@Override public void setScaleX(float scaleX) { super.setScaleX(scaleX); if (isReordering(true)) { float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY); mLastMotionX = p[0]; mLastMotionY = p[1]; updateDragViewTranslationDuringDrag(); } }
@Override public void setScaleX(float scaleX) { super.setScaleX(scaleX); if (isReordering(true)) { float[] p = mapPointFromParentToView(this, mParentDownMotionX, mParentDownMotionY); mLastMotionX = p[0]; mLastMotionY = p[1]; updateDragViewTranslationDuringDrag(); } }
private void resetScaleAndPanning() { final int kLedSize = (int) MetricsUtils.convertDpToPixel(this, kLedPixelSize); final int canvasViewWidth = mBoardContentView.getWidth(); final int canvasViewHeight = mBoardContentView.getHeight(); final int boardWidth = mBoard.width * kLedSize; final int boardHeight = mBoard.height * kLedSize; int panningViewWidth = mCustomPanningView.getWidth(); mBoardScale = 1f/Math.min(1f, (panningViewWidth/(float)boardWidth)*0.85f)+0; mBoardContentView.setScaleX(1f / mBoardScale); mBoardContentView.setScaleY(1f / mBoardScale); mRotationViewGroup.setRotation(0); Log.d(TAG, "Initial scale: "+mBoardScale); int offsetX = Math.max(0, (canvasViewWidth - boardWidth) / 2); int offsetY = Math.max(0, (canvasViewHeight - boardHeight) / 2); mCustomPanningView.scrollTo(offsetX, offsetY); }
@Override public void onGlobalLayout() { content.getViewTreeObserver().removeOnGlobalLayoutListener(this); ObjectAnimator anim; if (TAG_CROP_TOP_AND_SIDES.equals(content.getTag())) { content.setTranslationY(-content.getMeasuredHeight()); anim = LauncherAnimUtils.ofFloat(content, "translationY", 0); } else { content.setScaleX(0); content.setScaleY(0); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1); anim = LauncherAnimUtils.ofPropertyValuesHolder(content, scaleX, scaleY); } anim.setDuration(SHOW_CLING_DURATION); anim.setInterpolator(new LogDecelerateInterpolator(100, 0)); anim.start(); } });
@Override public void onGlobalLayout() { content.getViewTreeObserver().removeOnGlobalLayoutListener(this); ObjectAnimator anim; if (TAG_CROP_TOP_AND_SIDES.equals(content.getTag())) { content.setTranslationY(-content.getMeasuredHeight()); anim = LauncherAnimUtils.ofFloat(content, "translationY", 0); } else { content.setScaleX(0); content.setScaleY(0); PropertyValuesHolder scaleX = PropertyValuesHolder.ofFloat("scaleX", 1); PropertyValuesHolder scaleY = PropertyValuesHolder.ofFloat("scaleY", 1); anim = LauncherAnimUtils.ofPropertyValuesHolder(content, scaleX, scaleY); } anim.setDuration(SHOW_CLING_DURATION); anim.setInterpolator(new LogDecelerateInterpolator(100, 0)); anim.start(); } });
/** Manually control the animation show / hide time. */ public void setMarkerAnimationFrame(@FloatRange(from = 0, to = 1) float frame) { this.markerAnimationFrame = frame; popUpRootView.setPivotX(popUpRootView.getWidth() / 2); popUpRootView.setPivotY(popUpRootView.getHeight()); popUpRootView.setScaleX(frame); popUpRootView.setScaleY(frame); popUpRootView.invalidate(); }