Class DynamicPickerUtils

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

public class DynamicPickerUtils extends Object
Helper class to perform various SeekBar operations.
  • Constructor Details

    • DynamicPickerUtils

      public DynamicPickerUtils()
  • Method Details

    • getDefaultNightThemeAlt

      public static String 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

      public static String 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

      @NonNull public static int[] getHueColors()
      Returns the hue colors.
      Returns:
      The hue colors.
    • getHueGradient

      @NonNull public static LinearGradient getHueGradient(float width, float height)
      Returns the hue gradient.
      Parameters:
      width - The gradient width.
      height - The gradient height.
      Returns:
      The hue gradient.
    • getAlphaPatternPaint

      @NonNull public static Paint getAlphaPatternPaint(int pixelSize)
      Returns an alpha pattern paint.
      Parameters:
      pixelSize - The size of one pixel.
      Returns:
      The alpha pattern.
    • setHueDrawable

      public static void setHueDrawable(@Nullable SeekBar seekBar)
      Set a hue gradient progress drawable for a seek bar.
      Parameters:
      seekBar - The seek bar to set the hue gradient.
    • setRecentColor

      public static void setRecentColor(@ColorInt int color)
      Save the recently copied color to shared preferences.
      Parameters:
      color - The color to be saved.
    • getRecentColor

      @ColorInt public static int 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, the downloads 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, the downloads 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, the downloads 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, the downloads 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, the downloads location URI.
      See Also: