Home | History | Annotate | Download | only in api
      1 /*
      2  * Copyright (C) 2011 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.ide.common.rendering.api;
     18 
     19 import com.android.resources.Density;
     20 
     21 /**
     22  * Rendering parameters for {@link Bridge#renderDrawable(DrawableParams)}
     23  *
     24  */
     25 public class DrawableParams extends RenderParams {
     26 
     27     private final ResourceValue mDrawable;
     28 
     29     /**
     30     * Builds a param object with all the necessary parameters to render a drawable with
     31     * {@link Bridge#renderDrawable(DrawableParams)}
     32     *
     33     * @param drawable the {@link ResourceValue} identifying the drawable.
     34     * @param projectKey An Object identifying the project. This is used for the cache mechanism.
     35     * @param screenWidth the screen width
     36     * @param screenHeight the screen height
     37     * @param density the density factor for the screen.
     38     * @param xdpi the screen actual dpi in X
     39     * @param ydpi the screen actual dpi in Y
     40     * @param themeName The name of the theme to use.
     41     * @param isProjectTheme true if the theme is a project theme, false if it is a framework theme.
     42     * @param projectResources the resources of the project. The map contains (String, map) pairs
     43     * where the string is the type of the resource reference used in the layout file, and the
     44     * map contains (String, {@link ResourceValue}) pairs where the key is the resource name,
     45     * and the value is the resource value.
     46     * @param frameworkResources the framework resources. The map contains (String, map) pairs
     47     * where the string is the type of the resource reference used in the layout file, and the map
     48     * contains (String, {@link ResourceValue}) pairs where the key is the resource name, and the
     49     * value is the resource value.
     50     * @param projectCallback The {@link IProjectCallback} object to get information from
     51     * the project.
     52     * @param minSdkVersion the minSdkVersion of the project
     53     * @param targetSdkVersion the targetSdkVersion of the project
     54     * @param log the object responsible for displaying warning/errors to the user.
     55     */
     56     public DrawableParams(
     57             ResourceValue drawable,
     58             Object projectKey,
     59             int screenWidth, int screenHeight,
     60             Density density, float xdpi, float ydpi,
     61             RenderResources renderResources,
     62             IProjectCallback projectCallback,
     63             int minSdkVersion, int targetSdkVersion,
     64             LayoutLog log) {
     65         super(projectKey, screenWidth, screenHeight, density, xdpi, ydpi,
     66                 renderResources, projectCallback, minSdkVersion, targetSdkVersion, log);
     67         mDrawable = drawable;
     68     }
     69 
     70     public DrawableParams(DrawableParams params) {
     71         super(params);
     72         mDrawable = params.mDrawable;
     73     }
     74 
     75     public ResourceValue getDrawable() {
     76         return mDrawable;
     77     }
     78 }
     79