OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.content.app; | |
6 | |
7 import java.lang.reflect.Field; | |
8 import java.lang.reflect.Modifier; | |
9 | |
10 /** | |
11 * Interface to list and expose any required Android app resources. | |
12 * All resources must be registered before instantiating ContentView objects. | |
13 */ | |
14 public class AppResource { | |
15 /** Array resource containing the official command line arguments. */ | |
16 public static int ARRAY_OFFICIAL_COMMAND_LINE; | |
17 | |
18 /** Dimension defining the corner radii of the favicon color strip when crea
ting shortcuts. */ | |
19 public static int DIMENSION_FAVICON_COLORSTRIP_CORNER_RADII; | |
20 | |
21 /** Dimension defining the height of the favicon color strip when creating s
hortcuts. */ | |
22 public static int DIMENSION_FAVICON_COLORSTRIP_HEIGHT; | |
23 | |
24 /** Dimension defining the padding of the favicon color strip when creating
shortcuts. */ | |
25 public static int DIMENSION_FAVICON_COLORSTRIP_PADDING; | |
26 | |
27 /** Dimension defining the width of the favicon color strip when creating sh
ortcuts. */ | |
28 public static int DIMENSION_FAVICON_COLORSTRIP_WIDTH; | |
29 | |
30 /** Dimension defining the border of the favicon fold when creating shortcut
s. */ | |
31 public static int DIMENSION_FAVICON_FOLD_BORDER; | |
32 | |
33 /** Dimension defining the corner radii of the favicon fold when creating sh
ortcuts. */ | |
34 public static int DIMENSION_FAVICON_FOLD_CORNER_RADII; | |
35 | |
36 /** Dimension defining the shadow of the favicon fold when creating shortcut
s. */ | |
37 public static int DIMENSION_FAVICON_FOLD_SHADOW; | |
38 | |
39 /** Dimension defining the size of the favicon fold when creating shortcuts.
*/ | |
40 public static int DIMENSION_FAVICON_FOLD_SIZE; | |
41 | |
42 /** Dimension defining the size of the favicon image when creating shortcuts
. */ | |
43 public static int DIMENSION_FAVICON_SIZE; | |
44 | |
45 /** Dimension of the radius used in the link preview overlay. */ | |
46 public static int DIMENSION_LINK_PREVIEW_OVERLAY_RADIUS; | |
47 | |
48 /** Drawable icon resource for the Share button in the action bar. */ | |
49 public static int DRAWABLE_ICON_ACTION_BAR_SHARE; | |
50 | |
51 /** Drawable icon resource for the Web Search button in the action bar. */ | |
52 public static int DRAWABLE_ICON_ACTION_BAR_WEB_SEARCH; | |
53 | |
54 /** Drawable icon resource of the Application icon. */ | |
55 public static int DRAWABLE_ICON_APP_ICON; | |
56 | |
57 /** Drawable icon resource used for favicons by default. */ | |
58 public static int DRAWABLE_ICON_DEFAULT_FAVICON; | |
59 | |
60 /** Drawable resource for the link preview popup overlay. */ | |
61 public static int DRAWABLE_LINK_PREVIEW_POPUP_OVERLAY; | |
62 | |
63 /** Id of the autofill label. */ | |
64 public static int ID_AUTOFILL_LABEL; | |
65 | |
66 /** Id of the autofill name. */ | |
67 public static int ID_AUTOFILL_NAME; | |
68 | |
69 /** Id of the date picker view. */ | |
70 public static int ID_DATE_PICKER; | |
71 | |
72 /** Id of the cancel button in Javascript modal dialogs. */ | |
73 public static int ID_JS_MODAL_DIALOG_BUTTON_CANCEL; | |
74 | |
75 /** Id of the confirm button in Javascript modal dialogs. */ | |
76 public static int ID_JS_MODAL_DIALOG_BUTTON_CONFIRM; | |
77 | |
78 /** Id of the CheckBox to suppress further modal dialogs in Javascript modal
dialogs. */ | |
79 public static int ID_JS_MODAL_DIALOG_CHECKBOX_SUPPRESS_DIALOGS; | |
80 | |
81 /** Id of the message TextView in Javascript modal dialogs. */ | |
82 public static int ID_JS_MODAL_DIALOG_TEXT_MESSAGE; | |
83 | |
84 /** Id of the prompt EditText in Javascript modal dialogs. */ | |
85 public static int ID_JS_MODAL_DIALOG_TEXT_PROMPT; | |
86 | |
87 /** Id of the title TextView in Javascript modal dialogs. */ | |
88 public static int ID_JS_MODAL_DIALOG_TEXT_TITLE; | |
89 | |
90 /** Id of the month picker view. */ | |
91 public static int ID_MONTH_PICKER; | |
92 | |
93 /** Id of the time picker view. */ | |
94 public static int ID_TIME_PICKER; | |
95 | |
96 /** Id of the year picker view. */ | |
97 public static int ID_YEAR_PICKER; | |
98 | |
99 /** Id of the view containing the month and year pickers. */ | |
100 public static int ID_MONTH_YEAR_PICKERS_CONTAINER; | |
101 | |
102 /** Layout of the autofill popup. */ | |
103 public static int LAYOUT_AUTOFILL_TEXT; | |
104 | |
105 /** Layout of the date/time picker dialog. */ | |
106 public static int LAYOUT_DATE_TIME_PICKER_DIALOG; | |
107 | |
108 /** Layout of the Javascript modal dialog. */ | |
109 public static int LAYOUT_JS_MODAL_DIALOG; | |
110 | |
111 /** Layout of the month picker. */ | |
112 public static int LAYOUT_MONTH_PICKER; | |
113 | |
114 /** Layout of the month picker dialog. */ | |
115 public static int LAYOUT_MONTH_PICKER_DIALOG; | |
116 | |
117 /** Mipmap image used as background for bookmark shortcut icons. */ | |
118 public static int MIPMAP_BOOKMARK_SHORTCUT_BACKGROUND; | |
119 | |
120 /** String for the Share button in the action bar. */ | |
121 public static int STRING_ACTION_BAR_SHARE; | |
122 | |
123 /** String for the Web Search button in the action bar. */ | |
124 public static int STRING_ACTION_BAR_WEB_SEARCH; | |
125 | |
126 /** String for the Content View accessibility contentDescription. */ | |
127 public static int STRING_CONTENT_VIEW_CONTENT_DESCRIPTION; | |
128 | |
129 /** String for the Clear button in the date picker dialog. */ | |
130 public static int STRING_DATE_PICKER_DIALOG_CLEAR; | |
131 | |
132 /** String for the Set button in the date picker dialog. */ | |
133 public static int STRING_DATE_PICKER_DIALOG_SET; | |
134 | |
135 /** String for the title of the date/time picker dialog. */ | |
136 public static int STRING_DATE_TIME_PICKER_DIALOG_TITLE; | |
137 | |
138 /** String for 'Don't reload this page' in Javascript modal dialogs. */ | |
139 public static int STRING_JS_MODAL_DIALOG_DONT_RELOAD_THIS_PAGE; | |
140 | |
141 /** String for 'Leave this page' in Javascript modal dialogs. */ | |
142 public static int STRING_JS_MODAL_DIALOG_LEAVE_THIS_PAGE; | |
143 | |
144 /** String for 'Reload this page' in Javascript modal dialogs. */ | |
145 public static int STRING_JS_MODAL_DIALOG_RELOAD_THIS_PAGE; | |
146 | |
147 /** String for 'Stay on this page' in Javascript modal dialogs. */ | |
148 public static int STRING_JS_MODAL_DIALOG_STAY_ON_THIS_PAGE; | |
149 | |
150 /** String for the title of the month picker dialog. */ | |
151 public static int STRING_MONTH_PICKER_DIALOG_TITLE; | |
152 | |
153 /** String for playback errors in the media player. */ | |
154 public static int STRING_MEDIA_PLAYER_MESSAGE_PLAYBACK_ERROR; | |
155 | |
156 /** String for unknown errors in the media player. */ | |
157 public static int STRING_MEDIA_PLAYER_MESSAGE_UNKNOWN_ERROR; | |
158 | |
159 /** String for the button contents in the media player error dialog. */ | |
160 public static int STRING_MEDIA_PLAYER_ERROR_BUTTON; | |
161 | |
162 /** String for the title of the media player error dialog. */ | |
163 public static int STRING_MEDIA_PLAYER_ERROR_TITLE; | |
164 | |
165 /** String for the progress bar while loading the fullscreen video. */ | |
166 public static int STRING_MEDIA_PLAYER_LOADING_VIDEO; | |
167 | |
168 /** | |
169 * Iterates through all the resources ids and verifies they have values othe
r than zero. | |
170 * @return true if all the resources have been registered. | |
171 */ | |
172 public static boolean verifyResourceRegistration() { | |
173 Field[] fields = AppResource.class.getDeclaredFields(); | |
174 for (Field field : fields) { | |
175 try { | |
176 if (field.getType().equals(int.class) && Modifier.isStatic(field.g
etModifiers())) { | |
177 if (field.getInt(null) == 0) return false; | |
178 } | |
179 } catch (IllegalAccessException e) { | |
180 } | |
181 } | |
182 return true; | |
183 } | |
184 } | |
OLD | NEW |