| 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#createSession(com.android.ide.common.rendering.api.SessionParams)} |
| 29 |
*/ |
| 30 |
@Deprecated |
| 31 |
public interface ILayoutResult { |
| 32 |
/** |
| 33 |
* Success return code |
| 34 |
*/ |
| 35 |
int SUCCESS = 0; |
| 36 |
|
| 37 |
/** |
| 38 |
* Error return code, in which case an error message is guaranteed to be defined. |
| 39 |
* @see #getErrorMessage() |
| 40 |
*/ |
| 41 |
int ERROR = 1; |
| 42 |
|
| 43 |
/** |
| 44 |
* Returns the result code. |
| 45 |
* @see #SUCCESS |
| 46 |
* @see #ERROR |
| 47 |
*/ |
| 48 |
int getSuccess(); |
| 49 |
|
| 50 |
/** |
| 51 |
* Returns the {@link ILayoutViewInfo} object for the top level view. |
| 52 |
*/ |
| 53 |
ILayoutViewInfo getRootView(); |
| 54 |
|
| 55 |
/** |
| 56 |
* Returns the rendering of the full layout. |
| 57 |
*/ |
| 58 |
BufferedImage getImage(); |
| 59 |
|
| 60 |
/** |
| 61 |
* Returns the error message. |
| 62 |
* <p>Only valid when {@link #getSuccess()} returns {@link #ERROR} |
| 63 |
*/ |
| 64 |
String getErrorMessage(); |
| 65 |
|
| 66 |
/** |
| 67 |
* Layout information for a specific view. |
| 68 |
* @deprecated |
| 69 |
*/ |
| 70 |
@Deprecated |
| 71 |
interface ILayoutViewInfo { |
| 72 |
|
| 73 |
/** |
| 74 |
* Returns the list of children views. |
| 75 |
*/ |
| 76 |
ILayoutViewInfo[] getChildren(); |
| 77 |
|
| 78 |
/** |
| 79 |
* Returns the key associated with the node. |
| 80 |
* @see IXmlPullParser#getViewKey() |
| 81 |
*/ |
| 82 |
Object getViewKey(); |
| 83 |
|
| 84 |
/** |
| 85 |
* Returns the name of the view. |
| 86 |
*/ |
| 87 |
String getName(); |
| 88 |
|
| 89 |
/** |
| 90 |
* Returns the left of the view bounds. |
| 91 |
*/ |
| 92 |
int getLeft(); |
| 93 |
|
| 94 |
/** |
| 95 |
* Returns the top of the view bounds. |
| 96 |
*/ |
| 97 |
int getTop(); |
| 98 |
|
| 99 |
/** |
| 100 |
* Returns the right of the view bounds. |
| 101 |
*/ |
| 102 |
int getRight(); |
| 103 |
|
| 104 |
/** |
| 105 |
* Returns the bottom of the view bounds. |
| 106 |
*/ |
| 107 |
int getBottom(); |
| 108 |
} |
| 109 |
} |