2 * Copyright (C) 2008 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.layoutlib.bridge;
19 import com.android.layoutlib.api.ILayoutResult;
21 import java.awt.image.BufferedImage;
24 * Implementation of {@link ILayoutResult}
26 public final class LayoutResult implements ILayoutResult {
28 private final ILayoutViewInfo mRootView;
29 private final BufferedImage mImage;
30 private final int mSuccess;
31 private final String mErrorMessage;
34 * Creates a {@link #SUCCESS} {@link ILayoutResult} with the specified params
38 public LayoutResult(ILayoutViewInfo rootView, BufferedImage image) {
46 * Creates a LayoutResult with a specific success code and associated message
50 public LayoutResult(int code, String message) {
52 mErrorMessage = message;
57 public int getSuccess() {
61 public String getErrorMessage() {
65 public BufferedImage getImage() {
69 public ILayoutViewInfo getRootView() {
74 * Implementation of {@link ILayoutResult.ILayoutViewInfo}
76 public static final class LayoutViewInfo implements ILayoutViewInfo {
77 private final Object mKey;
78 private final String mName;
79 private final int mLeft;
80 private final int mRight;
81 private final int mTop;
82 private final int mBottom;
83 private ILayoutViewInfo[] mChildren;
85 public LayoutViewInfo(String name, Object key, int left, int top, int right, int bottom) {
94 public void setChildren(ILayoutViewInfo[] children) {
98 public ILayoutViewInfo[] getChildren() {
102 public Object getViewKey() {
106 public String getName() {
110 public int getLeft() {
114 public int getTop() {
118 public int getRight() {
122 public int getBottom() {