@Override public void setPivotY(float pivotY) { super.setPivotY(pivotY); invalidateParentIfNeeded(); fireOnTransformationChangedListener(); }
void prepareTitleAnim(TextView urlBar, TextView titleBar) { mTitleBar = titleBar; mUrlBar = urlBar; mUrlBar.setPivotX(0f); mUrlBar.setPivotY(0f); mShouldRunTitleAnimation = true; }
private void addTextViewOnCanvas(Canvas canvas) { LinearLayout layout = new LinearLayout(_context); TextView textView = new TextView(_context); textView.setVisibility(View.VISIBLE); textView.setText("Hello Multiline text world ............."); textView.setWidth(canvas.getWidth() - 100); textView.setBackgroundColor(Color.YELLOW); textView.setPivotX(0); textView.setPivotY(0); textView.setRotation(90F); layout.addView(textView); layout.measure(canvas.getWidth(), canvas.getHeight()); layout.layout(0, 0, canvas.getWidth(), canvas.getHeight()); // To place the text view somewhere specific: canvas.translate(_PosX, _PosY); layout.draw(canvas); }
@Override public void setRotateAnchorPoints() { image.setPivotX(buttonRadius - imageRect.left); image.setPivotY(buttonRadius - imageRect.top); text.setPivotX(trueRadius - textRect.left); text.setPivotY(trueRadius - textRect.top); }
@Override public void setRotateAnchorPoints() { image.setPivotX(buttonRadius - imageRect.left); image.setPivotY(buttonRadius - imageRect.top); text.setPivotX(buttonRadius - textRect.left); text.setPivotY(buttonRadius - textRect.top); }
public void fallLabel() { if (!raised) { return; } mTextView.setPivotX(1); mTextView.setPivotY(1); mTextView.animate().scaleX(1.0f).setDuration(96); mTextView.animate().scaleY(1.0f).setDuration(96); mTextView.animate().translationY(0).setDuration(96); raised = false; }
private void scaleExpandedInfoAreaView(TextView view) { view.setPivotX((float) (-view.getLeft())); view.setPivotY((float) (-(view.getTop() - this.mInfoAreaTop))); view.setScaleX(1.0f / this.mScaleFactor); view.setScaleY(1.0f / this.mScaleFactor); }
public void raiseLabel(boolean anim) { if (raised) { return; } mTextView.setPivotX(1); mTextView.setPivotY(1); if (anim) { mTextView.animate().scaleX(0.75f).setDuration(96); mTextView.animate().scaleY(0.75f).setDuration(96); mTextView.animate().translationY(-mScreenDensity * 24).setDuration(96); } else { mTextView.setScaleX(0.75f); mTextView.setScaleY(0.75f); mTextView.setTranslationY(-mScreenDensity * 24); } raised = true; }
private void updateHeader(int scrollY, boolean anim) { float scale = titleShrinkFactor * scrollY + 1; mTitle.setPivotX(1); mTitle.setPivotY(1); if (anim) { mRelativeLayout.animate().translationY(-headerTranslationYFactor * scrollY); /** * Changing scaleX and scaleY of title is better than changing its textSize. * pivotX and pivotY should be remained as 1 so that title's location won't * be changed incorrectly. */ mTitle.animate().scaleX(scale).setDuration(160); mTitle.animate().scaleY(scale).setDuration(160); mSubtitle.animate().alpha(-1.0f / mScreenDensity / 90 * scrollY + 1).withLayer().setDuration(160); } else { mRelativeLayout.setTranslationY((int) (-headerTranslationYFactor * scrollY)); mTitle.setScaleX(scale); mTitle.setScaleY(scale); mSubtitle.setAlpha(-1.0f / mScreenDensity / 90 * scrollY + 1); } } }