public abstract class CBViewProtocol
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
class |
CBViewProtocol.CBViewBase
we've separated the actual view into a separate class so that we don't
create it until all of the assets are loaded.
|
static interface |
CBViewProtocol.ImpressionAsset |
| Modifier and Type | Field and Description |
|---|---|
java.util.Map<View,java.lang.Runnable> |
animationRunnables |
protected JSONObject |
assets |
CBImpression |
impression |
protected int |
orientation |
protected boolean |
supportsLandscape |
protected boolean |
supportsPortrait |
Handler |
uiHandler |
CBUIManager |
uiManager |
boolean |
viewOnPaused |
| Constructor and Description |
|---|
CBViewProtocol(CBImpression impression,
Handler uiHandler,
CBUIManager uiManager) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
click(JSONObject clickCoordinates)
trigger an impression click
|
void |
clickExchange(java.lang.String url,
JSONObject clickCoordinates)
trigger banner click
|
void |
close()
trigger an impression close
|
protected abstract CBViewProtocol.CBViewBase |
createViewObject(Context context)
create the actual view object
|
void |
destroy()
make the view and its data ready for GC.
|
void |
destroyView()
make the view (not its data) ready for GC.
|
protected void |
display()
inform impression that display has displayed successfully
|
void |
fadeView(boolean show,
View view)
helper method: fade view in or out safely
|
void |
fail(CBError.CBImpressionError error)
inform impression of a failure and end display
|
JSONObject |
getAssets()
return the assets loaded for this view
|
int |
getOrientation() |
float |
getVideoDuration() |
float |
getVideoPostion() |
CBViewProtocol.CBViewBase |
getView()
return the view associated with this view protocol
|
static int |
hexToColor(java.lang.String color)
helper method: turn hex string into color safely
|
static boolean |
isBigScreen(Context cx) |
boolean |
onBackPressed()
return true if we should swallow the back button event
|
void |
onPause()
corresponds to host activity's onPause()
|
void |
onResume()
corresponds to host activity's onResume()
|
boolean |
prepare(JSONObject response)
prepare this view to load the given server JSON response
|
void |
runDisplayTask(View view,
java.lang.Runnable run,
long delay)
helper method: run any asynchronous display task safely
This method would be protected, but that generates hidden methods
|
void |
setReadyToDisplay()
creates the actual view, returns whether or not it was successful
(or successfully cached or waiting for a valid activity)
|
void |
showView(boolean show,
View view,
boolean animate)
helper method: fade view in or out safely
|
CBError.CBImpressionError |
tryCreatingViewOnActivity()
Attempt to create the view associated with this view protocol's impression.
|
CBError.CBImpressionError |
tryCreatingViewOnHostView(RelativeLayout hostView) |
public final Handler uiHandler
public final CBUIManager uiManager
public boolean viewOnPaused
protected JSONObject assets
public final CBImpression impression
protected int orientation
public final java.util.Map<View,java.lang.Runnable> animationRunnables
protected boolean supportsPortrait
protected boolean supportsLandscape
public CBViewProtocol(CBImpression impression, Handler uiHandler, CBUIManager uiManager)
public static boolean isBigScreen(Context cx)
public int getOrientation()
public boolean prepare(JSONObject response)
public void setReadyToDisplay()
public CBError.CBImpressionError tryCreatingViewOnHostView(RelativeLayout hostView)
public CBError.CBImpressionError tryCreatingViewOnActivity()
protected abstract CBViewProtocol.CBViewBase createViewObject(Context context)
public void destroy()
destroyView()public CBViewProtocol.CBViewBase getView()
public void destroyView()
public JSONObject getAssets()
public void fail(CBError.CBImpressionError error)
public void close()
protected void display()
public boolean click(JSONObject clickCoordinates)
public void clickExchange(java.lang.String url,
JSONObject clickCoordinates)
public void fadeView(boolean show,
View view)
public void showView(boolean show,
View view,
boolean animate)
public void runDisplayTask(View view,
java.lang.Runnable run,
long delay)
public static int hexToColor(java.lang.String color)
public float getVideoDuration()
public float getVideoPostion()
public boolean onBackPressed()
public void onResume()
public void onPause()