Adding basic on/off screen event handling to the sample background plugin.

This commit is contained in:
Derek Sollenberger
2010-02-23 08:52:16 -05:00
parent c363d4e72b
commit 5b67414517

View File

@@ -185,11 +185,18 @@ int16 BackgroundPlugin::handleEvent(const ANPEvent* evt) {
gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst()); gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
break; break;
case kLifecycle_ANPEventType: case kLifecycle_ANPEventType:
if (evt->data.lifecycle.action == kOnLoad_ANPLifecycleAction) { switch (evt->data.lifecycle.action) {
gLogI.log(kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst()); case kOnLoad_ANPLifecycleAction:
return 1; gLogI.log(kDebug_ANPLogType, " ------ %p onLoad", inst());
return 1;
case kOnScreen_ANPLifecycleAction:
gLogI.log(kDebug_ANPLogType, " ------ %p onScreen", inst());
return 1;
case kOffScreen_ANPLifecycleAction:
gLogI.log(kDebug_ANPLogType, " ------ %p offScreen", inst());
return 1;
} }
break; break; // end kLifecycle_ANPEventType
case kTouch_ANPEventType: case kTouch_ANPEventType:
if (kDown_ANPTouchAction == evt->data.touch.action) if (kDown_ANPTouchAction == evt->data.touch.action)
return kHandleLongPress_ANPTouchResult | kHandleDoubleTap_ANPTouchResult; return kHandleLongPress_ANPTouchResult | kHandleDoubleTap_ANPTouchResult;