Class Utils


  • public final class Utils
    extends java.lang.Object
    • Method Detail

      • closeQuietly

        public static void closeQuietly​(java.io.Closeable closeable)
      • getScale

        public static float getScale​(Matrix matrix)
      • hasZeroScaleAxis

        public static boolean hasZeroScaleAxis​(Matrix matrix)
      • applyTrimPathIfNeeded

        public static void applyTrimPathIfNeeded​(Path path,
                                                 @Nullable
                                                 TrimPathContent trimPath)
      • applyTrimPathIfNeeded

        public static void applyTrimPathIfNeeded​(Path path,
                                                 float startValue,
                                                 float endValue,
                                                 float offsetValue)
      • isAtLeastVersion

        public static boolean isAtLeastVersion​(int major,
                                               int minor,
                                               int patch,
                                               int minMajor,
                                               int minMinor,
                                               int minPatch)
      • hashFor

        public static int hashFor​(float a,
                                  float b,
                                  float c,
                                  float d)
      • dpScale

        public static float dpScale()
      • getAnimationScale

        public static float getAnimationScale​(Context context)
      • resizeBitmapIfNeeded

        public static Bitmap resizeBitmapIfNeeded​(Bitmap bitmap,
                                                  int width,
                                                  int height)
        Resize the bitmap to exactly the same size as the specified dimension, changing the aspect ratio if needed. Returns the original bitmap if the dimensions already match.
      • isNetworkException

        public static boolean isNetworkException​(java.lang.Throwable e)
        From http://vaibhavblogs.org/2012/12/common-java-networking-exceptions/
      • saveLayerCompat

        public static void saveLayerCompat​(Canvas canvas,
                                           RectF rect,
                                           Paint paint)
      • saveLayerCompat

        public static void saveLayerCompat​(Canvas canvas,
                                           RectF rect,
                                           Paint paint,
                                           int flag)
      • renderPath

        public static Bitmap renderPath​(Path path)
        For testing purposes only. DO NOT USE IN PRODUCTION.