Class AppBrainBanner

All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent

public class AppBrainBanner extends FrameLayout
A View that shows a typical banner-sized ad unit that promotes the offerwall. The text, button text, design and colors can be specified either programmatically or in XML. The way this can be set in XML for instance is:
<com.appbrain.AppBrainBanner xmlns:appbrain="http://schemas.android.com/apk/lib/com.appbrain"
     appbrain:colors="12" appbrain:design="0" appbrain:title="0" appbrain:button="0"
     android:layout_width="fill_parent" android:layout_height="wrap_content" />
See the functions setTitleIndex(int), setButtonTextIndex(int), setDesign(int) and setColors(int) for more information.
  • Constructor Details

    • AppBrainBanner

      public AppBrainBanner(Context context, AttributeSet attrs, int defStyle)
    • AppBrainBanner

      public AppBrainBanner(Context context, AttributeSet attrs)
    • AppBrainBanner

      public AppBrainBanner(Context context)
  • Method Details

    • setAllowedToUseMediation

      @Deprecated public void setAllowedToUseMediation(boolean allowedToUseMediation)
      Deprecated.
      Mediation (AppBrain mediating other ad networks) has been removed from the SDK. This method is now a no-op, kept for binary compatibility.
    • setSize

      public void setSize(AppBrainBanner.BannerSize size)
      Set the banner's preferred size. The default is AppBrainBanner.BannerSize.RESPONSIVE, which is the recommended setting.
    • setSize

      public void setSize(AppBrainBanner.BannerSize width, AppBrainBanner.BannerSize height)
      Set the banner's preferred width and height. The defaults are AppBrainBanner.BannerSize.RESPONSIVE, which is the recommended setting.
    • setBannerListener

      public void setBannerListener(BannerListener listener)
      Set a listener interface that gets notified about clicks on the banner unit.
    • getBannerListener

      public BannerListener getBannerListener()
      Returns:
      the current BannerListener, set by setBannerListener(BannerListener).
    • setAdId

      public void setAdId(AdId id)
      Sets the ad id for this banner.
    • setTitleIndex

      public void setTitleIndex(int index)
      Set the title to use. By default a random one is used. Currently, the indexes map to the following values:
      • 0: There are some great free apps waiting for you!
      • 1: Get more great apps for your phone
      • 2: Download the best free apps
      • 3: Download today's free app offers
      This method needs to be called before requestAd() is called. It only has an effect on certain types of banners.
      Parameters:
      index - The index of the title to use.
    • setButtonTextIndex

      public void setButtonTextIndex(int index)
      Set the text to use on the button. By default a random one is used. Currently, the indexes map to the following values:
      • 0: Download
      • 1: More free apps
      • 2: Download now
      This method needs to be called before requestAd() is called. It only has an effect on certain types of banners.
      Parameters:
      index - The index of the button text to use.
    • setDesign

      public void setDesign(int index)
      Specify which of four banner designs should be used. By default a random one is used. The indexes map to the following values:
      • 0: A simple layout with text with the button on the right
      • 1: Another simple layout with text and the button on the right
      • 2: A design where the background has arrows pointing to the right
      • 3: A design with an ellipse and the button at the bottom
      This method needs to be called before requestAd() is called. It only has an effect on certain types of banners.
      Parameters:
      index - The index of the design to use.
    • setColors

      public void setColors(int index)
      Specify which of fourteen color schemes should be used. By default a random one is used. The indexes map to the following settings:
      • 0: Dark with blue button
      • 1: Light with blue button
      • 2: Light design
      • 3: Dark with blue button
      • 4: Blue with orange button
      • 5: White with green button
      • 6: Candy colored design
      • 7: Sahara colored design
      • 8: Red colored design
      • 9: Green colored design
      • 10: Blue colored design
      • 11: Purple colored design
      • 12: Light grey design
      • 13: Light black & white design
      This method needs to be called before requestAd() is called. It only has an effect on certain types of banners.
      Parameters:
      index - The index of the color scheme to use.
    • requestAd

      public void requestAd()
      Request an ad to be fetched. If a listener was set on this banner, that listener will be notified of the result. This method is automatically called once the banner is added to the view layout, so calling it manually is optional.