public class SpenObjectRuntime extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
SpenObjectRuntime.UpdateListener
This listener interface provides callback methods for Spen ObjectRuntime update events.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getType()
Get the ObjectRuntime type
ObjectRuntime is processed according to its type. |
void |
onTouchEvent(MotionEvent event)
Called when ObjectRuntime touch events occur.
|
boolean |
setListener(SpenObjectRuntime.UpdateListener listener)
Set the specified UpdateListener instance to receive ObjectRuntime update events.
|
void |
setRect(RectF rect)
Set the specified rectangle for ObjectRuntime
|
void |
start(Object objectBase,
RectF relativeRect,
PointF pan,
float zoomRatio,
PointF frameStartPosition,
ViewGroup layout)
Start ObjectRuntime with the specified values.
|
void |
stop(boolean cancel)
Stop ObjectRuntime
|
public int getType()
For example: SpenObjectRuntimeManager orm = new SpenObjectRuntimeManager(mContext); ArrayListorList = new ArrayList (); orm.getObjectRuntimeInfoList(orList); SpenObjectRuntime object = orm.createObjectRuntime(orList.get(which)); SpenObjectBase objectBase = null; switch (object.getType()) { case SpenObjectRuntimeInterface.TYPE_NONE: break; case SpenObjectRuntimeInterface.TYPE_IMAGE: break; case SpenObjectRuntimeInterface.TYPE_STROKE: break; case SpenObjectRuntimeInterface.TYPE_CONTAINER: break; }
SpenObjectRuntimeInterface.TYPE_NONE
SpenObjectRuntimeInterface.TYPE_IMAGE SpenObjectRuntimeInterface.TYPE_STROKE
SpenObjectRuntimeInterface.TYPE_CONTAINERpublic void start(Object objectBase, RectF relativeRect, PointF pan, float zoomRatio, PointF frameStartPosition, ViewGroup layout)
For example: SpenObjectRuntimeManager orm = new SpenObjectRuntimeManager(mContext); ArrayListorList = new ArrayList (); orm.getObjectRuntimeInfoList(orList); SpenObjectRuntime object = orm.createObjectRuntime(orList.get(which)); SpenObjectBase objectBase = null; switch (object.getType()) { case SpenObjectRuntimeInterface.TYPE_NONE: break; case SpenObjectRuntimeInterface.TYPE_IMAGE: objectBase = new SpenObjectImage(); SpenObjectImage objectImage = (SpenObjectImage) objectBase; objectImage.setResizeOption(SpenObjectBase.RESIZE_OPTION_KEEP_RATIO); objectImage.setRotatable(false); objectImage.setExtraDataInt("Type", SpenObjectRuntimeInterface.TYPE_IMAGE); objectImage.setLineBorderColor(Color.BLACK); objectImage.setLineBorderWidth(10); break; case SpenObjectRuntimeInterface.TYPE_STROKE: break; case SpenObjectRuntimeInterface.TYPE_CONTAINER: break; } object.setListener(objectRuntimelistener); object.onStart(objectBase, rect, null, 0, null, layout);
objectBase - The Object used in ObjectRuntimerelativeRect - The relative rectanglepan - The relative positionzoomRatio - The zoom ratioframeStartPosition - The ObjectRuntime position in the canvaslayout - The ObjectRuntime ViewgroupIllegalArgumentException - Thrown if objectBase or relativeRect or
frameStartPosition or ViewGroup is null.public void stop(boolean cancel)
cancel - This parameter is used for specific ObjectRuntime. Default is TRUE. If this value is false,
ObjectRuntime will action according to it.public void onTouchEvent(MotionEvent event)
event - The event informationpublic void setRect(RectF rect)
rect - The rectanglepublic boolean setListener(SpenObjectRuntime.UpdateListener listener)
For example: SpenObjectRuntimeManager orm = new SpenObjectRuntimeManager(mContext); ArrayListorList = new ArrayList (); orm.getObjectRuntimeInfoList(orList); SpenObjectRuntime object = orm.createObjectRuntime(orList.get(which)); object.setListener(objectRuntimelistener);
listener - The UpdateListener instance to receive ObjectRuntime update events.SpenObjectRuntime.UpdateListener