Java Code Examples for android.graphics.Rect#equals()

The following examples show how to use android.graphics.Rect#equals() . 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: SwitchAccessNodeCompat.java    From talkback with Apache License 2.0 6 votes vote down vote up
private void addDescendantsWithBoundsToList(
    List<SwitchAccessNodeCompat> listOfNodes, Rect bounds) {
  Rect childBounds = new Rect();
  for (int i = 0; i < getChildCount(); i++) {
    SwitchAccessNodeCompat child = getChild(i);
    if (child == null) {
      continue;
    }
    child.getBoundsInScreen(childBounds);
    if (bounds.equals(childBounds) && !listOfNodes.contains(child)) {
      child.boundsDuplicateAncestor = true;
      listOfNodes.add(child);
      child.addDescendantsWithBoundsToList(listOfNodes, bounds);
    } else {
      // Children can't be bigger than parents, so once the bounds are different they
      // must be smaller, and further descendants won't duplicate the bounds
      child.recycle();
    }
  }
}
 
Example 2
Source File: FormWatchFace.java    From FORMWatchFace with Apache License 2.0 6 votes vote down vote up
@Override
public void onPeekCardPositionUpdate(Rect bounds) {
    super.onPeekCardPositionUpdate(bounds);
    LOGD(TAG, "onPeekCardPositionUpdate: " + bounds);
    if (!bounds.equals(mCardBounds)) {
        mCardBounds.set(bounds);

        mBottomBoundAnimator.cancel();
        mBottomBoundAnimator.setFloatValues(
                (Float) mBottomBoundAnimator.getAnimatedValue(),
                mCardBounds.top > 0 ? mCardBounds.top : mHeight);
        mBottomBoundAnimator.setDuration(200);
        mBottomBoundAnimator.start();

        mSecondsAlphaAnimator.cancel();
        mSecondsAlphaAnimator.setFloatValues(
                (Float) mSecondsAlphaAnimator.getAnimatedValue(),
                mCardBounds.top > 0 ? 0f : 1f);
        mSecondsAlphaAnimator.setDuration(200);
        mSecondsAlphaAnimator.start();

        LOGD(TAG, "onPeekCardPositionUpdate: " + mCardBounds);
        postInvalidate();
    }
}
 
Example 3
Source File: BigBangHeader.java    From ankihelper with GNU General Public License v3.0 6 votes vote down vote up
@Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        int width = getMeasuredWidth();
        int height = getMeasuredHeight();

        layoutSubView(mSearch, mActionGap, 0);
        layoutSubView(mShare, 2 * mActionGap + mSearch.getMeasuredWidth(), 0);
        layoutSubView(mTrans, 3 * mActionGap + mTrans.getMeasuredWidth() + mShare.getMeasuredWidth(), 0);

//        layoutSubView(mSelectAll, 2 * mActionGap + mSearch.getMeasuredWidth() , 0);
//        layoutSubView(mSelectOther, 3 * mActionGap + mTrans.getMeasuredWidth()+ mShare.getMeasuredWidth() , 0);
//
//        layoutSubView(mDrag, width - mActionGap * 2 - mShare.getMeasuredWidth() - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mCopy, width - mActionGap - mCopy.getMeasuredWidth(), 0);
        layoutSubView(mClose, ((width - (this.mActionGap * 2)) - this.mCopy.getMeasuredWidth()) - this.mClose.getMeasuredHeight(), 0);

        Rect oldBounds = mBorder.getBounds();
        Rect newBounds = new Rect(0, mSearch.getMeasuredHeight() / 2, width, height);

        if (!stickHeader && !oldBounds.equals(newBounds)) {
            ObjectAnimator.ofObject(new BoundWrapper(oldBounds), "bound", new RectEvaluator(), oldBounds, newBounds).setDuration(200).start();
        }
    }
 
