@Override public void setAlpha(@IntRange(from = 0, to = 255) int alpha) { this.alpha = alpha; }
/** * Extracts "Segment" part from composed ID. * * @param composedId Composed ID * @return Segment part */ @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) public static int extractSegmentPart(long composedId) { return (int) ((composedId & BIT_MASK_SEGMENT) >>> BIT_OFFSET_SEGMENT); }
/** * Extracts "Segment" part from composed view type. * * @param composedViewType Composed view type * @return Segment part */ @IntRange(from = MIN_SEGMENT, to = MAX_SEGMENT) public static int extractSegmentPart(int composedViewType) { return (composedViewType & BIT_MASK_SEGMENT) >>> BIT_OFFSET_SEGMENT; }
/** * Extracts "Wrapped view type" part from composed view type. * * @param composedViewType Composed view type * @return Wrapped view type part */ @IntRange(from = MIN_WRAPPED_VIEW_TYPE, to = MAX_WRAPPED_VIEW_TYPE) public static int extractWrappedViewTypePart(int composedViewType) { return (composedViewType << (32 - BIT_WIDTH_WRAPPED_VIEW_TYPE - BIT_OFFSET_WRAPPED_VIEW_TYPE)) >> (32 - BIT_WIDTH_WRAPPED_VIEW_TYPE); }
/** * <p>Gets the ID for the group at the given position. This group ID must be unique across groups.</p> * <p>The combined ID (see {@link RecyclerViewExpandableItemManager#getCombinedGroupId(long)}) * must be unique across ALL items (groups and all children).</p> * * @param groupPosition the position of the group for which the ID is wanted * @return the ID associated with the group */ @IntRange(from = ItemIdComposer.MIN_GROUP_ID, to = ItemIdComposer.MAX_GROUP_ID) long getGroupId(int groupPosition);
@Override public void setAlpha(@IntRange(from = 0, to = 255) int alpha) { mPaint.setAlpha(alpha); }
@IntRange(from=0, to=255) private int getOpacityAtPosition(double position, double[] positions, double[] opacities) { for (int i = 1; i < positions.length; i++) { double lastPosition = positions[i - 1]; double thisPosition = positions[i]; if (positions[i] >= position) { double progress = (position - lastPosition) / (thisPosition - lastPosition); return (int) (255 * MiscUtils.lerp(opacities[i - 1], opacities[i], progress)); } } return (int) (255 * opacities[opacities.length - 1]); } }
/** * See {@link GifDrawable#getFrameDuration(int)} * * @param index index of the frame * @return duration of the given frame in milliseconds * @throws IndexOutOfBoundsException if {@code index < 0 || index >= <number of frames>} */ public int getFrameDuration(@IntRange(from = 0) int index) { return mGifInfoHandle.getFrameDuration(index); }
/** * Sets loop count of the animation. Loop count must be in range {@code <0 ,65535>} * * @param loopCount loop count, 0 means infinity */ public void setLoopCount(@IntRange(from = 0, to = Character.MAX_VALUE) final int loopCount) { mNativeInfoHandle.setLoopCount(loopCount); }
/** * Seeks to given frame * * @param index index of the frame * @throws IndexOutOfBoundsException if {@code index < 0 || index >= <number of frames>} */ public void seekToFrame(@IntRange(from = 0) int index) { mGifInfoHandle.seekToFrameGL(index); }
/** * Returns duration of the given frame (in milliseconds). If there is no data (no Graphics * Control Extension blocks or drawable is recycled) 0 is returned. * * @param index index of the frame * @return duration of the given frame in milliseconds * @throws IndexOutOfBoundsException if index < 0 or index >= number of frames */ public int getFrameDuration(@IntRange(from = 0) final int index) { return mNativeInfoHandle.getFrameDuration(index); }
void setLoopCount(@IntRange(from = 0, to = Character.MAX_VALUE) final int loopCount) { if (loopCount < 0 || loopCount > Character.MAX_VALUE) { throw new IllegalArgumentException("Loop count of range <0, 65535>"); } synchronized (this) { setLoopCount(gifInfoPtr, (char) loopCount); } }
private void throwIfFrameIndexOutOfBounds(@IntRange(from = 0) final int index) { final int numberOfFrames = getNumberOfFrames(gifInfoPtr); if (index < 0 || index >= numberOfFrames) { throw new IndexOutOfBoundsException("Frame index is not in range <0;" + numberOfFrames + '>'); } } }
/** * See {@link GifDrawable#getFrameDuration(int)} * * @param index index of the frame * @return duration of the given frame in milliseconds * @throws IndexOutOfBoundsException if {@code index < 0 || index >= <number of frames>} */ public int getFrameDuration(@IntRange(from = 0) int index) { return mGifInfoHandle.getFrameDuration(index); }
synchronized void seekToFrame(@IntRange(from = 0, to = Integer.MAX_VALUE) final int frameIndex, final Bitmap buffer) { seekToFrame(gifInfoPtr, frameIndex, buffer); }
/** * See {@link GifDrawable#seekTo(int)} * * @param position position to seek to in milliseconds * @param buffer the frame buffer * @throws IllegalArgumentException if {@code position < 0 }or {@code buffer} is recycled */ public void seekToTime(@IntRange(from = 0, to = Integer.MAX_VALUE) final int position, @NonNull final Bitmap buffer) { checkBuffer(buffer); mGifInfoHandle.seekToTime(position, buffer); }
/** * See {@link GifDrawable#seekToFrame(int)} * * @param frameIndex position to seek to in milliseconds * @param buffer the frame buffer * @throws IllegalArgumentException if {@code frameIndex < 0} or {@code buffer} is recycled */ public void seekToFrame(@IntRange(from = 0, to = Integer.MAX_VALUE) final int frameIndex, @NonNull final Bitmap buffer) { checkBuffer(buffer); mGifInfoHandle.seekToFrame(frameIndex, buffer); }
/** * Sample size controlling subsampling, see {@link GifOptions#setInSampleSize(int)} for more details. * Note that this call will overwrite sample size set previously by {@link #options(GifOptions)} * * @param sampleSize the sample size * @return this builder instance, to chain calls */ public T sampleSize(@IntRange(from = 1, to = Character.MAX_VALUE) final int sampleSize) { mOptions.setInSampleSize(sampleSize); return self(); }
synchronized int getFrameDuration(@IntRange(from = 0) final int index) { throwIfFrameIndexOutOfBounds(index); return getFrameDuration(gifInfoPtr, index); }
/** * Set the alpha component of {@code color} to be {@code alpha}. */ public static @CheckResult @ColorInt int modifyAlpha(@ColorInt int color, @IntRange(from = 0, to = 255) int alpha) { return (color & 0x00ffffff) | (alpha << 24); }