Loading core/java/android/view/PointerIcon.java +15 −4 Original line number Diff line number Diff line Loading @@ -480,11 +480,19 @@ public final class PointerIcon implements Parcelable { mBitmapFrames = new Bitmap[frames - 1]; final int width = drawable.getIntrinsicWidth(); final int height = drawable.getIntrinsicHeight(); final boolean isVectorAnimation = drawable instanceof VectorDrawable; mDrawNativeDropShadow = isVectorAnimation; for (int i = 1; i < frames; ++i) { Drawable drawableFrame = animationDrawable.getFrame(i); if (!(drawableFrame instanceof BitmapDrawable)) { if (!(drawableFrame instanceof BitmapDrawable) && !(drawableFrame instanceof VectorDrawable)) { throw new IllegalArgumentException("Frame of an animated pointer icon " + "must refer to a bitmap drawable."); + "must refer to a bitmap drawable or vector drawable."); } if (isVectorAnimation != (drawableFrame instanceof VectorDrawable)) { throw new IllegalArgumentException("The drawable of the " + i + "-th frame " + "is a different type from the others. All frames should be the " + "same type."); } if (drawableFrame.getIntrinsicWidth() != width || drawableFrame.getIntrinsicHeight() != height) { Loading @@ -492,8 +500,11 @@ public final class PointerIcon implements Parcelable { + "is different. All frames should have the exact same size and " + "share the same hotspot."); } BitmapDrawable bitmapDrawableFrame = (BitmapDrawable) drawableFrame; mBitmapFrames[i - 1] = getBitmapFromDrawable(bitmapDrawableFrame); if (isVectorAnimation) { drawableFrame = getBitmapDrawableFromVectorDrawable(resources, (VectorDrawable) drawableFrame); } mBitmapFrames[i - 1] = getBitmapFromDrawable((BitmapDrawable) drawableFrame); } } } Loading Loading
core/java/android/view/PointerIcon.java +15 −4 Original line number Diff line number Diff line Loading @@ -480,11 +480,19 @@ public final class PointerIcon implements Parcelable { mBitmapFrames = new Bitmap[frames - 1]; final int width = drawable.getIntrinsicWidth(); final int height = drawable.getIntrinsicHeight(); final boolean isVectorAnimation = drawable instanceof VectorDrawable; mDrawNativeDropShadow = isVectorAnimation; for (int i = 1; i < frames; ++i) { Drawable drawableFrame = animationDrawable.getFrame(i); if (!(drawableFrame instanceof BitmapDrawable)) { if (!(drawableFrame instanceof BitmapDrawable) && !(drawableFrame instanceof VectorDrawable)) { throw new IllegalArgumentException("Frame of an animated pointer icon " + "must refer to a bitmap drawable."); + "must refer to a bitmap drawable or vector drawable."); } if (isVectorAnimation != (drawableFrame instanceof VectorDrawable)) { throw new IllegalArgumentException("The drawable of the " + i + "-th frame " + "is a different type from the others. All frames should be the " + "same type."); } if (drawableFrame.getIntrinsicWidth() != width || drawableFrame.getIntrinsicHeight() != height) { Loading @@ -492,8 +500,11 @@ public final class PointerIcon implements Parcelable { + "is different. All frames should have the exact same size and " + "share the same hotspot."); } BitmapDrawable bitmapDrawableFrame = (BitmapDrawable) drawableFrame; mBitmapFrames[i - 1] = getBitmapFromDrawable(bitmapDrawableFrame); if (isVectorAnimation) { drawableFrame = getBitmapDrawableFromVectorDrawable(resources, (VectorDrawable) drawableFrame); } mBitmapFrames[i - 1] = getBitmapFromDrawable((BitmapDrawable) drawableFrame); } } } Loading