mImageOverlay.dispose();
mImageOverlay = null;
}
+
+ mViewHierarchy.dispose();
}
/** Returns the Rules Engine, associated with the current project. */
// Add test action
// Don't add it at the top above (by the cut action) because the
// dynamic context menu makes some assumptions about where things are
- manager.add(new Action("Run My Test", IAction.AS_PUSH_BUTTON) {
+ // FIXME remove test.
+ manager.add(new Action("Play anim test", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
List<SelectionItem> selection = mSelectionManager.getSelections();
scene.animate(viewObject, "testanim", false /*isFrameworkAnimation*/,
new IAnimationListener() {
-
- public void onNewFrame(final BufferedImage image) {
- getDisplay().asyncExec(new Runnable() {
- public void run() {
- mImageOverlay.setImage(image);
- redraw();
- }
- });
+ private int mCount = 0;
+ private BufferedImage mImage;
+ private boolean mPendingDrawing = false;
+ public synchronized void onNewFrame(final BufferedImage image) {
+ mCount++;
+ mImage = image;
+ if (mPendingDrawing == false) {
+ getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ drawImage();
+ }
+ });
+
+ mPendingDrawing = true;
+ }
}
public boolean isCanceled() {
}
public void done(SceneResult result) {
+ System.out.println("Animation count: " + mCount);
+ }
+
+ /**
+ * this is called from the UI thread from the asyncRunnable.
+ */
+ public void drawImage() {
+ // get last image
+ BufferedImage image;
+ synchronized (this) {
+ image = mImage;
+ mImage = null;
+ mPendingDrawing = false;
+ }
+
+ mImageOverlay.setImage(image);
+ redraw();
}
});
}
* The {@link LayoutBridge} is only able to inflate or render one layout at a time. There
* is an internal lock object whenever such an action occurs. The timeout parameter is used
* when attempting to acquire the lock. If the timeout expires, the method will return
- * SceneResult.sdfdsf
+ * {@link SceneStatus#ERROR_TIMEOUT}.
*
* @param timeout timeout for the rendering, in milliseconds.
*
* <p/>
* Any amount of actions can be taken on the scene before {@link #render()} is called.
*
- * @param object
+ * @param objectView
* @param propertyName
* @param propertyValue
*
* @return a {@link SceneResult} indicating the status of the action.
*/
- public SceneResult setProperty(int object, String propertyName, String propertyValue) {
+ public SceneResult setProperty(Object objectView, String propertyName, String propertyValue) {
return NOT_IMPLEMENTED.getResult();
}
*
* @return a {@link SceneResult} indicating the status of the action.
*/
- public SceneResult insertChild() {
+ public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index) {
+ return NOT_IMPLEMENTED.getResult();
+ }
+
+ /**
+ * Inserts a new child in a ViewGroup object.
+ * <p/>
+ * This does nothing more than change the layouy. To render the scene in its new state, a
+ * call to {@link #render()} is required.
+ * <p/>
+ * Any amount of actions can be taken on the scene before {@link #render()} is called.
+ *
+ * @return a {@link SceneResult} indicating the status of the action.
+ */
+ public SceneResult moveChild(Object parentView, IXmlPullParser layoutParamsXml, int index) {
return NOT_IMPLEMENTED.getResult();
}
*
* @return a {@link SceneResult} indicating the status of the action.
*/
- public SceneResult removeChild() {
+ public SceneResult removeChild(Object parentView, int index) {
return NOT_IMPLEMENTED.getResult();
}