Java Code Examples for android.view.View#getScaleY()
The following examples show how to use
android.view.View#getScaleY() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimationHelper.java From FirefoxReality with Mozilla Public License 2.0 | 6 votes |
public static void scaleTo(@NonNull View aView, float scaleX, float scaleY, long duration, long delay, final Runnable aCallback) { if (aView.getScaleX() == scaleX && aView.getScaleY() == scaleY) { if (aCallback != null) { aView.post(aCallback); } return; } aView.animate().setStartDelay(delay).scaleX(scaleX).scaleY(scaleX).setDuration(duration).setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); if (aCallback != null) { aView.post(aCallback); } } }).setUpdateListener(animation -> aView.invalidate()); }
Example 2
Source File: RenderNodeAnimatorWrapper.java From scene with Apache License 2.0 | 5 votes |
private float getValue(int propertyConstant) { final View node = mView; switch (propertyConstant) { case ViewPropertyAnimatorConstant.TRANSLATION_X: return node.getTranslationX(); case ViewPropertyAnimatorConstant.TRANSLATION_Y: return node.getTranslationY(); case ViewPropertyAnimatorConstant.TRANSLATION_Z: return node.getTranslationZ(); case ViewPropertyAnimatorConstant.ROTATION: return node.getRotation(); case ViewPropertyAnimatorConstant.ROTATION_X: return node.getRotationX(); case ViewPropertyAnimatorConstant.ROTATION_Y: return node.getRotationY(); case ViewPropertyAnimatorConstant.SCALE_X: return node.getScaleX(); case ViewPropertyAnimatorConstant.SCALE_Y: return node.getScaleY(); case ViewPropertyAnimatorConstant.X: return mView.getLeft() + node.getTranslationX(); case ViewPropertyAnimatorConstant.Y: return mView.getTop() + node.getTranslationY(); case ViewPropertyAnimatorConstant.Z: return node.getElevation() + node.getTranslationZ(); case ViewPropertyAnimatorConstant.ALPHA: return mView.getAlpha(); } return 0; }
Example 3
Source File: ChangeTransform.java From scene with Apache License 2.0 | 5 votes |
Transforms(View view) { mTranslationX = view.getTranslationX(); mTranslationY = view.getTranslationY(); mTranslationZ = ViewCompat.getTranslationZ(view); mScaleX = view.getScaleX(); mScaleY = view.getScaleY(); mRotationX = view.getRotationX(); mRotationY = view.getRotationY(); mRotationZ = view.getRotation(); }
Example 4
Source File: Scale.java From Transitions-Everywhere with Apache License 2.0 | 5 votes |
@Nullable private Animator createAnimation(@NonNull final View view, float startScale, float endScale, @Nullable TransitionValues values) { final float initialScaleX = view.getScaleX(); final float initialScaleY = view.getScaleY(); float startScaleX = initialScaleX * startScale; float endScaleX = initialScaleX * endScale; float startScaleY = initialScaleY * startScale; float endScaleY = initialScaleY * endScale; if (values != null) { Float savedScaleX = (Float) values.values.get(PROPNAME_SCALE_X); Float savedScaleY = (Float) values.values.get(PROPNAME_SCALE_Y); // if saved value is not equal initial value it means that previous // transition was interrupted and in the onTransitionEnd // we've applied endScale. we should apply proper value to // continue animation from the interrupted state if (savedScaleX != null && savedScaleX != initialScaleX) { startScaleX = savedScaleX; } if (savedScaleY != null && savedScaleY != initialScaleY) { startScaleY = savedScaleY; } } view.setScaleX(startScaleX); view.setScaleY(startScaleY); Animator animator = TransitionUtils.mergeAnimators( ObjectAnimator.ofFloat(view, View.SCALE_X, startScaleX, endScaleX), ObjectAnimator.ofFloat(view, View.SCALE_Y, startScaleY, endScaleY)); addListener(new TransitionListenerAdapter() { @Override public void onTransitionEnd(@NonNull Transition transition) { view.setScaleX(initialScaleX); view.setScaleY(initialScaleY); transition.removeListener(this); } }); return animator; }
Example 5
Source File: ChangeTransform.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
public Transforms(View view) { translationX = view.getTranslationX(); translationY = view.getTranslationY(); translationZ = view.getTranslationZ(); scaleX = view.getScaleX(); scaleY = view.getScaleY(); rotationX = view.getRotationX(); rotationY = view.getRotationY(); rotationZ = view.getRotation(); }
Example 6
Source File: AbsFocusBorder.java From AndroidTvDemo with Apache License 2.0 | 5 votes |
/** * 焦点缩放动画 * * @param oldOrNewFocusView * @param */ protected void runFocusScaleAnimation(@Nullable View oldOrNewFocusView, float scaleX, float scaleY) { if (null == oldOrNewFocusView) return; if (scaleX != oldOrNewFocusView.getScaleX() || scaleY != oldOrNewFocusView.getScaleY()) { oldOrNewFocusView.animate().scaleX(scaleX).scaleY(scaleY).setDuration(mAnimDuration).start(); } }
Example 7
Source File: ViewDefault.java From morphos with Apache License 2.0 | 5 votes |
public void updateView(View v) { if (v != null) { this.alpha = v.getAlpha(); this.x = v.getX(); this.y = v.getY(); this.z = atLeastLollipop ? v.getZ() : 0; this.width = v.getWidth(); this.height = v.getHeight(); this.expansionScaleX = v.getScaleX(); this.expansionScaleY = v.getScaleY(); this.dispositionAngle = v.getRotation(); this.dispositionAngleX = v.getRotationX(); this.dispositionAngleY = v.getRotationY(); } }
Example 8
Source File: ViewGroupFocusHelper.java From LaunchEnr with GNU General Public License v3.0 | 5 votes |
@Override public void viewToRect(View v, Rect outRect) { outRect.left = 0; outRect.top = 0; computeLocationRelativeToContainer(v, outRect); // If a view is scaled, its position will also shift accordingly. For optimization, only // consider this for the last node. outRect.left += (1 - v.getScaleX()) * v.getWidth() / 2; outRect.top += (1 - v.getScaleY()) * v.getHeight() / 2; outRect.right = outRect.left + (int) (v.getScaleX() * v.getWidth()); outRect.bottom = outRect.top + (int) (v.getScaleY() * v.getHeight()); }
Example 9
Source File: MountState.java From litho with Apache License 2.0 | 5 votes |
private static void unsetScale(View view, NodeInfo nodeInfo) { if (nodeInfo.isScaleSet()) { if (view.getScaleX() != 1) { view.setScaleX(1); } if (view.getScaleY() != 1) { view.setScaleY(1); } } }
Example 10
Source File: ViewUtils.java From MultiView with Apache License 2.0 | 5 votes |
public static boolean isChildInCenterY(RecyclerView recyclerView, View view) { int childCount = recyclerView.getChildCount(); int[] rvLocationOnScreen = new int[2]; int[] vLocationOnScreen = new int[2]; recyclerView.getLocationOnScreen(rvLocationOnScreen); int middleY = (int) (rvLocationOnScreen[1] + recyclerView.getHeight() * recyclerView.getScaleY() / 2); if (childCount > 0) { view.getLocationOnScreen(vLocationOnScreen); if (vLocationOnScreen[1] <= middleY && vLocationOnScreen[1] + view.getHeight() * view.getScaleY() >= middleY) { return true; } } return false; }
Example 11
Source File: AnimatedProperties.java From litho with Apache License 2.0 | 5 votes |
@Override public float get(Object mountContent) { final View asView = assertIsView(mountContent, this); final float scale = asView.getScaleX(); if (scale != asView.getScaleY()) { throw new RuntimeException( "Tried to get scale of view, but scaleX and scaleY are different"); } return scale; }
Example 12
Source File: ECardFlow.java From ECardFlow with MIT License | 4 votes |
private void cacheData(View view) { mPageScaleX = view.getScaleX(); mPageScaleY = view.getScaleY(); mScaleX = getScaleX(); mScaleY = getScaleY(); }
Example 13
Source File: ViewHelper.java From Mover with Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 14
Source File: ViewHelper.java From XDroidAnimation with Apache License 2.0 | 4 votes |
public static float getScaleY(View view) { return view.getScaleY(); }
Example 15
Source File: ViewHelper.java From android-project-wo2b with Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 16
Source File: ViewHelper.java From timecat with Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 17
Source File: AnimationUtils.java From social-app-android with Apache License 2.0 | 4 votes |
public static boolean isViewHiddenByScale(View v) { return v.getScaleX() == 0 && v.getScaleY() == 0; }
Example 18
Source File: SmallBangView.java From SmallBang with Apache License 2.0 | 4 votes |
@Override public Float get(View object) { return object.getScaleY(); }
Example 19
Source File: Animer.java From Animer with Apache License 2.0 | 4 votes |
@Override public float getValue(View view) { return view.getScaleY(); }
Example 20
Source File: DynamicAnimation.java From CircularReveal with MIT License | 4 votes |
@Override public float getValue(View view) { return view.getScaleY(); }