Class BannerAdSize

  • All Implemented Interfaces:
    java.io.Serializable

    public final class BannerAdSize
    extends java.lang.Object
    implements java.io.Serializable
    The size of a banner ad.
    See Also:
    Serialized Form
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      static BannerAdSize fixedSize​(android.content.Context context, int width, int height)
      Returns fixed banner size.
      int getHeight()
      Returns the height of this BannerAdSize in density-independent pixels (dp).
      int getHeight​(android.content.Context context)
      Returns the actual height of this BannerAdSize in density-independent pixels (dp).
      int getHeightInPixels​(android.content.Context context)
      Returns the actual height of this BannerAdSize in physical pixels.
      int getWidth()
      Returns the width of this BannerAdSize in density-independent pixels (dp).
      int getWidth​(android.content.Context context)
      Returns the actual width of this BannerAdSize in density-independent pixels (dp).
      int getWidthInPixels​(android.content.Context context)
      Returns the actual width of this BannerAdSize in physical pixels.
      int hashCode()  
      static BannerAdSize inlineSize​(android.content.Context context, int width, int maxHeight)
      Returns inline adaptive banner size.
      static BannerAdSize stickySize​(android.content.Context context, int width)
      Returns sticky banner size with the given width.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • fixedSize

        @NonNull
        public static BannerAdSize fixedSize​(@NonNull
                                             android.content.Context context,
                                             int width,
                                             int height)
        Returns fixed banner size.
        Parameters:
        context - The Context.
        width - The width of the ad container in density-independent pixels (dp).
        height - The height of the ad container in density-independent pixels (dp).
        Returns:
        Fixed banner size. The method is available for internal sdk logic. We do not recommend using a banner of this size, its use in the application may negatively affect monetization. Use stickySize(Context, int) for small automatically updated banner attached to the the top or bottom of the screen, or use inlineSize(Context, int, int) for adaptive banner placed in scrolling content.
      • stickySize

        @NonNull
        public static BannerAdSize stickySize​(@NonNull
                                              android.content.Context context,
                                              int width)
        Returns sticky banner size with the given width.
        Parameters:
        context - The Context.
        width - The width of the ad container in density-independent pixels (dp).
        Returns:
        Sticky banner AdSize.
      • inlineSize

        @NonNull
        public static BannerAdSize inlineSize​(@NonNull
                                              android.content.Context context,
                                              int width,
                                              int maxHeight)
        Returns inline adaptive banner size. Banners with inline sizes stretch to container width and height when possible.
        Parameters:
        width - The width of the ad container in density-independent pixels (dp).
        maxHeight - The maximum height of the ad container in density-independent pixels (dp).
        Returns:
        Inline banner size.
      • getHeight

        public int getHeight()
        Returns the height of this BannerAdSize in density-independent pixels (dp).
        Returns:
        Height in density-independent pixels (dp).
      • getHeightInPixels

        public int getHeightInPixels​(@NonNull
                                     android.content.Context context)
        Returns the actual height of this BannerAdSize in physical pixels. AdSize created with FULL_HEIGHT will return height of the screen.
        Parameters:
        context - Any Context.
        Returns:
        Height in physical pixels.
      • getWidth

        public int getWidth()
        Returns the width of this BannerAdSize in density-independent pixels (dp).
        Returns:
        Width in density-independent pixels (dp).
      • getWidthInPixels

        public int getWidthInPixels​(@NonNull
                                    android.content.Context context)
        Returns the actual width of this BannerAdSize in physical pixels. AdSize created with FULL_WIDTH will return width of the screen.
        Parameters:
        context - Any Context.
        Returns:
        Width in physical pixels.
      • getHeight

        public int getHeight​(@NonNull
                             android.content.Context context)
        Returns the actual height of this BannerAdSize in density-independent pixels (dp). AdSize created with FULL_HEIGHT will return height of the screen.
        Parameters:
        context - Any Context.
        Returns:
        Weight in density-independent pixels (dp).
      • getWidth

        public int getWidth​(@NonNull
                            android.content.Context context)
        Returns the actual width of this BannerAdSize in density-independent pixels (dp). AdSize created with FULL_WIDTH will return width of the screen.
        Parameters:
        context - Any Context.
        Returns:
        Width in density-independent pixels (dp).
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        @NonNull
        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object