Class DynamicShapeUtils

java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicShapeUtils

public class DynamicShapeUtils extends Object
Helper class to perform shape operations.
  • Constructor Details

    • DynamicShapeUtils

      public DynamicShapeUtils()
  • Method Details

    • getSlideCornerSize

      @DrawableRes public static int getSlideCornerSize(float cornerSize)
      Returns the corner size for the slider according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The corner size for the slider according to the supplied corner size.
    • getOverlayRes

      @DrawableRes public static int getOverlayRes(float cornerSize)
      Returns the overlay resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The overlay resource according to the supplied corner size.
    • getOverlayStartRes

      @DrawableRes public static int getOverlayStartRes(float cornerSize)
      Returns the overlay start resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The overlay start resource according to the supplied corner size.
    • getOverlayEndRes

      @DrawableRes public static int getOverlayEndRes(float cornerSize)
      Returns the overlay end resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The overlay end resource according to the supplied corner size.
    • getOverlayDimRes

      @DrawableRes public static int getOverlayDimRes(float cornerSize)
      Returns the dim overlay resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The dim overlay resource according to the supplied corner size.
    • getTabIndicatorRes

      @DrawableRes public static int getTabIndicatorRes(float cornerSize)
      Returns the tab indicator resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The tab indicator resource according to the supplied corner size.
    • getListSelectorRes

      @DrawableRes public static int getListSelectorRes(float cornerSize)
      Returns the list selector resource according to the supplied corner size.
      Parameters:
      cornerSize - The corner size to be considered in dips.
      Returns:
      The list selector resource according to the supplied corner size.
    • getCornerDrawable

      @NonNull public static Drawable getCornerDrawable(float cornerRadius, @ColorInt int color, boolean topOnly, boolean adjustCorner)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      adjustCorner - true to automatically adjust the corner radius.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.
    • getCornerDrawable

      @NonNull public static Drawable getCornerDrawable(float cornerRadius, @ColorInt int color, boolean topOnly)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.
    • getCornerDrawableWithStroke

      @NonNull public static Drawable getCornerDrawableWithStroke(float cornerRadius, @ColorInt int color, boolean topOnly, boolean adjustCorner, float strokeSize, @ColorInt int strokeColor)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      adjustCorner - true to automatically adjust the corner radius.
      strokeSize - The size greater than 0 in dip to enable the stroke.
      strokeColor - The color for the stroke.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.
    • getCornerDrawableWithStroke

      @NonNull public static Drawable getCornerDrawableWithStroke(float cornerRadius, @ColorInt int color, boolean topOnly, boolean adjustCorner)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      adjustCorner - true to automatically adjust the corner radius.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.
    • getCornerDrawableWithStroke

      @NonNull public static Drawable getCornerDrawableWithStroke(float cornerRadius, @ColorInt int color, boolean topOnly, @ColorInt int strokeColor)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      strokeColor - The color for the stroke.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.
    • getCornerDrawableWithStroke

      @NonNull public static Drawable getCornerDrawableWithStroke(float cornerRadius, @ColorInt int color, boolean topOnly)
      Returns a MaterialShapeDrawable drawable according to the supplied parameters.
      Parameters:
      cornerRadius - The corner size in dip for the drawable.
      color - The color for the drawable.
      topOnly - true to round the top corners only.
      Returns:
      The MaterialShapeDrawable drawable according to the supplied parameters.