• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.IImageFactory;
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 = new Key<>("rootTag", String.class);
33     public static final Key<Boolean> FLAG_KEY_DISABLE_BITMAP_CACHING =
34             new Key<>("disableBitmapCaching", Boolean.class);
35     public static final Key<Boolean> FLAG_KEY_RENDER_ALL_DRAWABLE_STATES =
36             new Key<>("renderAllDrawableStates", Boolean.class);
37 
38     /**
39      * To tell LayoutLib to not render when creating a new session. This allows controlling when the first
40      * layout rendering will happen.
41      */
42     public static final Key<Boolean> FLAG_DO_NOT_RENDER_ON_CREATE =
43             new Key<>("doNotRenderOnCreate", Boolean.class);
44     /**
45      * To tell Layoutlib which path to use for the adaptive icon mask.
46      */
47     public static final Key<String> FLAG_KEY_ADAPTIVE_ICON_MASK_PATH =
48             new Key<>("adaptiveIconMaskPath", String.class);
49 
50     /**
51      * When enabled, Layoutlib will resize the output image to whatever size
52      * is returned by {@link IImageFactory#getImage(int, int)}. The default
53      * behaviour when this is false is to crop the image to the size of the image
54      * returned by {@link IImageFactory#getImage(int, int)}.
55      */
56     public static final Key<Boolean> FLAG_KEY_RESULT_IMAGE_AUTO_SCALE =
57             new Key<>("enableResultImageAutoScale", Boolean.class);
58 
59     /**
60      * To tell Layoutlib the path of the image resource of the wallpaper to use for dynamic theming.
61      * If null, use default system colors.
62      */
63     public static final Key<String> FLAG_KEY_WALLPAPER_PATH =
64             new Key<>("wallpaperPath", String.class);
65 
66     /**
67      * To tell Layoutlib to use the themed version of adaptive icons.
68      */
69     public static final Key<Boolean> FLAG_KEY_USE_THEMED_ICON =
70             new Key<>("useThemedIcon", Boolean.class);
71 
72     /**
73      * To tell Layoutlib to automatically create a monochrome version of adaptive icons
74      * if one is not explicitly provided.
75      */
76     public static final Key<Boolean> FLAG_KEY_FORCE_MONOCHROME_ICON =
77             new Key<>("forceMonochromeIcon", Boolean.class);
78 
79     /**
80      * To tell Layoutlib to use the gesture navigation, instead of a button navigation bar.
81      */
82     public static final Key<Boolean> FLAG_KEY_USE_GESTURE_NAV =
83             new Key<>("useGestureNav", Boolean.class);
84 
85     /**
86      * To tell Layoutlib to display the app edge to edge.
87      */
88     public static final Key<Boolean> FLAG_KEY_EDGE_TO_EDGE =
89             new Key<>("edgeToEdge", Boolean.class);
90 
91     /**
92      * To tell Layoutlib to display the device cutout if there is one.
93      */
94     public static final Key<Boolean> FLAG_KEY_SHOW_CUTOUT =
95             new Key<>("showCutout", Boolean.class);
96 
97     /**
98      * To tell Layoutlib whether to cache bitmaps.
99      */
100     public static final Key<Boolean> FLAG_KEY_CACHE_BITMAPS =
101             new Key<>("cacheBitmaps", Boolean.class);
102 
103     // Disallow instances.
RenderParamsFlags()104     private RenderParamsFlags() {}
105 }
106