com.sponsorpay.sdk.android.publisher
Class InterstitialActivity

java.lang.Object
  extended by Activity
      extended by com.sponsorpay.sdk.android.publisher.InterstitialActivity

public class InterstitialActivity
extends Activity

Shows the SponsorPay mobile interstitial embedded in a WebView.

Will retrieve the interstitial's initial html content from the EXTRA_INITIAL_CONTENT_KEY encoded into the calling intent, and will load dependent content referenced with relative links using the base URL encoded as EXTRA_BASE_DOMAIN_KEY into the calling intent. The http cookie(s) to use will be retrieved from the String array encoded as extra EXTRA_COOKIESTRINGS_KEY

The boolean value encoded as EXTRA_SHOULD_STAY_OPEN_KEY into the calling intent will determine the activity's behavior when the user is redirected outside the application. The default behavior is to close the interstitial.


Field Summary
private static int BACKGROUND_DRAWABLE_ALPHA
           
private static int BACKGROUND_DRAWABLE_CORNER_RADIUS
           
private static int BIGGER_SCREEN_LONG_SIDE_RESOLUTION_DP
           
private static int BIGGER_SCREEN_SHORT_SIDE_RESOLUTION_DP
           
static java.lang.String EXTRA_BASE_DOMAIN_KEY
           
static java.lang.String EXTRA_COOKIESTRINGS_KEY
           
static java.lang.String EXTRA_INITIAL_CONTENT_KEY
           
static java.lang.String EXTRA_SHOULD_STAY_OPEN_KEY
           
private static int INTERSTITIAL_BORDER_BIGGER_DEVICE
           
private static int INTERSTITIAL_BORDER_SMALLER_DEVICE
           
private static int LONG_SIDE_SIZE_FOR_BIGGER_SCREEN_DP
           
private static int LONG_SIDE_SIZE_FOR_SMALLER_SCREEN_DP
           
private  boolean mShouldStayOpen
           
private  WebView mWebView
           
private  LinearLayout mWebViewContainer
           
private static int SHORT_SIDE_SIZE_FOR_BIGGER_SCREEN_DP
           
private static int SHORT_SIDE_SIZE_FOR_SMALLER_SCREEN_DP
           
 
Constructor Summary
InterstitialActivity()
           
 
Method Summary
private  int determineInterstitialBorderWidth()
           
private static Drawable generateBackgroundDrawable()
           
private  ViewGroup.LayoutParams generateLayoutParamsForCurrentDisplay()
           
private  boolean isCurrentOrientationPortrait()
           Returns true if the current orientation of the device is portrait.
private  boolean isHostBiggerDevice()
          Returns whether the host device has a display bigger than the thresholds defined by BIGGER_SCREEN_SHORT_SIDE_RESOLUTION_DP and BIGGER_SCREEN_LONG_SIDE_RESOLUTION_DP
 void onConfigurationChanged(Configuration newConfig)
           
protected  void onCreate(Bundle savedInstanceState)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERSTITIAL_BORDER_SMALLER_DEVICE

private static final int INTERSTITIAL_BORDER_SMALLER_DEVICE
See Also:
Constant Field Values

INTERSTITIAL_BORDER_BIGGER_DEVICE

private static final int INTERSTITIAL_BORDER_BIGGER_DEVICE
See Also:
Constant Field Values

BACKGROUND_DRAWABLE_CORNER_RADIUS

private static final int BACKGROUND_DRAWABLE_CORNER_RADIUS
See Also:
Constant Field Values

BACKGROUND_DRAWABLE_ALPHA

private static final int BACKGROUND_DRAWABLE_ALPHA
See Also:
Constant Field Values

EXTRA_SHOULD_STAY_OPEN_KEY

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

EXTRA_INITIAL_CONTENT_KEY

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

EXTRA_BASE_DOMAIN_KEY

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

EXTRA_COOKIESTRINGS_KEY

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

BIGGER_SCREEN_SHORT_SIDE_RESOLUTION_DP

private static final int BIGGER_SCREEN_SHORT_SIDE_RESOLUTION_DP
See Also:
Constant Field Values

BIGGER_SCREEN_LONG_SIDE_RESOLUTION_DP

private static final int BIGGER_SCREEN_LONG_SIDE_RESOLUTION_DP
See Also:
Constant Field Values

SHORT_SIDE_SIZE_FOR_SMALLER_SCREEN_DP

private static final int SHORT_SIDE_SIZE_FOR_SMALLER_SCREEN_DP
See Also:
Constant Field Values

LONG_SIDE_SIZE_FOR_SMALLER_SCREEN_DP

private static final int LONG_SIDE_SIZE_FOR_SMALLER_SCREEN_DP
See Also:
Constant Field Values

SHORT_SIDE_SIZE_FOR_BIGGER_SCREEN_DP

private static final int SHORT_SIDE_SIZE_FOR_BIGGER_SCREEN_DP
See Also:
Constant Field Values

LONG_SIDE_SIZE_FOR_BIGGER_SCREEN_DP

private static final int LONG_SIDE_SIZE_FOR_BIGGER_SCREEN_DP
See Also:
Constant Field Values

mWebView

private WebView mWebView

mShouldStayOpen

private boolean mShouldStayOpen

mWebViewContainer

private LinearLayout mWebViewContainer
Constructor Detail

InterstitialActivity

public InterstitialActivity()
Method Detail

onCreate

protected void onCreate(Bundle savedInstanceState)

generateBackgroundDrawable

private static Drawable generateBackgroundDrawable()

generateLayoutParamsForCurrentDisplay

private ViewGroup.LayoutParams generateLayoutParamsForCurrentDisplay()

isHostBiggerDevice

private boolean isHostBiggerDevice()
Returns whether the host device has a display bigger than the thresholds defined by BIGGER_SCREEN_SHORT_SIDE_RESOLUTION_DP and BIGGER_SCREEN_LONG_SIDE_RESOLUTION_DP


determineInterstitialBorderWidth

private int determineInterstitialBorderWidth()

isCurrentOrientationPortrait

private boolean isCurrentOrientationPortrait()

Returns true if the current orientation of the device is portrait.

Implementation note: This implementation assumes that DisplayMetrics.heightPixels and DisplayMetrics.widthPixels get swapped when the orientation changes. This avoids using the deprecated Display.getOrientation() method as well as the getRotation() method which is available only from API 8 on.

Returns:

onConfigurationChanged

public void onConfigurationChanged(Configuration newConfig)