Example 4
Source File: VisibilityOutputsExtension.java    From litho with Apache License 2.0 6 votes vote down vote up
/** Returns true if the component is in the focused visible range. */
private boolean isInFocusedRange(Rect componentBounds, Rect componentVisibleBounds) {
  final View parent = (View) mHost.getParent();
  if (parent == null) {
    return false;
  }

  final int halfViewportArea = parent.getWidth() * parent.getHeight() / 2;
  final int totalComponentArea = computeRectArea(componentBounds);
  final int visibleComponentArea = computeRectArea(componentVisibleBounds);

  // The component has entered the focused range either if it is larger than half of the viewport
  // and it occupies at least half of the viewport or if it is smaller than half of the viewport
  // and it is fully visible.
  return (totalComponentArea >= halfViewportArea)
      ? (visibleComponentArea >= halfViewportArea)
      : componentBounds.equals(componentVisibleBounds);
}
 
Example 5
Source File: TimeCatHeader.java    From timecat with Apache License 2.0 6 votes vote down vote up
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();

    layoutSubView(mSearch, mActionGap, 0);
    layoutSubView(mShare, 2 * mActionGap + mSearch.getMeasuredWidth(), 0);
    layoutSubView(mTrans, 3 * mActionGap + mTrans.getMeasuredWidth() + mShare.getMeasuredWidth(), 0);
    layoutSubView(mTask, 4 * mActionGap + mTask.getMeasuredWidth() + mTrans.getMeasuredWidth() + mShare.getMeasuredWidth(), 0);
    layoutSubView(mCopy, width - mActionGap - mCopy.getMeasuredWidth(), 0);

    Rect oldBounds = mBorder.getBounds();
    Rect newBounds = new Rect(0, mSearch.getMeasuredHeight() / 2, width, height);

    if (!stickHeader && !oldBounds.equals(newBounds)) {
        ObjectAnimator.ofObject(new BoundWrapper(oldBounds), "bound", new RectEvaluator(), oldBounds, newBounds).setDuration(200).start();
    }
}
 
Example 6
Source File: TaskImageContainer.java    From Camera2 with Apache License 2.0 5 votes vote down vote up
/**
 * Returns whether the crop operation is required.
 *
 * @param image Image to be cropped
 * @param crop  Crop region
 * @return whether the image needs any more processing to be cropped
 * properly.
 */
public boolean requiresCropOperation(ImageProxy image, @Nullable Rect crop)
{
    if (crop == null)
    {
        return false;
    }

    return !(crop.equals(new Rect(0, 0, image.getWidth(), image.getHeight())));
}
 
Example 7
Source File: AnimatedDrawableBackendImpl.java    From FanXin-based-HuanXin with GNU General Public License v2.0 5 votes vote down vote up
@Override
public AnimatedDrawableBackend forNewBounds(Rect bounds) {
  Rect boundsToUse = getBoundsToUse(mAnimatedImage, bounds);
  if (boundsToUse.equals(mRenderedBounds)) {
    // Actual bounds aren't changed.
    return this;
  }
  return new AnimatedDrawableBackendImpl(
      mAnimatedDrawableUtil,
      mAnimatedImageResult,
      bounds);
}
 
Example 8
Source File: BadgeDrawable.java    From material-components-android with Apache License 2.0 5 votes vote down vote up
private void updateCenterAndBounds() {
  Context context = contextRef.get();
  View anchorView = anchorViewRef != null ? anchorViewRef.get() : null;
  if (context == null || anchorView == null) {
    return;
  }
  Rect tmpRect = new Rect();
  tmpRect.set(badgeBounds);

  Rect anchorRect = new Rect();
  // Retrieves the visible bounds of the anchor view.
  anchorView.getDrawingRect(anchorRect);

  ViewGroup customBadgeParent = customBadgeParentRef != null ? customBadgeParentRef.get() : null;
  if (customBadgeParent != null || BadgeUtils.USE_COMPAT_PARENT) {
    // Calculates coordinates relative to the parent.
    ViewGroup viewGroup =
        customBadgeParent == null ? (ViewGroup) anchorView.getParent() : customBadgeParent;
    viewGroup.offsetDescendantRectToMyCoords(anchorView, anchorRect);
  }

  calculateCenterAndBounds(context, anchorRect, anchorView);

  updateBadgeBounds(badgeBounds, badgeCenterX, badgeCenterY, halfBadgeWidth, halfBadgeHeight);

  shapeDrawable.setCornerSize(cornerRadius);
  if (!tmpRect.equals(badgeBounds)) {
    shapeDrawable.setBounds(badgeBounds);
  }
}
 
