diff options
Diffstat (limited to 'layoutlib_api/src/com/android/layoutlib/api')
5 files changed, 69 insertions, 29 deletions
diff --git a/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java b/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java index cae15d3..9931f3e 100644 --- a/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java +++ b/layoutlib_api/src/com/android/layoutlib/api/ILayoutLog.java @@ -18,25 +18,27 @@ package com.android.layoutlib.api; /** * Callback interface to display warnings/errors that happened during the computation and - * rendering of the layout. + * rendering of the layout. + * @deprecated use {@link LayoutLog}. */ +@Deprecated public interface ILayoutLog { - + /** - * Displays a warning message. - * @param message the message to display. + * Logs a warning message. + * @param message the message to log. */ void warning(String message); - + /** - * Displays an error message. - * @param message the message to display. + * Logs an error message. + * @param message the message to log. */ void error(String message); - + /** - * Displays an exception - * @param t the {@link Throwable} to display. + * Logs an exception + * @param t the {@link Throwable} to log. */ void error(Throwable t); } diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java b/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java new file mode 100644 index 0000000..052750e --- /dev/null +++ b/layoutlib_api/src/com/android/layoutlib/api/LayoutLog.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.layoutlib.api; + +public class LayoutLog { + + public void error(String tag, String message) { + } + + public void error(String tag, Throwable t) { + } + + public void warning(String tag, String message) { + } + + /** + * Logs an error message and a {@link Throwable}. + * @param message the message to log. + * @param throwable the {@link Throwable} to log. + */ + public void error(String tag, String message, Throwable throwable) { + + } +} diff --git a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java b/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java index 96741c3..0883b45 100644 --- a/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java +++ b/layoutlib_api/src/com/android/layoutlib/api/LayoutScene.java @@ -65,7 +65,7 @@ public class LayoutScene { * Returns the last operation result. */ public SceneResult getResult() { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -134,7 +134,7 @@ public class LayoutScene { * @return a {@link SceneResult} indicating the status of the action. */ public SceneResult render(long timeout) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -152,7 +152,7 @@ public class LayoutScene { * @return a {@link SceneResult} indicating the status of the action. */ public SceneResult setProperty(Object objectView, String propertyName, String propertyValue) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -182,7 +182,7 @@ public class LayoutScene { */ public SceneResult insertChild(Object parentView, IXmlPullParser childXml, int index, IAnimationListener listener) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -218,7 +218,7 @@ public class LayoutScene { */ public SceneResult moveChild(Object parentView, Object childView, int index, Map<String, String> layoutParams, IAnimationListener listener) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -235,7 +235,7 @@ public class LayoutScene { * @return a {@link SceneResult} indicating the status of the action. */ public SceneResult removeChild(Object childView, IAnimationListener listener) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** @@ -252,7 +252,7 @@ public class LayoutScene { */ public SceneResult animate(Object targetObject, String animationName, boolean isFrameworkAnimation, IAnimationListener listener) { - return NOT_IMPLEMENTED.getResult(); + return NOT_IMPLEMENTED.createResult(); } /** diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java b/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java index 1bbd96a..56014f0 100644 --- a/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java +++ b/layoutlib_api/src/com/android/layoutlib/api/SceneParams.java @@ -58,7 +58,7 @@ public class SceneParams { private Map<String, Map<String, IResourceValue>> mProjectResources; private Map<String, Map<String, IResourceValue>> mFrameworkResources; private IProjectCallback mProjectCallback; - private ILayoutLog mLogger; + private LayoutLog mLog; private boolean mCustomBackgroundEnabled; private int mCustomBackgroundColor; @@ -89,7 +89,7 @@ public class SceneParams { * value is the resource value. * @param projectCallback The {@link IProjectCallback} object to get information from * the project. - * @param logger the object responsible for displaying warning/errors to the user. + * @param log the object responsible for displaying warning/errors to the user. */ public SceneParams(IXmlPullParser layoutDescription, Object projectKey, @@ -98,7 +98,7 @@ public class SceneParams { String themeName, boolean isProjectTheme, Map<String, Map<String, IResourceValue>> projectResources, Map<String, Map<String, IResourceValue>> frameworkResources, - IProjectCallback projectCallback, ILayoutLog logger) { + IProjectCallback projectCallback, LayoutLog log) { mLayoutDescription = layoutDescription; mProjectKey = projectKey; mScreenWidth = screenWidth; @@ -112,7 +112,7 @@ public class SceneParams { mProjectResources = projectResources; mFrameworkResources = frameworkResources; mProjectCallback = projectCallback; - mLogger = logger; + mLog = log; mCustomBackgroundEnabled = false; mTimeout = DEFAULT_TIMEOUT; } @@ -134,7 +134,7 @@ public class SceneParams { mProjectResources = params.mProjectResources; mFrameworkResources = params.mFrameworkResources; mProjectCallback = params.mProjectCallback; - mLogger = params.mLogger; + mLog = params.mLog; mCustomBackgroundEnabled = params.mCustomBackgroundEnabled; mCustomBackgroundColor = params.mCustomBackgroundColor; mTimeout = params.mTimeout; @@ -206,8 +206,8 @@ public class SceneParams { return mProjectCallback; } - public ILayoutLog getLogger() { - return mLogger; + public LayoutLog getLog() { + return mLog; } public boolean isCustomBackgroundEnabled() { diff --git a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java b/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java index 1a46167..1417f3d 100644 --- a/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java +++ b/layoutlib_api/src/com/android/layoutlib/api/SceneResult.java @@ -54,7 +54,7 @@ public class SceneResult { * Returns a {@link SceneResult} object with this status. * @return an instance of SceneResult; */ - public SceneResult getResult() { + public SceneResult createResult() { // don't want to get generic error that way. assert this != ERROR_UNKNOWN; @@ -71,8 +71,8 @@ public class SceneResult { * * @see SceneResult#getData() */ - public SceneResult getResult(Object data) { - SceneResult res = getResult(); + public SceneResult createResult(Object data) { + SceneResult res = createResult(); if (data != null) { res = res.getCopyWithData(data); @@ -87,7 +87,7 @@ public class SceneResult { * @param throwable the throwable * @return an instance of SceneResult. */ - public SceneResult getResult(String errorMessage, Throwable throwable) { + public SceneResult createResult(String errorMessage, Throwable throwable) { return new SceneResult(this, errorMessage, throwable); } @@ -96,7 +96,7 @@ public class SceneResult { * @param errorMessage the error message * @return an instance of SceneResult. */ - public SceneResult getResult(String errorMessage) { + public SceneResult createResult(String errorMessage) { return new SceneResult(this, errorMessage, null /*throwable*/); } } |