Java Code Examples for android.view.View#getScaleY()
The following examples show how to use
android.view.View#getScaleY() .
These examples are extracted from open source projects.
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 Project: FirefoxReality File: AnimationHelper.java License: 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 Project: scene File: ChangeTransform.java License: 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 3
Source Project: scene File: RenderNodeAnimatorWrapper.java License: 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 4
Source Project: Transitions-Everywhere File: Scale.java License: 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 Project: android_9.0.0_r45 File: ChangeTransform.java License: 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 Project: morphos File: ViewDefault.java License: 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 7
Source Project: MultiView File: ViewUtils.java License: 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 8
Source Project: litho File: AnimatedProperties.java License: 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 9
Source Project: litho File: MountState.java License: 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 Project: LaunchEnr File: ViewGroupFocusHelper.java License: 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 11
Source Project: AndroidTvDemo File: AbsFocusBorder.java License: 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 12
Source Project: CircularReveal File: DynamicAnimation.java License: MIT License | 4 votes |
@Override public float getValue(View view) { return view.getScaleY(); }
Example 13
Source Project: Animer File: Animer.java License: Apache License 2.0 | 4 votes |
@Override public float getValue(View view) { return view.getScaleY(); }
Example 14
Source Project: SmallBang File: SmallBangView.java License: Apache License 2.0 | 4 votes |
@Override public Float get(View object) { return object.getScaleY(); }
Example 15
Source Project: social-app-android File: AnimationUtils.java License: Apache License 2.0 | 4 votes |
public static boolean isViewHiddenByScale(View v) { return v.getScaleX() == 0 && v.getScaleY() == 0; }
Example 16
Source Project: timecat File: ViewHelper.java License: Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 17
Source Project: android-project-wo2b File: ViewHelper.java License: Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 18
Source Project: XDroidAnimation File: ViewHelper.java License: Apache License 2.0 | 4 votes |
public static float getScaleY(View view) { return view.getScaleY(); }
Example 19
Source Project: Mover File: ViewHelper.java License: Apache License 2.0 | 4 votes |
static float getScaleY(View view) { return view.getScaleY(); }
Example 20
Source Project: ECardFlow File: ECardFlow.java License: MIT License | 4 votes |
private void cacheData(View view) { mPageScaleX = view.getScaleX(); mPageScaleY = view.getScaleY(); mScaleX = getScaleX(); mScaleY = getScaleY(); }