com.sponsorpay.sdk.android.publisher
Class OfferWallActivity

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

public class OfferWallActivity
extends Activity

Retrieves the SponsorPay mobile Offer Wall and shows it embedded in a WebView.


Field Summary
static java.lang.String EXTRA_OVERRIDEN_APP_ID
          Key for extracting the App ID from the extras bundle.
static java.lang.String EXTRA_SHOULD_STAY_OPEN_KEY
          Key for extracting the value of mShouldStayOpen from the extras bundle.
static java.lang.String EXTRA_USERID_KEY
          Key for extracting the current user ID from the extras bundle.
private static java.lang.String LOG_TAG
           
private  HostInfo mHostInfo
          Information about the hosting application and device.
private  ProgressDialog mProgressDialog
          Loading progress dialog.
private  boolean mShouldStayOpen
          Whether this activity should stay open or close when the user is redirected outside the application by clicking on an offer.
private  java.lang.String mUserId
          The user ID (after extracting it from the extra)
private  WebView mWebView
          Full-size web view within the activity
private static java.lang.String OFFERWALL_PRODUCTION_BASE_URL
          Sponsorpay's URL to contact within the web view
private static java.lang.String OFFERWALL_STAGING_BASE_URL
           
static int RESULT_CODE_NO_STATUS_CODE
          The result code that is returned when the Offer Wall's parsed exit scheme does not contain a status code.
private  boolean SHOULD_STAY_OPEN_DEFAULT
           
 
Constructor Summary
OfferWallActivity()
           
 
Method Summary
protected  void onCreate(Bundle savedInstanceState)
          Overriden from Activity.
protected  void onResume()
          Overriden from Activity.
private  java.lang.String parseURLForProvidedURL(java.lang.String url)
          Extract the provided URL from the exit scheme.
private  int parseURLForStatusCodeViaUri(java.lang.String url)
          Extract the status code from the scheme.
protected  void showErrorDialog(SponsorPayPublisher.UIStringIdentifier error)
          Displays an error dialog with the passed error message on top of the activity.
protected  void showErrorDialog(java.lang.String error)
          Displays an error dialog with the passed error message on top of the activity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG_TAG

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

SHOULD_STAY_OPEN_DEFAULT

private boolean SHOULD_STAY_OPEN_DEFAULT

EXTRA_USERID_KEY

public static final java.lang.String EXTRA_USERID_KEY
Key for extracting the current user ID from the extras bundle.

See Also:
Constant Field Values

EXTRA_SHOULD_STAY_OPEN_KEY

public static final java.lang.String EXTRA_SHOULD_STAY_OPEN_KEY
Key for extracting the value of mShouldStayOpen from the extras bundle.

See Also:
Constant Field Values

EXTRA_OVERRIDEN_APP_ID

public static final java.lang.String EXTRA_OVERRIDEN_APP_ID
Key for extracting the App ID from the extras bundle. If no app id is provided it will be retrieved from the application manifest.

See Also:
Constant Field Values

RESULT_CODE_NO_STATUS_CODE

public static final int RESULT_CODE_NO_STATUS_CODE
The result code that is returned when the Offer Wall's parsed exit scheme does not contain a status code.

See Also:
Constant Field Values

OFFERWALL_PRODUCTION_BASE_URL

private static final java.lang.String OFFERWALL_PRODUCTION_BASE_URL
Sponsorpay's URL to contact within the web view

See Also:
Constant Field Values

OFFERWALL_STAGING_BASE_URL

private static final java.lang.String OFFERWALL_STAGING_BASE_URL
See Also:
Constant Field Values

mWebView

private WebView mWebView
Full-size web view within the activity


mUserId

private java.lang.String mUserId
The user ID (after extracting it from the extra)


mHostInfo

private HostInfo mHostInfo
Information about the hosting application and device.


mShouldStayOpen

private boolean mShouldStayOpen
Whether this activity should stay open or close when the user is redirected outside the application by clicking on an offer.


mProgressDialog

private ProgressDialog mProgressDialog
Loading progress dialog.

Constructor Detail

OfferWallActivity

public OfferWallActivity()
Method Detail

onCreate

protected void onCreate(Bundle savedInstanceState)
Overriden from Activity. Upon activity start, extract the user ID from the extra, create the web view and setup the interceptor for the web view exit-request.

Parameters:
savedInstanceState - Android's savedInstanceState

onResume

protected void onResume()
Overriden from Activity. Loads or reloads the contents of the offer wall webview.


showErrorDialog

protected void showErrorDialog(SponsorPayPublisher.UIStringIdentifier error)
Displays an error dialog with the passed error message on top of the activity.

Parameters:
error - Error message to show.

showErrorDialog

protected void showErrorDialog(java.lang.String error)
Displays an error dialog with the passed error message on top of the activity.

Parameters:
error - Error message to show.

parseURLForProvidedURL

private java.lang.String parseURLForProvidedURL(java.lang.String url)
Extract the provided URL from the exit scheme.

Parameters:
url - The exit scheme url to parse.
Returns:
The extracted, provided & decoded URL.

parseURLForStatusCodeViaUri

private int parseURLForStatusCodeViaUri(java.lang.String url)
Extract the status code from the scheme.

Parameters:
url - The url to parse for the status code.
Returns:
The status code