Example 9
Source File: InsettableFrameLayout.java    From LaunchEnr with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setInsets(Rect insets) {
    // If the insets haven't changed, this is a no-op. Avoid unnecessary layout caused by
    // modifying child layout params.
    if (insets.equals(mInsets)) return;

    final int n = getChildCount();
    for (int i = 0; i < n; i++) {
        final View child = getChildAt(i);
        setFrameLayoutChildInsets(child, insets, mInsets);
    }
    mInsets.set(insets);
}
 
Example 10
Source File: FloatingActionModeHelper.java    From ProjectX with Apache License 2.0 5 votes vote down vote up
private void invalidateContentRect(boolean force) {
    if (force) {
        mCallback.onGetContentRect(mMode, mTarget, mContentBound);
    } else {
        final Rect bound = tRect;
        mCallback.onGetContentRect(mMode, mTarget, bound);
        if (bound.equals(mContentBound))
            return;
        mContentBound.set(bound);
    }
    mView.invalidateViewData(mTarget, mMenu, mContentBound);
    mView.updateViewLayout();
}
 
Example 11
Source File: NodeCachedBoundsCalculator.java    From talkback with Apache License 2.0 5 votes vote down vote up
public @Nullable Rect getBounds(AccessibilityNodeInfoCompat node) {
  Rect bounds = getBoundsInternal(node);
  if (bounds.equals(EMPTY_RECT)) {
    return null;
  }

  return bounds;
}
 
Example 12
Source File: AnimatedDrawableBackendImpl.java    From fresco with MIT License 5 votes vote down vote up
@Override
public AnimatedDrawableBackend forNewBounds(Rect bounds) {
  Rect boundsToUse = getBoundsToUse(mAnimatedImage, bounds);
  if (boundsToUse.equals(mRenderedBounds)) {
    // Actual bounds aren't changed.
    return this;
  }
  return new AnimatedDrawableBackendImpl(
      mAnimatedDrawableUtil, mAnimatedImageResult, bounds, mDownscaleFrameToDrawableDimensions);
}
 
Example 13
Source File: WallpaperManagerService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
public void setDisplayPadding(Rect padding, String callingPackage) {
    checkPermission(android.Manifest.permission.SET_WALLPAPER_HINTS);
    if (!isWallpaperSupported(callingPackage)) {
        return;
    }
    synchronized (mLock) {
        int userId = UserHandle.getCallingUserId();
        WallpaperData wallpaper = getWallpaperSafeLocked(userId, FLAG_SYSTEM);
        if (padding.left < 0 || padding.top < 0 || padding.right < 0 || padding.bottom < 0) {
            throw new IllegalArgumentException("padding must be positive: " + padding);
        }

        if (!padding.equals(wallpaper.padding)) {
            wallpaper.padding.set(padding);
            saveSettingsLocked(userId);
            if (mCurrentUserId != userId) return; // Don't change the properties now
            if (wallpaper.connection != null) {
                if (wallpaper.connection.mEngine != null) {
                    try {
                        wallpaper.connection.mEngine.setDisplayPadding(padding);
                    } catch (RemoteException e) {
                    }
                    notifyCallbacksLocked(wallpaper);
                } else if (wallpaper.connection.mService != null) {
                    // We've attached to the service but the engine hasn't attached back to us
                    // yet. This means it will be created with the previous dimensions, so we
                    // need to update it to the new dimensions once it attaches.
                    wallpaper.connection.mPaddingChanged = true;
                }
            }
        }
    }
}
 
Example 14
Source File: WindowStateAnimator.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void applyCrop(Rect clipRect, boolean recoveringMemory) {
    if (DEBUG_WINDOW_CROP) Slog.d(TAG, "applyCrop: win=" + mWin
            + " clipRect=" + clipRect);
    if (clipRect != null) {
        if (!clipRect.equals(mLastClipRect)) {
            mLastClipRect.set(clipRect);
            mSurfaceController.setCropInTransaction(clipRect, recoveringMemory);
        }
    } else {
        mSurfaceController.clearCropInTransaction(recoveringMemory);
    }
}
 
