Class DynamicShapeUtils
java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicShapeUtils
Helper class to perform shape operations.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Drawable
getCornerDrawable
(float cornerRadius, int color, boolean topOnly) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static Drawable
getCornerDrawable
(float cornerRadius, int color, boolean topOnly, boolean adjustCorner) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static Drawable
getCornerDrawableWithStroke
(float cornerRadius, int color, boolean topOnly) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static Drawable
getCornerDrawableWithStroke
(float cornerRadius, int color, boolean topOnly, boolean adjustCorner) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static Drawable
getCornerDrawableWithStroke
(float cornerRadius, int color, boolean topOnly, boolean adjustCorner, float strokeSize, int strokeColor) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static Drawable
getCornerDrawableWithStroke
(float cornerRadius, int color, boolean topOnly, int strokeColor) Returns aMaterialShapeDrawable
drawable according to the supplied parameters.static int
getListSelectorRes
(float cornerSize) Returns the list selector resource according to the supplied corner size.static int
getOverlayDimRes
(float cornerSize) Returns the dim overlay resource according to the supplied corner size.static int
getOverlayEndRes
(float cornerSize) Returns the overlay end resource according to the supplied corner size.static int
getOverlayRes
(float cornerSize) Returns the overlay resource according to the supplied corner size.static int
getOverlayStartRes
(float cornerSize) Returns the overlay start resource according to the supplied corner size.static int
getSlideCornerSize
(float cornerSize) Returns the corner size for the slider according to the supplied corner size.static int
getTabIndicatorRes
(float cornerSize) Returns the tab indicator resource according to the supplied corner size.
-
Constructor Details
-
DynamicShapeUtils
public DynamicShapeUtils()
-
-
Method Details
-
getSlideCornerSize
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
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
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
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
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
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
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 aMaterialShapeDrawable
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 aMaterialShapeDrawable
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 aMaterialShapeDrawable
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 sizegreater 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 aMaterialShapeDrawable
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 aMaterialShapeDrawable
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 aMaterialShapeDrawable
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.
-