Class DynamicPickerUtils
java.lang.Object
com.pranavpandey.android.dynamic.support.util.DynamicPickerUtils
Helper class to perform various
SeekBar operations.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PaintgetAlphaPatternPaint(int pixelSize) Returns an alpha pattern paint.static StringReturns the default value for the color palette according to the available functionality.static StringReturns the default value for the night theme according to the available functionality.static int[]Returns the hue colors.static LinearGradientgetHueGradient(float width, float height) Returns the hue gradient.static intReturns the recently copied color from the shared preferences.static UrisaveToFile(Context context, LifecycleOwner owner, Uri file, String mimeType, int requestCode) Try to request a storage location for the supplied file.static UrisaveToFile(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 FilesaveToFile(Context context, LifecycleOwner owner, File file, String mimeType, int requestCode) Try to request a storage location for the supplied file.static FilesaveToFile(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 booleanselectFile(Context context, LifecycleOwner owner, String mimeType, int requestCode) Try to request an intent to select a file according to the supplied mime type.static voidsetHueDrawable(SeekBar seekBar) Set a hue gradient progress drawable for a seek bar.static voidsetRecentColor(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-trueto return the download location on unsupported API levels.fileName- The default file name.- Returns:
nullif the request for storage location for the supplied file was successful. Otherwise, thedownloadslocation 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:
nullif the request for storage location for the supplied file was successful. Otherwise, thedownloadslocation 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-trueto return the download location on unsupported API levels.fileName- The default file name.- Returns:
nullif the request for storage location for the supplied file was successful. Otherwise, thedownloadslocation 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:
nullif the request for storage location for the supplied file was successful. Otherwise, thedownloadslocation 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:
nullif the request for storage location for the supplied file was successful. Otherwise, thedownloadslocation URI.- See Also:
-