com.android.ide.common.rendering.api.RenderSession Maven / Gradle / Ivy
Show all versions of layoutlib-api Show documentation
/*
* 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.ide.common.rendering.api;
import static com.android.ide.common.rendering.api.Result.Status.NOT_IMPLEMENTED;
import com.android.ide.common.rendering.api.Result.Status;
import com.android.util.PropertiesMap;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.Map;
/**
* An object allowing interaction with an Android layout.
*
* This is returned by {@link Bridge#createSession(SessionParams)}.
* and can then be used for subsequent actions on the layout.
*
* @since 5
*
*/
public class RenderSession {
/**
* Returns the last operation result.
*/
public Result getResult() {
return NOT_IMPLEMENTED.createResult();
}
/**
* Returns the {@link ViewInfo} objects for the top level views.
*
* It contains {@code ViewInfo} for only the views in the layout. For {@code ViewInfo} of the
* System UI surrounding the layout use {@link #getSystemRootViews()}. In most cases the list
* will only contain one item. If the top level node is a {@code merge} though then it will
* contain all the items under the {@code merge} tag.
*
* This is reset to a new instance every time {@link #render()} is called and can be
* null
if the call failed (and the method returned a {@link Result} with
* {@link Status#ERROR_UNKNOWN} or {@link Status#NOT_IMPLEMENTED}.
*
* This can be safely modified by the caller, but {@code #getSystemRootViews} and
* {@code #getRootViews} share some view infos, so modifying one result can affect the other.
*
* @return the list of {@link ViewInfo} or null if there aren't any.
*
* @see #getSystemRootViews()
*/
public List getRootViews() {
return null;
}
/**
* Returns the {@link ViewInfo} objects for the system decor views, like the ActionBar.
*
* This is reset to a new instance every time {@link #render()} is called and can be
* null
if the call failed, or there was no system decor.
*
* This can be safely modified by the caller, but {@code #getSystemRootViews} and
* {@code #getRootViews} share some view infos, so modifying one result can affect the other.
*
* @return the list of {@link ViewInfo} or null if there aren't any.
*/
public List getSystemRootViews() {
return null;
}
/**
* Returns the rendering of the full layout.
*
* This is reset to a new instance every time {@link #render()} is called and can be
* null
if the call failed (and the method returned a {@link Result} with
* {@link Status#ERROR_UNKNOWN} or {@link Status#NOT_IMPLEMENTED}.
*
* This can be safely modified by the caller.
*/
public BufferedImage getImage() {
return null;
}
/**
* Returns true if the current image alpha channel is relevant.
*
* @return whether the image alpha channel is relevant.
*/
public boolean isAlphaChannelImage() {
return true;
}
/**
* Returns a map of (XML attribute name, attribute value) containing only default attribute
* values, for the given view Object.
* @param viewObject the view object.
* @return a map of the default property values or null.
* @deprecated use {@link #getDefaultProperties()}
*/
@Deprecated
public Map getDefaultProperties(Object viewObject) {
return null;
}
/**
* Returns the map of View Cookie → properties (attribute name, attribute value) for all the
* views that have a view cookie.
*/
public Map