Java Code Examples for android.view.View#getScaleX()
The following examples show how to use
android.view.View#getScaleX() .
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: 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 2
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 3
Source Project: SchoolQuest File: LessonB.java License: GNU General Public License v3.0 | 5 votes |
private boolean isViewOverlapping(View firstView, View secondView) { int[] firstPosition = new int[2]; int[] secondPosition = new int[2]; firstView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); firstView.getLocationOnScreen(firstPosition); secondView.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); secondView.getLocationOnScreen(secondPosition); float firstWidth = firstView.getMeasuredWidth() * firstView.getScaleX(); float secondWidth = secondView.getMeasuredWidth() * secondView.getScaleX(); return firstPosition[0] < secondPosition[0] + secondWidth && firstPosition[0] + firstWidth > secondPosition[0]; }
Example 4
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 5
Source Project: DevUtils File: ViewUtils.java License: Apache License 2.0 | 5 votes |
/** * 获取 View 水平方向缩放比例 * @param view View * @return View 水平方向缩放比例 */ public static float getScaleX(final View view) { if (view != null) { return view.getScaleX(); } return 0f; }
Example 6
Source Project: ucar-weex-core File: WXSliderNeighbor.java License: Apache License 2.0 | 5 votes |
private void updateScaleAndAlpha(View view, float alpha, float scale) { if(null == view) { return; } if(alpha >= 0 && view.getAlpha() != alpha) { view.setAlpha(alpha); } if(scale >= 0 && view.getScaleX() != scale) { view.setScaleX(scale); view.setScaleY(scale); } }
Example 7
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 8
Source Project: Transitions-Everywhere File: ChangeTransform.java License: Apache License 2.0 | 5 votes |
public Transforms(View view) { translationX = view.getTranslationX(); translationY = view.getTranslationY(); translationZ = ViewUtils.getTranslationZ(view); scaleX = view.getScaleX(); scaleY = view.getScaleY(); rotationX = view.getRotationX(); rotationY = view.getRotationY(); rotationZ = view.getRotation(); }
Example 9
Source Project: Trebuchet File: CellLayout.java License: GNU General Public License v3.0 | 5 votes |
public ReorderPreviewAnimation(View child, int mode, int cellX0, int cellY0, int cellX1, int cellY1, int spanX, int spanY) { regionToCenterPoint(cellX0, cellY0, spanX, spanY, mTmpPoint); final int x0 = mTmpPoint[0]; final int y0 = mTmpPoint[1]; regionToCenterPoint(cellX1, cellY1, spanX, spanY, mTmpPoint); final int x1 = mTmpPoint[0]; final int y1 = mTmpPoint[1]; final int dX = x1 - x0; final int dY = y1 - y0; finalDeltaX = 0; finalDeltaY = 0; int dir = mode == MODE_HINT ? -1 : 1; if (dX == dY && dX == 0) { } else { if (dY == 0) { finalDeltaX = - dir * Math.signum(dX) * mReorderPreviewAnimationMagnitude; } else if (dX == 0) { finalDeltaY = - dir * Math.signum(dY) * mReorderPreviewAnimationMagnitude; } else { double angle = Math.atan( (float) (dY) / dX); finalDeltaX = (int) (- dir * Math.signum(dX) * Math.abs(Math.cos(angle) * mReorderPreviewAnimationMagnitude)); finalDeltaY = (int) (- dir * Math.signum(dY) * Math.abs(Math.sin(angle) * mReorderPreviewAnimationMagnitude)); } } this.mode = mode; initDeltaX = child.getTranslationX(); initDeltaY = child.getTranslationY(); finalScale = getChildrenScale() - 4.0f / child.getWidth(); initScale = child.getScaleX(); this.child = child; }
Example 10
Source Project: photo-editor-android File: MultiTouchListener.java License: MIT License | 5 votes |
private static void move(View view, TransformInfo info) { computeRenderOffset(view, info.pivotX, info.pivotY); adjustTranslation(view, info.deltaX, info.deltaY); float scale = view.getScaleX() * info.deltaScale; scale = Math.max(info.minimumScale, Math.min(info.maximumScale, scale)); view.setScaleX(scale); view.setScaleY(scale); float rotation = adjustAngle(view.getRotation() + info.deltaAngle); view.setRotation(rotation); }
Example 11
Source Project: MultiView File: ViewUtils.java License: Apache License 2.0 | 4 votes |
public static boolean isItemAtPoint(View view, float x, float y) { return (view.getLeft() < x) && (view.getLeft() + view.getWidth() * view.getScaleX() > x) && (view.getTop() < y) && (view.getTop() + view.getHeight() * view.getScaleY() > y) ; }
Example 12
Source Project: TurboLauncher File: DragLayer.java License: Apache License 2.0 | 4 votes |
public void animateViewIntoPosition(DragView dragView, final View child, int duration, final Runnable onFinishAnimationRunnable, View anchorView) { ShortcutAndWidgetContainer parentChildren = (ShortcutAndWidgetContainer) child.getParent(); CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); parentChildren.measureChild(child); Rect r = new Rect(); getViewRectRelativeToSelf(dragView, r); int coord[] = new int[2]; float childScale = child.getScaleX(); coord[0] = lp.x + (int) (child.getMeasuredWidth() * (1 - childScale) / 2); coord[1] = lp.y + (int) (child.getMeasuredHeight() * (1 - childScale) / 2); // Since the child hasn't necessarily been laid out, we force the lp to be updated with // the correct coordinates (above) and use these to determine the final location float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord); // We need to account for the scale of the child itself, as the above only accounts for // for the scale in parents. scale *= childScale; int toX = coord[0]; int toY = coord[1]; float toScale = scale; if (child instanceof TextView) { TextView tv = (TextView) child; // Account for the source scale of the icon (ie. from AllApps to Workspace, in which // the workspace may have smaller icon bounds). toScale = scale / dragView.getIntrinsicIconScaleFactor(); // The child may be scaled (always about the center of the view) so to account for it, // we have to offset the position by the scaled size. Once we do that, we can center // the drag view about the scaled child view. toY += Math.round(toScale * tv.getPaddingTop()); toY -= dragView.getMeasuredHeight() * (1 - toScale) / 2; toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2; } else if (child instanceof FolderIcon) { // Account for holographic blur padding on the drag view toY += Math.round(scale * (child.getPaddingTop() - dragView.getDragRegionTop())); toY -= scale * Workspace.DRAG_BITMAP_PADDING / 2; toY -= (1 - scale) * dragView.getMeasuredHeight() / 2; // Center in the x coordinate about the target's drawable toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2; } else { toY -= (Math.round(scale * (dragView.getHeight() - child.getMeasuredHeight()))) / 2; toX -= (Math.round(scale * (dragView.getMeasuredWidth() - child.getMeasuredWidth()))) / 2; } final int fromX = r.left; final int fromY = r.top; child.setVisibility(INVISIBLE); Runnable onCompleteRunnable = new Runnable() { public void run() { child.setVisibility(VISIBLE); if (onFinishAnimationRunnable != null) { onFinishAnimationRunnable.run(); } } }; animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, toScale, toScale, onCompleteRunnable, ANIMATION_END_DISAPPEAR, duration, anchorView); }
Example 13
Source Project: MiBandDecompiled File: a.java License: Apache License 2.0 | 4 votes |
static float g(View view) { return view.getScaleX(); }
Example 14
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 15
Source Project: WIFIADB File: ScaleProperty.java License: Apache License 2.0 | 4 votes |
@Override public Float get(View object) { return object.getScaleX(); }
Example 16
Source Project: UltimateAndroid File: ViewHelper.java License: Apache License 2.0 | 4 votes |
static float getScaleX(View view) { return view.getScaleX(); }
Example 17
Source Project: react-native-GPay File: ScaleXAnimationPropertyUpdater.java License: MIT License | 4 votes |
@Override protected float getProperty(View view) { return view.getScaleX(); }
Example 18
Source Project: LB-Launcher File: DragLayer.java License: Apache License 2.0 | 4 votes |
public void animateViewIntoPosition(DragView dragView, final View child, int duration, final Runnable onFinishAnimationRunnable, View anchorView) { ShortcutAndWidgetContainer parentChildren = (ShortcutAndWidgetContainer) child.getParent(); CellLayout.LayoutParams lp = (CellLayout.LayoutParams) child.getLayoutParams(); parentChildren.measureChild(child); Rect r = new Rect(); getViewRectRelativeToSelf(dragView, r); int coord[] = new int[2]; float childScale = child.getScaleX(); coord[0] = lp.x + (int) (child.getMeasuredWidth() * (1 - childScale) / 2); coord[1] = lp.y + (int) (child.getMeasuredHeight() * (1 - childScale) / 2); // Since the child hasn't necessarily been laid out, we force the lp to be updated with // the correct coordinates (above) and use these to determine the final location float scale = getDescendantCoordRelativeToSelf((View) child.getParent(), coord); // We need to account for the scale of the child itself, as the above only accounts for // for the scale in parents. scale *= childScale; int toX = coord[0]; int toY = coord[1]; float toScale = scale; if (child instanceof TextView) { TextView tv = (TextView) child; // Account for the source scale of the icon (ie. from AllApps to Workspace, in which // the workspace may have smaller icon bounds). toScale = scale / dragView.getIntrinsicIconScaleFactor(); // The child may be scaled (always about the center of the view) so to account for it, // we have to offset the position by the scaled size. Once we do that, we can center // the drag view about the scaled child view. toY += Math.round(toScale * tv.getPaddingTop()); toY -= dragView.getMeasuredHeight() * (1 - toScale) / 2; if (dragView.getDragVisualizeOffset() != null) { toY -= Math.round(toScale * dragView.getDragVisualizeOffset().y); } toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2; } else if (child instanceof FolderIcon) { // Account for holographic blur padding on the drag view toY += Math.round(scale * (child.getPaddingTop() - dragView.getDragRegionTop())); toY -= scale * Workspace.DRAG_BITMAP_PADDING / 2; toY -= (1 - scale) * dragView.getMeasuredHeight() / 2; // Center in the x coordinate about the target's drawable toX -= (dragView.getMeasuredWidth() - Math.round(scale * child.getMeasuredWidth())) / 2; } else { toY -= (Math.round(scale * (dragView.getHeight() - child.getMeasuredHeight()))) / 2; toX -= (Math.round(scale * (dragView.getMeasuredWidth() - child.getMeasuredWidth()))) / 2; } final int fromX = r.left; final int fromY = r.top; child.setVisibility(INVISIBLE); Runnable onCompleteRunnable = new Runnable() { public void run() { child.setVisibility(VISIBLE); if (onFinishAnimationRunnable != null) { onFinishAnimationRunnable.run(); } } }; animateViewIntoPosition(dragView, fromX, fromY, toX, toY, 1, 1, 1, toScale, toScale, onCompleteRunnable, ANIMATION_END_DISAPPEAR, duration, anchorView); }
Example 19
Source Project: pushdown-anim-click File: PushDownAnim.java License: Apache License 2.0 | 4 votes |
private PushDownAnim( final View view ){ this.weakView = new WeakReference<>(view) ; this.weakView.get().setClickable( true ); defaultScale = view.getScaleX(); }
Example 20
Source Project: RecyclerBanner File: OverFlyingLayoutManager.java License: Apache License 2.0 | 2 votes |
/** * cause elevation is not support below api 21, * so you can set your elevation here for supporting it below api 21 * or you can just setElevation in {@link #setItemViewProperty(View, float)} */ protected float setViewElevation(View itemView, float targetOffset) { return itemView.getScaleX() * 5; }