Object ViewUtils

  • All Implemented Interfaces:

    
    public class ViewUtils
    
                        
    • Constructor Detail

    • Method Detail

      • addTo

         final <T extends View> T addTo(T $self, ViewGroup group, Function1<T, Unit> block)

        Shorthand extension function to add a View into a ViewGroup, and then run a scoped function

        Parameters:
        group - ViewGroup to add this View into
        block - A scoped function, with the View as its receiver
      • addTo

         final <T extends View> T addTo(T $self, ViewGroup group, Integer index, Function1<T, Unit> block)

        Shorthand extension function to add a View into a ViewGroup at specified index, and then run a scoped function

        Parameters:
        group - ViewGroup to add this View into
        index - Index to insert this View at
        block - A scoped function, with the View as its receiver
      • setDefaultMargins

         final <T extends View> T setDefaultMargins(T $self, Boolean bottom, Boolean top, Boolean left, Boolean right)

        Adds default discord paddings as margins to a View. By default, margins are set for the bottom, left, and right of the View, but not the top.

        Parameters:
        bottom - Whether to set topMargin.
        top - Whether to set bottomMargin.
        left - Whether to set leftMargin.
        right - Whether to set rightMargin.