Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +3 −3 Original line number Diff line number Diff line Loading @@ -292,14 +292,14 @@ public final class Bridge extends LayoutBridge { @Override public BridgeLayoutScene createScene(SceneParams params) { try { SceneResult lastResult = SceneResult.SUCCESS; SceneResult lastResult = SceneStatus.SUCCESS.getResult(); LayoutSceneImpl scene = new LayoutSceneImpl(params); try { prepareThread(); lastResult = scene.init(params.getTimeout()); if (lastResult == SceneResult.SUCCESS) { if (lastResult.isSuccess()) { lastResult = scene.inflate(); if (lastResult == SceneResult.SUCCESS) { if (lastResult.isSuccess()) { lastResult = scene.render(); } } Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeLayoutScene.java +10 −17 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(timeout); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.render(); } } finally { Loading @@ -83,7 +83,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.animate(targetObject, animationName, isFrameworkAnimation, listener); } Loading @@ -96,21 +96,17 @@ public class BridgeLayoutScene extends LayoutScene { } @Override public SceneResult insertChild(Object parentView, IXmlPullParser childXml, Object beforeSibling, public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index, IAnimationListener listener) { if (parentView instanceof ViewGroup == false) { throw new IllegalArgumentException("parentView is not a ViewGroup"); } if (beforeSibling != null && beforeSibling instanceof View == false) { throw new IllegalArgumentException("beforeSibling is not a View"); } try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { mLastResult = mScene.insertChild((ViewGroup) parentView, childXml, (View) beforeSibling, listener); if (mLastResult.isSuccess()) { mLastResult = mScene.insertChild((ViewGroup) parentView, childXml, index, listener); } } finally { mScene.release(); Loading @@ -122,7 +118,7 @@ public class BridgeLayoutScene extends LayoutScene { @Override public SceneResult moveChild(Object parentView, Object childView, Object beforeSibling, public SceneResult moveChild(Object parentView, Object childView, int index, IAnimationListener listener) { if (parentView instanceof ViewGroup == false) { throw new IllegalArgumentException("parentView is not a ViewGroup"); Loading @@ -130,16 +126,13 @@ public class BridgeLayoutScene extends LayoutScene { if (childView instanceof View == false) { throw new IllegalArgumentException("childView is not a View"); } if (beforeSibling != null && beforeSibling instanceof View == false) { throw new IllegalArgumentException("beforeSibling is not a View"); } try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { mLastResult = mScene.moveChild((ViewGroup) parentView, (View) childView, (View) beforeSibling, listener); if (mLastResult.isSuccess()) { mLastResult = mScene.moveChild((ViewGroup) parentView, (View) childView, index, listener); } } finally { mScene.release(); Loading @@ -158,7 +151,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.removeChild((View) childView, listener); } } finally { Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java +8 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ package com.android.layoutlib.bridge.impl; import com.android.layoutlib.api.LayoutScene; import com.android.layoutlib.api.SceneResult; import com.android.layoutlib.api.LayoutScene.IAnimationListener; import com.android.layoutlib.api.SceneResult.SceneStatus; import com.android.layoutlib.bridge.Bridge; import android.animation.Animator; Loading Loading @@ -76,6 +78,7 @@ public class AnimationThread extends Thread { mAnimator.start(); // loop the animation LayoutScene scene = mScene.getScene(); do { // get the next message. MessageBundle bundle = mQueue.poll(); Loading @@ -89,14 +92,14 @@ public class AnimationThread extends Thread { try { sleep(bundle.mUptimeMillis - currentTime); } catch (InterruptedException e) { // TODO Auto-generated catch block // FIXME log/do something/sleep again? e.printStackTrace(); } } // ready to do the work, acquire the scene. SceneResult result = mScene.acquire(250); if (result != SceneResult.SUCCESS) { if (result.isSuccess() == false) { mListener.done(result); return; } Loading @@ -105,15 +108,15 @@ public class AnimationThread extends Thread { // the next message, so mQueue will have another one. try { bundle.mTarget.handleMessage(bundle.mMessage); if (mScene.render() == SceneResult.SUCCESS) { mListener.onNewFrame(mScene.getScene()); if (mScene.render().isSuccess()) { mListener.onNewFrame(scene); } } finally { mScene.release(); } } while (mQueue.size() > 0); mListener.done(SceneResult.SUCCESS); mListener.done(SceneStatus.SUCCESS.getResult()); } finally { Handler_Delegate.setCallback(null); Bridge.cleanupThread(); Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java +12 −17 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class LayoutSceneImpl { mBlockParser = new BridgeXmlBlockParser(mParams.getLayoutDescription(), mContext, false /* platformResourceFlag */); return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } /** Loading Loading @@ -342,7 +342,7 @@ public class LayoutSceneImpl { mViewRoot.setBackgroundDrawable(d); } return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } catch (PostInflateException e) { return new SceneResult(SceneStatus.ERROR_INFLATION, e.getMessage(), e); } catch (Throwable e) { Loading Loading @@ -469,7 +469,7 @@ public class LayoutSceneImpl { System.out.println(String.format("rendering (ms): %03d", drawTime - preDrawTime)); // success! return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } catch (Throwable e) { // get the real cause of the exception. Throwable t = e; Loading Loading @@ -520,7 +520,7 @@ public class LayoutSceneImpl { new AnimationThread(this, anim, listener).start(); return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } } catch (Exception e) { // get the real cause of the exception. Loading @@ -537,14 +537,9 @@ public class LayoutSceneImpl { } public SceneResult insertChild(ViewGroup parentView, IXmlPullParser childXml, View beforeSibling, IAnimationListener listener) { int index, IAnimationListener listener) { checkLock(); int index = parentView.indexOfChild(beforeSibling); if (beforeSibling != null && index == -1) { throw new IllegalArgumentException("beforeSibling not in parentView"); } // create a block parser for the XML BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(childXml, mContext, false /* platformResourceFlag */); Loading @@ -564,18 +559,18 @@ public class LayoutSceneImpl { invalidateRenderingSize(); return render(); SceneResult result = render(); if (result.isSuccess()) { result.setData(child); } return result; } public SceneResult moveChild(ViewGroup parentView, View childView, View beforeSibling, public SceneResult moveChild(ViewGroup parentView, View childView, int index, IAnimationListener listener) { checkLock(); int index = parentView.indexOfChild(beforeSibling); if (beforeSibling != null && index == -1) { throw new IllegalArgumentException("beforeSibling not in parentView"); } try { ViewParent parent = childView.getParent(); if (parent instanceof ViewGroup) { Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +3 −3 Original line number Diff line number Diff line Loading @@ -292,14 +292,14 @@ public final class Bridge extends LayoutBridge { @Override public BridgeLayoutScene createScene(SceneParams params) { try { SceneResult lastResult = SceneResult.SUCCESS; SceneResult lastResult = SceneStatus.SUCCESS.getResult(); LayoutSceneImpl scene = new LayoutSceneImpl(params); try { prepareThread(); lastResult = scene.init(params.getTimeout()); if (lastResult == SceneResult.SUCCESS) { if (lastResult.isSuccess()) { lastResult = scene.inflate(); if (lastResult == SceneResult.SUCCESS) { if (lastResult.isSuccess()) { lastResult = scene.render(); } } Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeLayoutScene.java +10 −17 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(timeout); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.render(); } } finally { Loading @@ -83,7 +83,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.animate(targetObject, animationName, isFrameworkAnimation, listener); } Loading @@ -96,21 +96,17 @@ public class BridgeLayoutScene extends LayoutScene { } @Override public SceneResult insertChild(Object parentView, IXmlPullParser childXml, Object beforeSibling, public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index, IAnimationListener listener) { if (parentView instanceof ViewGroup == false) { throw new IllegalArgumentException("parentView is not a ViewGroup"); } if (beforeSibling != null && beforeSibling instanceof View == false) { throw new IllegalArgumentException("beforeSibling is not a View"); } try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { mLastResult = mScene.insertChild((ViewGroup) parentView, childXml, (View) beforeSibling, listener); if (mLastResult.isSuccess()) { mLastResult = mScene.insertChild((ViewGroup) parentView, childXml, index, listener); } } finally { mScene.release(); Loading @@ -122,7 +118,7 @@ public class BridgeLayoutScene extends LayoutScene { @Override public SceneResult moveChild(Object parentView, Object childView, Object beforeSibling, public SceneResult moveChild(Object parentView, Object childView, int index, IAnimationListener listener) { if (parentView instanceof ViewGroup == false) { throw new IllegalArgumentException("parentView is not a ViewGroup"); Loading @@ -130,16 +126,13 @@ public class BridgeLayoutScene extends LayoutScene { if (childView instanceof View == false) { throw new IllegalArgumentException("childView is not a View"); } if (beforeSibling != null && beforeSibling instanceof View == false) { throw new IllegalArgumentException("beforeSibling is not a View"); } try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { mLastResult = mScene.moveChild((ViewGroup) parentView, (View) childView, (View) beforeSibling, listener); if (mLastResult.isSuccess()) { mLastResult = mScene.moveChild((ViewGroup) parentView, (View) childView, index, listener); } } finally { mScene.release(); Loading @@ -158,7 +151,7 @@ public class BridgeLayoutScene extends LayoutScene { try { Bridge.prepareThread(); mLastResult = mScene.acquire(SceneParams.DEFAULT_TIMEOUT); if (mLastResult == SceneResult.SUCCESS) { if (mLastResult.isSuccess()) { mLastResult = mScene.removeChild((View) childView, listener); } } finally { Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/AnimationThread.java +8 −5 Original line number Diff line number Diff line Loading @@ -16,8 +16,10 @@ package com.android.layoutlib.bridge.impl; import com.android.layoutlib.api.LayoutScene; import com.android.layoutlib.api.SceneResult; import com.android.layoutlib.api.LayoutScene.IAnimationListener; import com.android.layoutlib.api.SceneResult.SceneStatus; import com.android.layoutlib.bridge.Bridge; import android.animation.Animator; Loading Loading @@ -76,6 +78,7 @@ public class AnimationThread extends Thread { mAnimator.start(); // loop the animation LayoutScene scene = mScene.getScene(); do { // get the next message. MessageBundle bundle = mQueue.poll(); Loading @@ -89,14 +92,14 @@ public class AnimationThread extends Thread { try { sleep(bundle.mUptimeMillis - currentTime); } catch (InterruptedException e) { // TODO Auto-generated catch block // FIXME log/do something/sleep again? e.printStackTrace(); } } // ready to do the work, acquire the scene. SceneResult result = mScene.acquire(250); if (result != SceneResult.SUCCESS) { if (result.isSuccess() == false) { mListener.done(result); return; } Loading @@ -105,15 +108,15 @@ public class AnimationThread extends Thread { // the next message, so mQueue will have another one. try { bundle.mTarget.handleMessage(bundle.mMessage); if (mScene.render() == SceneResult.SUCCESS) { mListener.onNewFrame(mScene.getScene()); if (mScene.render().isSuccess()) { mListener.onNewFrame(scene); } } finally { mScene.release(); } } while (mQueue.size() > 0); mListener.done(SceneResult.SUCCESS); mListener.done(SceneStatus.SUCCESS.getResult()); } finally { Handler_Delegate.setCallback(null); Bridge.cleanupThread(); Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java +12 −17 Original line number Diff line number Diff line Loading @@ -200,7 +200,7 @@ public class LayoutSceneImpl { mBlockParser = new BridgeXmlBlockParser(mParams.getLayoutDescription(), mContext, false /* platformResourceFlag */); return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } /** Loading Loading @@ -342,7 +342,7 @@ public class LayoutSceneImpl { mViewRoot.setBackgroundDrawable(d); } return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } catch (PostInflateException e) { return new SceneResult(SceneStatus.ERROR_INFLATION, e.getMessage(), e); } catch (Throwable e) { Loading Loading @@ -469,7 +469,7 @@ public class LayoutSceneImpl { System.out.println(String.format("rendering (ms): %03d", drawTime - preDrawTime)); // success! return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } catch (Throwable e) { // get the real cause of the exception. Throwable t = e; Loading Loading @@ -520,7 +520,7 @@ public class LayoutSceneImpl { new AnimationThread(this, anim, listener).start(); return SceneResult.SUCCESS; return SceneStatus.SUCCESS.getResult(); } } catch (Exception e) { // get the real cause of the exception. Loading @@ -537,14 +537,9 @@ public class LayoutSceneImpl { } public SceneResult insertChild(ViewGroup parentView, IXmlPullParser childXml, View beforeSibling, IAnimationListener listener) { int index, IAnimationListener listener) { checkLock(); int index = parentView.indexOfChild(beforeSibling); if (beforeSibling != null && index == -1) { throw new IllegalArgumentException("beforeSibling not in parentView"); } // create a block parser for the XML BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(childXml, mContext, false /* platformResourceFlag */); Loading @@ -564,18 +559,18 @@ public class LayoutSceneImpl { invalidateRenderingSize(); return render(); SceneResult result = render(); if (result.isSuccess()) { result.setData(child); } return result; } public SceneResult moveChild(ViewGroup parentView, View childView, View beforeSibling, public SceneResult moveChild(ViewGroup parentView, View childView, int index, IAnimationListener listener) { checkLock(); int index = parentView.indexOfChild(beforeSibling); if (beforeSibling != null && index == -1) { throw new IllegalArgumentException("beforeSibling not in parentView"); } try { ViewParent parent = childView.getParent(); if (parent instanceof ViewGroup) { Loading