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 
17 package com.android.layoutlib.bridge.android;
18 
19 import com.android.ide.common.rendering.api.LayoutlibCallback;
20 import com.android.ide.common.rendering.api.RenderParams;
21 import com.android.ide.common.rendering.api.SessionParams.Key;
22 
23 /**
24  * This contains all known keys for the {@link RenderParams#getFlag(Key)}.
25  * <p/>
26  * The IDE has its own copy of this class which may be newer or older than this one.
27  * <p/>
28  * Constants should never be modified or removed from this class.
29  */
30 public final class RenderParamsFlags {
31 
32     public static final Key<String> FLAG_KEY_ROOT_TAG =
33             new Key<String>("rootTag", String.class);
34     public static final Key<Boolean> FLAG_KEY_DISABLE_BITMAP_CACHING =
35             new Key<Boolean>("disableBitmapCaching", Boolean.class);
36     public static final Key<Boolean> FLAG_KEY_RENDER_ALL_DRAWABLE_STATES =
37             new Key<Boolean>("renderAllDrawableStates", Boolean.class);
38     /**
39      * To tell LayoutLib that the IDE supports RecyclerView.
40      * <p/>
41      * Default is false.
42      */
43     public static final Key<Boolean> FLAG_KEY_RECYCLER_VIEW_SUPPORT =
44             new Key<Boolean>("recyclerViewSupport", Boolean.class);
45     /**
46      * The application package name. Used via {@link LayoutlibCallback#getFlag(Key)}
47      */
48     public static final Key<String> FLAG_KEY_APPLICATION_PACKAGE =
49             new Key<String>("applicationPackage", String.class);
50     /**
51      * To tell LayoutLib that IDE supports providing XML Parser for a file (useful for getting in
52      * memory contents of the file). Used via {@link LayoutlibCallback#getFlag(Key)}
53      */
54     public static final Key<Boolean> FLAG_KEY_XML_FILE_PARSER_SUPPORT =
55             new Key<Boolean>("xmlFileParser", Boolean.class);
56     /**
57      * To tell LayoutLib to not render when creating a new session. This allows controlling when the first
58      * layout rendering will happen.
59      */
60     public static final Key<Boolean> FLAG_DO_NOT_RENDER_ON_CREATE =
61             new Key<Boolean>("doNotRenderOnCreate", Boolean.class);
62 
63     // Disallow instances.
RenderParamsFlags()64     private RenderParamsFlags() {}
65 }
66