@Override public void setPivotX(float pivotX) { super.setPivotX(pivotX); 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(buttonRadius - textRect.left); text.setPivotY(buttonRadius - textRect.top); }
@Override public void setRotateAnchorPoints() { image.setPivotX(buttonRadius - imageRect.left); image.setPivotY(buttonRadius - imageRect.top); text.setPivotX(trueRadius - textRect.left); text.setPivotY(trueRadius - 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 setTabSelect(int from, int to) { if (from != -1) { ViewGroup tab_item_from = (ViewGroup) this.findViewWithTag(from); ImageView pre_img = (ImageView) tab_item_from.getChildAt(0); TextView pre_text = (TextView) tab_item_from.getChildAt(1); //pre_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 12); pre_img.setColorFilter(COLOR_UNSELECT); pre_text.setTextColor(COLOR_UNSELECT); pre_text.setPivotX(pre_img.getWidth() / 2); pre_text.setScaleX(1.0f); pre_text.setScaleY(1.0f); } ViewGroup tab_item_to = (ViewGroup) this.findViewWithTag(to); ImageView to_img = (ImageView) tab_item_to.getChildAt(0); TextView to_text = (TextView) tab_item_to.getChildAt(1); //to_text.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); to_img.setImageResource(icons_unselect[to]); to_img.setColorFilter(COLOR_SELECT); to_text.setTextColor(COLOR_SELECT); to_text.setPivotX(to_text.getWidth() / 2); to_text.setScaleX(1.08f); to_text.setScaleY(1.08f); refreshDrawableState(); }
towardAnimators.add(toward); card.setPivotX(X_SHIFT_DP); Animator rotateAway = ObjectAnimator.ofFloat(card, "rotationY", i == 0 ? 0 : ROTATE_DEGREES);
towardAnimators.add(toward); card.setPivotX(X_SHIFT_DP); Animator rotateAway = ObjectAnimator.ofFloat(card, "rotationY", i == 0 ? 0 : ROTATE_DEGREES);
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); } } }