| 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 |
|
| 20 |
/** |
| 21 |
* Rendering parameters for {@link Bridge#renderDrawable(DrawableParams)} |
| 22 |
* |
| 23 |
*/ |
| 24 |
public class DrawableParams extends RenderParams { |
| 25 |
|
| 26 |
private final ResourceValue mDrawable; |
| 27 |
|
| 28 |
/** |
| 29 |
* Builds a param object with all the necessary parameters to render a drawable with |
| 30 |
* {@link Bridge#renderDrawable(DrawableParams)} |
| 31 |
* |
| 32 |
* @param drawable the {@link ResourceValue} identifying the drawable. |
| 33 |
* @param projectKey An Object identifying the project. This is used for the cache mechanism. |
| 34 |
* @param hardwareConfig the {@link HardwareConfig}. |
| 35 |
* @param renderResources a {@link RenderResources} object providing access to the resources. |
| 36 |
* @param layoutlibCallback The {@link LayoutlibCallback} object to get information from |
| 37 |
* the project. |
| 38 |
* @param minSdkVersion the minSdkVersion of the project |
| 39 |
* @param targetSdkVersion the targetSdkVersion of the project |
| 40 |
* @param log the object responsible for displaying warning/errors to the user. |
| 41 |
*/ |
| 42 |
public DrawableParams( |
| 43 |
ResourceValue drawable, |
| 44 |
Object projectKey, |
| 45 |
HardwareConfig hardwareConfig, |
| 46 |
RenderResources renderResources, |
| 47 |
LayoutlibCallback layoutlibCallback, |
| 48 |
int minSdkVersion, int targetSdkVersion, |
| 49 |
LayoutLog log) { |
| 50 |
super(projectKey, hardwareConfig, |
| 51 |
renderResources, layoutlibCallback, minSdkVersion, targetSdkVersion, log); |
| 52 |
mDrawable = drawable; |
| 53 |
} |
| 54 |
|
| 55 |
public DrawableParams(DrawableParams params) { |
| 56 |
super(params); |
| 57 |
mDrawable = params.mDrawable; |
| 58 |
} |
| 59 |
|
| 60 |
public ResourceValue getDrawable() { |
| 61 |
return mDrawable; |
| 62 |
} |
| 63 |
} |