Example 15
Source File: ChangeImageTransform.java    From Transitions-Everywhere with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an Animator for ImageViews moving, changing dimensions, and/or changing
 * {@link android.widget.ImageView.ScaleType}.
 *
 * @param sceneRoot   The root of the transition hierarchy.
 * @param startValues The values for a specific target in the start scene.
 * @param endValues   The values for the target in the end scene.
 * @return An Animator to move an ImageView or null if the View is not an ImageView,
 * the Drawable changed, the View is not VISIBLE, or there was no change.
 */
@Nullable
@Override
public Animator createAnimator(@NonNull ViewGroup sceneRoot, @Nullable TransitionValues startValues,
                               @Nullable TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }
    Rect startBounds = (Rect) startValues.values.get(PROPNAME_BOUNDS);
    Rect endBounds = (Rect) endValues.values.get(PROPNAME_BOUNDS);
    if (startBounds == null || endBounds == null) {
        return null;
    }

    Matrix startMatrix = (Matrix) startValues.values.get(PROPNAME_MATRIX);
    Matrix endMatrix = (Matrix) endValues.values.get(PROPNAME_MATRIX);

    boolean matricesEqual = (startMatrix == null && endMatrix == null) ||
            (startMatrix != null && startMatrix.equals(endMatrix));

    if (startBounds.equals(endBounds) && matricesEqual) {
        return null;
    }

    ImageView imageView = (ImageView) endValues.view;
    Drawable drawable = imageView.getDrawable();
    int drawableWidth = drawable.getIntrinsicWidth();
    int drawableHeight = drawable.getIntrinsicHeight();

    ObjectAnimator animator;
    if (drawableWidth == 0 || drawableHeight == 0) {
        animator = createMatrixAnimator(imageView, new MatrixUtils.NullMatrixEvaluator(),
                MatrixUtils.IDENTITY_MATRIX, MatrixUtils.IDENTITY_MATRIX);
    } else {
        if (startMatrix == null) {
            startMatrix = MatrixUtils.IDENTITY_MATRIX;
        }
        if (endMatrix == null) {
            endMatrix = MatrixUtils.IDENTITY_MATRIX;
        }
        MatrixUtils.animateTransform(imageView, startMatrix);
        animator = createMatrixAnimator(imageView, new MatrixUtils.MatrixEvaluator(),
                startMatrix, endMatrix);
    }
    return animator;
}
 
Example 16
Source File: PageView.java    From AndroidDocumentViewer with MIT License 4 votes vote down vote up
public void updateHq(boolean update) {
    Rect viewArea = new Rect(getLeft(), getTop(), getRight(), getBottom());
    if (viewArea.width() == mSize.x || viewArea.height() == mSize.y) {
        // If the viewArea's size matches the unzoomed size, there is no need for an hq patch
        if (mPatch != null) {
            mPatch.setImageBitmap(null);
            mPatch.invalidate();
        }
    } else {
        final Point patchViewSize = new Point(viewArea.width(), viewArea.height());
        final Rect patchArea = new Rect(0, 0, mParentSize.x, mParentSize.y);

        // Intersect and test that there is an intersection
        if (!patchArea.intersect(viewArea))
            return;

        // Offset patch area to be relative to the view top left
        patchArea.offset(-viewArea.left, -viewArea.top);

        boolean area_unchanged = patchArea.equals(mPatchArea) && patchViewSize.equals(mPatchViewSize);

        // If being asked for the same area as last time and not because of an update then nothing to do
        if (area_unchanged && !update)
            return;

        boolean completeRedraw = !(area_unchanged && update);

        // Stop the drawing of previous patch if still going
        if (mDrawPatch != null) {
            mDrawPatch.cancel();
            mDrawPatch = null;
        }

        // Create and add the image view if not already done
        if (mPatch == null) {
            mPatch = new OpaqueImageView(mContext);
            mPatch.setScaleType(ImageView.ScaleType.MATRIX);
            addView(mPatch);
            mSearchView.bringToFront();
        }

        CancellableTaskDefinition<Void, Void> task;

        if (completeRedraw)
            task = getDrawPageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
                    patchArea.left, patchArea.top,
                    patchArea.width(), patchArea.height());
        else
            task = getUpdatePageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
                    patchArea.left, patchArea.top,
                    patchArea.width(), patchArea.height());

        mDrawPatch = new CancellableAsyncTask<Void, Void>(task) {

            public void onPostExecute(Void result) {
                mPatchViewSize = patchViewSize;
                mPatchArea = patchArea;
                mPatch.setImageBitmap(mPatchBm);
                mPatch.invalidate();
                //requestLayout();
                // Calling requestLayout here doesn't lead to a later call to layout. No idea
                // why, but apparently others have run into the problem.
                mPatch.layout(mPatchArea.left, mPatchArea.top, mPatchArea.right, mPatchArea.bottom);
            }
        };

        mDrawPatch.execute();
    }
}
 
