| 1 |
/* |
| 2 |
* Copyright (C) 2014 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 |
package com.android.ide.common.rendering.api; |
| 17 |
|
| 18 |
/** |
| 19 |
* List of features describing the LayoutLib capabilities. |
| 20 |
*/ |
| 21 |
public class Features { |
| 22 |
/** Ability to render at full size, as required by the layout, and unbound by the screen */ |
| 23 |
public static final int UNBOUND_RENDERING = 0; |
| 24 |
/** Ability to override the background of the rendering with transparency using |
| 25 |
* {@link SessionParams#setOverrideBgColor(int)} */ |
| 26 |
public static final int CUSTOM_BACKGROUND_COLOR = 1; |
| 27 |
/** Ability to call {@link RenderSession#render()} and {@link RenderSession#render(long)}. */ |
| 28 |
public static final int RENDER = 2; |
| 29 |
/** Ability to ask for a layout only with no rendering through |
| 30 |
* {@link SessionParams#setLayoutOnly()} |
| 31 |
*/ |
| 32 |
public static final int LAYOUT_ONLY = 3; |
| 33 |
/** |
| 34 |
* Ability to control embedded layout parsers through {@link ILayoutPullParser#getParser(String)} |
| 35 |
*/ |
| 36 |
public static final int EMBEDDED_LAYOUT = 4; |
| 37 |
/** Ability to call<br> |
| 38 |
* {@link RenderSession#insertChild(Object, ILayoutPullParser, int, IAnimationListener)}<br> |
| 39 |
* {@link RenderSession#moveChild(Object, Object, int, java.util.Map, IAnimationListener)}<br> |
| 40 |
* {@link RenderSession#setProperty(Object, String, String)}<br> |
| 41 |
* The method that receives an animation listener can only use it if the |
| 42 |
* ANIMATED_VIEW_MANIPULATION, or FULL_ANIMATED_VIEW_MANIPULATION is also supported. |
| 43 |
*/ |
| 44 |
public static final int VIEW_MANIPULATION = 5; |
| 45 |
/** Ability to play animations with<br> |
| 46 |
* {@link RenderSession#animate(Object, String, boolean, IAnimationListener)} |
| 47 |
*/ |
| 48 |
public static final int PLAY_ANIMATION = 6; |
| 49 |
/** |
| 50 |
* Ability to manipulate views with animation, as long as the view does not change parent. |
| 51 |
* {@link RenderSession#insertChild(Object, ILayoutPullParser, int, IAnimationListener)}<br> |
| 52 |
* {@link RenderSession#moveChild(Object, Object, int, java.util.Map, IAnimationListener)}<br> |
| 53 |
* {@link RenderSession#removeChild(Object, IAnimationListener)}<br> |
| 54 |
*/ |
| 55 |
public static final int ANIMATED_VIEW_MANIPULATION = 7; |
| 56 |
/** |
| 57 |
* Ability to move views (even into a different ViewGroup) with animation. |
| 58 |
* see {@link RenderSession#moveChild(Object, Object, int, java.util.Map, IAnimationListener)} |
| 59 |
*/ |
| 60 |
public static final int FULL_ANIMATED_VIEW_MANIPULATION = 7; |
| 61 |
public static final int ADAPTER_BINDING = 8; |
| 62 |
public static final int EXTENDED_VIEWINFO = 9; |
| 63 |
/** |
| 64 |
* Ability to properly resize nine-patch assets. |
| 65 |
*/ |
| 66 |
public static final int FIXED_SCALABLE_NINE_PATCH = 10; |
| 67 |
/** |
| 68 |
* Ability to render RTL layouts. |
| 69 |
*/ |
| 70 |
public static final int RTL = 11; |
| 71 |
/** |
| 72 |
* Ability to render ActionBar. |
| 73 |
*/ |
| 74 |
public static final int ACTION_BAR = 12; |
| 75 |
/** |
| 76 |
* Ability to simulate older Platform Versions. |
| 77 |
* <p> |
| 78 |
* This is the last feature supported by API 12. |
| 79 |
*/ |
| 80 |
public static final int SIMULATE_PLATFORM = 13; |
| 81 |
/** |
| 82 |
* All features before this map to the ones in {@link Capability}. Any feature greater than this |
| 83 |
* is guaranteed to be not supported by a LayoutLib using the older api. |
| 84 |
*/ |
| 85 |
public static final int LAST_CAPABILITY = SIMULATE_PLATFORM; |
| 86 |
/** |
| 87 |
* Ability to render preferences. |
| 88 |
*/ |
| 89 |
public static final int PREFERENCES_RENDERING = 14; |
| 90 |
/** |
| 91 |
* Ability to render all states of a StateListDrawable and return all in a |
| 92 |
* single call. |
| 93 |
*/ |
| 94 |
public static final int RENDER_ALL_DRAWABLE_STATES = 15; |
| 95 |
/** |
| 96 |
* Ability to use custom layouts for RecyclerView$Adapter. |
| 97 |
*/ |
| 98 |
public static final int RECYCLER_VIEW_ADAPTER = 16; |
| 99 |
/** |
| 100 |
* Ability to set system time. |
| 101 |
* {@link RenderSession#setElapsedFrameTimeNanos(long)} |
| 102 |
* {@link RenderSession#setSystemBootTimeNanos(long)} |
| 103 |
* {@link RenderSession#setSystemTimeNanos(long)} |
| 104 |
*/ |
| 105 |
public static final int SYSTEM_TIME = 17; |
| 106 |
/** |
| 107 |
* Ability to use choreographer animations. |
| 108 |
*/ |
| 109 |
public static final int CHOREOGRAPHER = 18; |
| 110 |
/** |
| 111 |
* Ability to use a layout specific to the Theme Editor Preview for the navigation bar. |
| 112 |
*/ |
| 113 |
public static final int THEME_PREVIEW_NAVIGATION_BAR = 19; |
| 114 |
/** |
| 115 |
* Last known feature. |
| 116 |
* <p> |
| 117 |
* This should be avoided on the LayoutLib since, since using this makes updating the API used |
| 118 |
* by the LayoutLib without implementing any newly added features. |
| 119 |
*/ |
| 120 |
public static final int LAST_FEATURE = THEME_PREVIEW_NAVIGATION_BAR; |
| 121 |
} |