Class DynamicDialogUtils

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

public class DynamicDialogUtils extends Object
Helper class to perform DynamicDialog operations.
  • Constructor Details

    • DynamicDialogUtils

      public DynamicDialogUtils()
  • Method Details

    • setView

      public static DynamicDialog setView(@NonNull DynamicDialog alertDialog, @NonNull View view)
      Set custom view to a dialog with top padding to maintain uniform layout on all Android versions.
      Parameters:
      alertDialog - The alert dialog to set the custom view.
      view - The view to be used as the custom view.
      Returns:
      The alert dialog after setting the custom view.
    • getDialogTopPadding

      public static int getDialogTopPadding(@NonNull Context context)
      Get top padding of the dialog to maintain uniform layout on all Android versions.

      Generally, it is required in case of custom view in the dialog.

      Parameters:
      context - The context to get the resources.
      Returns:
      The top padding of the dialog.
    • bindDialog

      public static Dialog bindDialog(@Nullable View view, @NonNull Dialog dialog, int type, @StyleRes int windowAnimations)
      Bind the dialog with a window token.

      Useful to display it from a service.

      Parameters:
      view - The view to bind the dialog.
      dialog - The dialog to be displayed.
      type - The dialog type.
      windowAnimations - The custom animation used for the window.
      Returns:
      The bound dialog with the supplied view.
    • bindDialog

      public static Dialog bindDialog(@Nullable View view, @NonNull Dialog dialog, int type)
      Bind the dialog with a window token. Useful to display it from a service.
      Parameters:
      view - The view to bind the dialog.
      dialog - The dialog to be displayed.
      type - The dialog type.
      Returns:
      The bound dialog with the supplied view.