Example 17
Source File: PageView.java    From PowerFileExplorer with GNU General Public License v3.0 4 votes vote down vote up
public void updateHq(boolean update) {
	Rect viewArea = new Rect(getLeft(), getTop(), getRight(), getBottom());
	if (viewArea.width() == mSize.x || viewArea.height() == mSize.y) {
		// If the viewArea's size matches the unzoomed size, there is no need for an hq patch
		if (mPatch != null) {
			mPatch.setImageBitmap(null);
			mPatch.invalidate();
		}
	} else {
		final Point patchViewSize = new Point(viewArea.width(), viewArea.height());
		final Rect patchArea = new Rect(0, 0, mParentSize.x, mParentSize.y);

		// Intersect and test that there is an intersection
		if (!patchArea.intersect(viewArea))
			return;

		// Offset patch area to be relative to the view top left
		patchArea.offset(-viewArea.left, -viewArea.top);

		boolean area_unchanged = patchArea.equals(mPatchArea) && patchViewSize.equals(mPatchViewSize);

		// If being asked for the same area as last time and not because of an update then nothing to do
		if (area_unchanged && !update)
			return;

		boolean completeRedraw = !(area_unchanged && update);

		// Stop the drawing of previous patch if still going
		if (mDrawPatch != null) {
			mDrawPatch.cancel();
			mDrawPatch = null;
		}

		// Create and add the image view if not already done
		if (mPatch == null) {
			mPatch = new OpaqueImageView(mContext);
			mPatch.setScaleType(ImageView.ScaleType.MATRIX);
			addView(mPatch);
			mSearchView.bringToFront();
		}

		CancellableTaskDefinition<Void, Void> task;

		if (completeRedraw)
			task = getDrawPageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
								   patchArea.left, patchArea.top,
								   patchArea.width(), patchArea.height());
		else
			task = getUpdatePageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
									 patchArea.left, patchArea.top,
									 patchArea.width(), patchArea.height());

		mDrawPatch = new CancellableAsyncTask<Void,Void>(task) {

			public void onPostExecute(Void result) {
				mPatchViewSize = patchViewSize;
				mPatchArea = patchArea;
				mPatch.setImageBitmap(mPatchBm);
				mPatch.invalidate();
				//requestLayout();
				// Calling requestLayout here doesn't lead to a later call to layout. No idea
				// why, but apparently others have run into the problem.
				mPatch.layout(mPatchArea.left, mPatchArea.top, mPatchArea.right, mPatchArea.bottom);
			}
		};

		mDrawPatch.execute();
	}
}
 
