-
public class AnimatedDrawableUtilUtility methods for AnimatedDrawable.
-
-
Method Summary
Modifier and Type Method Description voidfixFrameDurations(Array<int> frameDurationMs)Adjusts the frame duration array to respect logic for minimum frame duration time. intgetTotalDurationFromFrameDurations(Array<int> frameDurationMs)Gets the total duration of an image by summing up the duration of the frames. Array<int>getFrameTimeStampsFromDurations(Array<int> frameDurationsMs)Given an array of frame durations, generate an array of timestamps corresponding to when eachframe beings. intgetFrameForTimestampMs(Array<int> frameTimestampsMs, int timestampMs)Gets the frame index for specified timestamp. intgetSizeOfBitmap(Bitmap bitmap)static booleanisOutsideRange(int startFrame, int endFrame, int frameNumber)Checks whether the specified frame number is outside the range inclusive of both start and end.If start <= end, start is within, end is within, and everything in between is within. -
-
Method Detail
-
fixFrameDurations
void fixFrameDurations(Array<int> frameDurationMs)
Adjusts the frame duration array to respect logic for minimum frame duration time.
- Parameters:
frameDurationMs- the frame duration array
-
getTotalDurationFromFrameDurations
int getTotalDurationFromFrameDurations(Array<int> frameDurationMs)
Gets the total duration of an image by summing up the duration of the frames.
- Parameters:
frameDurationMs- the frame duration array
-
getFrameTimeStampsFromDurations
Array<int> getFrameTimeStampsFromDurations(Array<int> frameDurationsMs)
Given an array of frame durations, generate an array of timestamps corresponding to when eachframe beings.
- Parameters:
frameDurationsMs- an array of frame durations
-
getFrameForTimestampMs
int getFrameForTimestampMs(Array<int> frameTimestampsMs, int timestampMs)
Gets the frame index for specified timestamp.
- Parameters:
frameTimestampsMs- an array of timestamps generated by )timestampMs- the timestamp
-
getSizeOfBitmap
int getSizeOfBitmap(Bitmap bitmap)
-
isOutsideRange
static boolean isOutsideRange(int startFrame, int endFrame, int frameNumber)
Checks whether the specified frame number is outside the range inclusive of both start and end.If start <= end, start is within, end is within, and everything in between is within. If start> end, start is within, end is within, everything less than start is within and everythinggreater than end is within. This behavior is useful for handling the wrapping case.
- Parameters:
startFrame- the start frameendFrame- the end frameframeNumber- the frame number
-
-
-
-