1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.layoutlib.api; 18 19 import com.android.ide.common.rendering.api.Bridge; 20 import com.android.ide.common.rendering.api.RenderSession; 21 22 import java.awt.image.BufferedImage; 23 24 /** 25 * The result of a layout computation through {@link ILayoutBridge}. 26 * 27 * @since 1 28 * @deprecated use {@link RenderSession} as returned by {@link Bridge#createScene(SceneParams)} 29 */ 30 public interface ILayoutResult { 31 /** 32 * Success return code 33 */ 34 final static int SUCCESS = 0; 35 36 /** 37 * Error return code, in which case an error message is guaranteed to be defined. 38 * @see #getErrorMessage() 39 */ 40 final static int ERROR = 1; 41 42 /** 43 * Returns the result code. 44 * @see #SUCCESS 45 * @see #ERROR 46 */ 47 int getSuccess(); 48 49 /** 50 * Returns the {@link ILayoutViewInfo} object for the top level view. 51 */ 52 ILayoutViewInfo getRootView(); 53 54 /** 55 * Returns the rendering of the full layout. 56 */ 57 BufferedImage getImage(); 58 59 /** 60 * Returns the error message. 61 * <p/>Only valid when {@link #getSuccess()} returns {@link #ERROR} 62 */ 63 String getErrorMessage(); 64 65 /** 66 * Layout information for a specific view. 67 * @deprecated 68 */ 69 public interface ILayoutViewInfo { 70 71 /** 72 * Returns the list of children views. 73 */ 74 ILayoutViewInfo[] getChildren(); 75 76 /** 77 * Returns the key associated with the node. 78 * @see IXmlPullParser#getViewKey() 79 */ 80 Object getViewKey(); 81 82 /** 83 * Returns the name of the view. 84 */ 85 String getName(); 86 87 /** 88 * Returns the left of the view bounds. 89 */ 90 int getLeft(); 91 92 /** 93 * Returns the top of the view bounds. 94 */ 95 int getTop(); 96 97 /** 98 * Returns the right of the view bounds. 99 */ 100 int getRight(); 101 102 /** 103 * Returns the bottom of the view bounds. 104 */ 105 int getBottom(); 106 } 107 } 108