Example 18
Source File: PDFPageView.java    From Reader with Apache License 2.0 4 votes vote down vote up
@Override
public void updateHq(boolean update) {
    Rect viewArea = new Rect(getLeft(), getTop(), getRight(), getBottom());
    if (viewArea.width() == mSize.x || viewArea.height() == mSize.y) {
        // If the viewArea's size matches the unzoomed size, there is no need for an hq patch
        if (mPatch != null) {
            mPatch.setImageBitmap(null);
            mPatch.invalidate();
        }
    } else {
        //当前Pageview的实际大小
        final Point patchViewSize = new Point(viewArea.width(), viewArea.height());
        //表示实际要显示pdf的区域,也就是pdf与屏幕的重叠处
        final Rect patchArea = new Rect(0, 0, mParentSize.x, mParentSize.y);

        // Intersect and test that there is an intersection
        if (!patchArea.intersect(viewArea)) {
            return;
        }

        //重新计算重叠处的坐标,这个坐标是相对于当前PDF实际大小
        // Offset patch area to be relative to the view top left
        patchArea.offset(-viewArea.left, -viewArea.top);
        boolean area_unchanged = patchArea.equals(mPatchArea) && patchViewSize.equals(mPatchViewSize);

        // If being asked for the same area as last time and not because of an update then nothing to do
        if (area_unchanged && !update)
            return;
        boolean completeRedraw = !(area_unchanged && update);
        // Stop the drawing of previous patch if still going
        if (mDrawPatch != null) {
            mDrawPatch.cancelAndWait();
            mDrawPatch = null;
        }

        // Create and add the image view if not already done
        if (mPatch == null) {
            mPatch = new OpaqueImageView(mContext);
            mPatch.setScaleType(ImageView.ScaleType.MATRIX);
            addView(mPatch);
            mSearchView.bringToFront();
        }

        CancellableTaskDefinition<Void, Void> task;

        if (completeRedraw) {
            task = getDrawPageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
                    patchArea.left, patchArea.top,
                    patchArea.width(), patchArea.height());
        } else {
            task = getUpdatePageTask(mPatchBm, patchViewSize.x, patchViewSize.y,
                    patchArea.left, patchArea.top,
                    patchArea.width(), patchArea.height());
        }

        mDrawPatch = new CancellableAsyncTask<Void, Void>(task) {

            public void onPostExecute(Void result) {
                mPatchViewSize = patchViewSize;
                mPatchArea = patchArea;
                mPatch.setImageBitmap(mPatchBm);
                mPatch.invalidate();
                //requestLayout();
                // Calling requestLayout here doesn't lead to a later call to layout. No idea
                // why, but apparently others have run into the problem.
                mPatch.layout(mPatchArea.left, mPatchArea.top, mPatchArea.right, mPatchArea.bottom);
            }
        };

        mDrawPatch.execute();
    }
}
 
Example 19
Source File: ChangeImageTransform.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Creates an Animator for ImageViews moving, changing dimensions, and/or changing
 * {@link android.widget.ImageView.ScaleType}.
 *
 * @param sceneRoot   The root of the transition hierarchy.
 * @param startValues The values for a specific target in the start scene.
 * @param endValues   The values for the target in the end scene.
 * @return An Animator to move an ImageView or null if the View is not an ImageView,
 * the Drawable changed, the View is not VISIBLE, or there was no change.
 */
@Override
public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
        TransitionValues endValues) {
    if (startValues == null || endValues == null) {
        return null;
    }
    Rect startBounds = (Rect) startValues.values.get(PROPNAME_BOUNDS);
    Rect endBounds = (Rect) endValues.values.get(PROPNAME_BOUNDS);
    if (startBounds == null || endBounds == null) {
        return null;
    }

    Matrix startMatrix = (Matrix) startValues.values.get(PROPNAME_MATRIX);
    Matrix endMatrix = (Matrix) endValues.values.get(PROPNAME_MATRIX);

    boolean matricesEqual = (startMatrix == null && endMatrix == null) ||
            (startMatrix != null && startMatrix.equals(endMatrix));

    if (startBounds.equals(endBounds) && matricesEqual) {
        return null;
    }

    ImageView imageView = (ImageView) endValues.view;
    Drawable drawable = imageView.getDrawable();
    int drawableWidth = drawable.getIntrinsicWidth();
    int drawableHeight = drawable.getIntrinsicHeight();

    ObjectAnimator animator;
    if (drawableWidth == 0 || drawableHeight == 0) {
        animator = createNullAnimator(imageView);
    } else {
        if (startMatrix == null) {
            startMatrix = Matrix.IDENTITY_MATRIX;
        }
        if (endMatrix == null) {
            endMatrix = Matrix.IDENTITY_MATRIX;
        }
        ANIMATED_TRANSFORM_PROPERTY.set(imageView, startMatrix);
        animator = createMatrixAnimator(imageView, startMatrix, endMatrix);
    }
    return animator;
}
 
Example 20
Source File: ConfigurationContainer.java    From android_9.0.0_r45 with Apache License 2.0 4 votes vote down vote up
/**
 * Returns whether the two bounds are equal to each other or are a combination of null or empty.
 */
public static boolean equivalentBounds(Rect bounds, Rect other) {
    return bounds == other
            || (bounds != null && (bounds.equals(other) || (bounds.isEmpty() && other == null)))
            || (other != null && other.isEmpty() && bounds == null);
}