com.sponsorpay.sdk.android.publisher
Class OfferBanner

java.lang.Object
  extended by com.sponsorpay.sdk.android.publisher.OfferBanner

public class OfferBanner
extends java.lang.Object

Encloses an offer advertisement banner returned by the SponsorPay server. Contains the data returned by the server and can generate a banner view to be added to a view hierarchy.


Nested Class Summary
static class OfferBanner.AdShape
          Encloses a shape for an advertisement banner: width, height and string description.
 
Field Summary
static java.lang.String LOG_TAG
           
private  java.lang.String mBaseUrl
          Base URL used by the banner WebView to load resources referenced from its HTML content.
private  Context mContext
          Android application context.
private  java.lang.String[] mCookies
          Cookies used by the WebView when requesting referenced resources to the server.
private  java.lang.String mHtmlContent
          HTML content of the banner.
private  View mOfferBannerView
          View responsible for displaying the banner.
private  OfferBanner.AdShape mShape
          OfferBanner.AdShape defining the dimensions of this banner.
static OfferBanner.AdShape SP_AD_SHAPE_320X50
          OfferBanner.AdShape defining a 320 x 50 banner shape.
 
Constructor Summary
OfferBanner(Context context, java.lang.String baseUrl, java.lang.String htmlContent, java.lang.String[] cookies, OfferBanner.AdShape shape)
          Constructor.
 
Method Summary
private  int convertDevicePixelsIntoPixelsMeasurement(float dps)
          Converts device pixels into screen pixels.
 View getBannerView(Activity hostActivity)
          Initializes and returns an Android View containing the banner which can be added to a view hierarchy.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_TAG

public static final java.lang.String LOG_TAG
See Also:
Constant Field Values

SP_AD_SHAPE_320X50

public static final OfferBanner.AdShape SP_AD_SHAPE_320X50
OfferBanner.AdShape defining a 320 x 50 banner shape.


mContext

private Context mContext
Android application context.


mBaseUrl

private java.lang.String mBaseUrl
Base URL used by the banner WebView to load resources referenced from its HTML content.


mHtmlContent

private java.lang.String mHtmlContent
HTML content of the banner.


mCookies

private java.lang.String[] mCookies
Cookies used by the WebView when requesting referenced resources to the server.


mOfferBannerView

private View mOfferBannerView
View responsible for displaying the banner.


mShape

private OfferBanner.AdShape mShape
OfferBanner.AdShape defining the dimensions of this banner.

Constructor Detail

OfferBanner

public OfferBanner(Context context,
                   java.lang.String baseUrl,
                   java.lang.String htmlContent,
                   java.lang.String[] cookies,
                   OfferBanner.AdShape shape)
Constructor.

Parameters:
context - Android application context.
baseUrl - Base URL used by the banner WebView to load resources referenced from its HTML content.
htmlContent - HTML content of the banner.
cookies - Cookies used by the WebView when requesting referenced resources to the server.
shape - OfferBanner.AdShape defining the dimensions of this banner.
Method Detail

getBannerView

public View getBannerView(Activity hostActivity)
Initializes and returns an Android View containing the banner which can be added to a view hierarchy.

Parameters:
hostActivity - The Android activity which contains the view hierarchy to which the banner will be added. This activity will be used to launch a new activity if the user taps on the banner.
Returns:
A View which can be added to a view hierarchy, contains the banner, and can be tapped by the user to launch a new activity.

convertDevicePixelsIntoPixelsMeasurement

private int convertDevicePixelsIntoPixelsMeasurement(float dps)
Converts device pixels into screen pixels.