Class DynamicPickerUtils
java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicPickerUtils
Helper class to perform various
SeekBar
operations.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Paint
getAlphaPatternPaint
(int pixelSize) Returns an alpha pattern paint.static String
Returns the default value for the color palette according to the available functionality.static String
Returns the default value for the night theme according to the available functionality.static int[]
Returns the hue colors.static LinearGradient
getHueGradient
(float width, float height) Returns the hue gradient.static int
Returns the recently copied color from the shared preferences.static Uri
saveToFile
(Context context, LifecycleOwner owner, Uri file, String mimeType, int requestCode) Try to request a storage location for the supplied file.static Uri
saveToFile
(Context context, LifecycleOwner owner, Uri file, String mimeType, int requestCode, boolean downloads, String fileName) Try to request a storage location for the supplied file.static File
saveToFile
(Context context, LifecycleOwner owner, File file, String mimeType, int requestCode) Try to request a storage location for the supplied file.static File
saveToFile
(Context context, LifecycleOwner owner, File file, String mimeType, int requestCode, boolean downloads, String fileName) Try to request a storage location for the supplied file.static boolean
selectFile
(Context context, LifecycleOwner owner, String mimeType, int requestCode) Try to request an intent to select a file according to the supplied mime type.static void
setHueDrawable
(SeekBar seekBar) Set a hue gradient progress drawable for a seek bar.static void
setRecentColor
(int color) Save the recently copied color to shared preferences.
-
Constructor Details
-
DynamicPickerUtils
public DynamicPickerUtils()
-
-
Method Details
-
getDefaultNightThemeAlt
Returns the default value for the night theme according to the available functionality.- Returns:
- The default value for the night theme according to the available functionality.
- See Also:
-
getDefaultColorPalette
Returns the default value for the color palette according to the available functionality.- Returns:
- The default value for the color palette according to the available functionality.
- See Also:
-
getHueColors
Returns the hue colors.- Returns:
- The hue colors.
-
getHueGradient
Returns the hue gradient.- Parameters:
width
- The gradient width.height
- The gradient height.- Returns:
- The hue gradient.
-
getAlphaPatternPaint
Returns an alpha pattern paint.- Parameters:
pixelSize
- The size of one pixel.- Returns:
- The alpha pattern.
-
setHueDrawable
Set a hue gradient progress drawable for a seek bar.- Parameters:
seekBar
- The seek bar to set the hue gradient.
-
setRecentColor
Save the recently copied color to shared preferences.- Parameters:
color
- The color to be saved.
-
getRecentColor
Returns the recently copied color from the shared preferences.- Returns:
- The recently copied color from the shared preferences.
-
saveToFile
@Nullable public static Uri saveToFile(@Nullable Context context, @Nullable LifecycleOwner owner, @Nullable Uri file, @NonNull String mimeType, int requestCode, boolean downloads, @Nullable String fileName) Try to request a storage location for the supplied file.- Parameters:
context
- The context to get the file URI.owner
- The requesting owner for the intent.file
- The file URI to request the storage location.mimeType
- The mime type of the file.requestCode
- The request code for the intent.downloads
-true
to return the download location on unsupported API levels.fileName
- The default file name.- Returns:
null
if the request for storage location for the supplied file was successful. Otherwise, thedownloads
location URI based on the supplied parameter.- See Also:
-
saveToFile
@Nullable public static Uri saveToFile(@Nullable Context context, @Nullable LifecycleOwner owner, @Nullable Uri file, @NonNull String mimeType, int requestCode) Try to request a storage location for the supplied file.- Parameters:
context
- The context to get the file URI.owner
- The requesting owner for the intent.file
- The file URI to request the storage location.mimeType
- The mime type of the file.requestCode
- The request code for the intent.- Returns:
null
if the request for storage location for the supplied file was successful. Otherwise, thedownloads
location URI.- See Also:
-
saveToFile
@Nullable public static File saveToFile(@Nullable Context context, @Nullable LifecycleOwner owner, @Nullable File file, @NonNull String mimeType, int requestCode, boolean downloads, @Nullable String fileName) Try to request a storage location for the supplied file.- Parameters:
context
- The context to get the file URI.owner
- The requesting owner for the intent.file
- The file to request the storage location.mimeType
- The mime type of the file.requestCode
- The request code for the intent.downloads
-true
to return the download location on unsupported API levels.fileName
- The default file name.- Returns:
null
if the request for storage location for the supplied file was successful. Otherwise, thedownloads
location URI based on the supplied parameter.- See Also:
-
saveToFile
@Nullable public static File saveToFile(@Nullable Context context, @Nullable LifecycleOwner owner, @Nullable File file, @NonNull String mimeType, int requestCode) Try to request a storage location for the supplied file.- Parameters:
context
- The context to get the file URI.owner
- The requesting owner for the intent.file
- The file to request the storage location.mimeType
- The mime type of the file.requestCode
- The request code for the intent.- Returns:
null
if the request for storage location for the supplied file was successful. Otherwise, thedownloads
location URI.- See Also:
-
selectFile
public static boolean selectFile(@Nullable Context context, @Nullable LifecycleOwner owner, @NonNull String mimeType, int requestCode) Try to request an intent to select a file according to the supplied mime type.- Parameters:
context
- The context to get the file URI.owner
- The requesting owner for the intent.mimeType
- The mime type of the file.requestCode
- The request code for the intent.- Returns:
null
if the request for storage location for the supplied file was successful. Otherwise, thedownloads
location URI.- See Also:
-