Skip to content

Commit 29c6df9

Browse files
author
Linden Darling
committed
Bugfixes and improvements to theming (now displays popup appropriate to non-Holo, Holo Dark, and Holo Light); Some improvements to ValidationManager; Some improvements to demo app; Some cleanup (removed old, unused classes);
1 parent 3b34880 commit 29c6df9

File tree

15 files changed

+492
-537
lines changed

15 files changed

+492
-537
lines changed

android-formidable-validation/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<application
1010
android:icon="@drawable/ic_launcher"
11-
android:label="@string/app_name" >
11+
android:label="@string/app_name" android:theme="@style/Theme.Holo.Light">
1212
<activity
1313
android:label="@string/app_name"
1414
android:name=".example.HomeActivity" >

android-formidable-validation/res/layout/textview_hint.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15+
16+
/*
17+
** Taken from Android internal resources.
18+
*/
1519
-->
16-
1720
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
18-
android:layout_width="wrap_content"
19-
android:layout_height="wrap_content"
21+
android:layout_width="match_parent"
22+
android:layout_height="match_parent"
2023
android:textAppearance="?android:attr/textAppearanceSmall"
21-
android:textColor="?android:attr/textColorPrimaryInverse"
22-
/>
24+
android:textColor="?android:attr/textColorPrimaryInverse" />
25+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2006 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+
** Taken from Android internal
18+
*/
19+
-->
20+
21+
<resources>
22+
<!-- These are the standard attributes that make up a complete theme. -->
23+
<declare-styleable name="Theme">
24+
<!-- Popup text displayed in TextView when setError is used. -->
25+
<attr name="errorMessageBackground" format="reference" />
26+
<!-- Background used instead of errorMessageBackground when the popup has to be above. -->
27+
<attr name="errorMessageAboveBackground" format="reference" />
28+
</declare-styleable>
29+
</resources>
Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/* //device/apps/common/assets/res/any/dimens.xml
4+
**
5+
** Copyright 2006, The Android Open Source Project
6+
**
7+
** Licensed under the Apache License, Version 2.0 (the "License");
8+
** you may not use this file except in compliance with the License.
9+
** You may obtain a copy of the License at
10+
**
11+
** http://www.apache.org/licenses/LICENSE-2.0
12+
**
13+
** Unless required by applicable law or agreed to in writing, software
14+
** distributed under the License is distributed on an "AS IS" BASIS,
15+
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
** See the License for the specific language governing permissions and
17+
** limitations under the License.
18+
*/
19+
-->
20+
<resources>
21+
<!-- The width that is used when creating thumbnails of applications. -->
22+
<dimen name="thumbnail_width">164dp</dimen>
23+
<!-- The height that is used when creating thumbnails of applications. -->
24+
<dimen name="thumbnail_height">145dp</dimen>
25+
<!-- The standard size (both width and height) of an application icon that
26+
will be displayed in the app launcher and elsewhere. -->
27+
<dimen name="app_icon_size">48dip</dimen>
28+
<!-- The maximum number of action buttons that should be permitted within
29+
an action bar/action mode. This will be used to determine how many
30+
showAsAction="ifRoom" items can fit. "always" items can override this. -->
31+
<integer name="max_action_buttons">2</integer>
32+
<dimen name="toast_y_offset">64dip</dimen>
33+
<!-- Height of the status bar -->
34+
<dimen name="status_bar_height">25dip</dimen>
35+
<!-- Height of the bottom navigation / system bar. -->
36+
<dimen name="navigation_bar_height">48dp</dimen>
37+
<!-- Height of the bottom navigation bar in portrait; often the same as @dimen/navigation_bar_height -->
38+
<dimen name="navigation_bar_height_landscape">48dp</dimen>
39+
<!-- Width of the navigation bar when it is placed vertically on the screen -->
40+
<dimen name="navigation_bar_width">42dp</dimen>
41+
<!-- Height of notification icons in the status bar -->
42+
<dimen name="status_bar_icon_size">24dip</dimen>
43+
<!-- Size of the giant number (unread count) in the notifications -->
44+
<dimen name="status_bar_content_number_size">48sp</dimen>
45+
<!-- Height of the system bar (combined status & navigation); used by
46+
SystemUI internally, not respected by the window manager. -->
47+
<dimen name="system_bar_height">@dimen/navigation_bar_height</dimen>
48+
<!-- Height of notification icons in the system bar -->
49+
<dimen name="system_bar_icon_size">32dip</dimen>
50+
<!-- Margin at the edge of the screen to ignore touch events for in the windowshade. -->
51+
<dimen name="status_bar_edge_ignore">5dp</dimen>
52+
53+
<!-- Size of the fastscroll hint letter -->
54+
<dimen name="fastscroll_overlay_size">104dp</dimen>
55+
<!-- Width of the fastscroll thumb -->
56+
<dimen name="fastscroll_thumb_width">64dp</dimen>
57+
<!-- Height of the fastscroll thumb -->
58+
<dimen name="fastscroll_thumb_height">52dp</dimen>
59+
<!-- Min width for a tablet device -->
60+
<dimen name="min_xlarge_screen_width">800dp</dimen>
61+
62+
<!-- Default height of a key in the password keyboard for alpha (used by keyguard) -->
63+
<dimen name="password_keyboard_key_height_alpha">56dip</dimen>
64+
<!-- Default height of a key in the password keyboard for numeric (used by keyguard) -->
65+
<dimen name="password_keyboard_key_height_numeric">56dip</dimen>
66+
<!-- Default correction for the space key in the password keyboard (used by keyguard) -->
67+
<dimen name="password_keyboard_spacebar_vertical_correction">4dip</dimen>
68+
<!-- Default horizontal gap between keys in the password keyboard (used by keyguard) -->
69+
<dimen name="password_keyboard_horizontalGap">3dip</dimen>
70+
<!-- Default vertical gap between keys in the password keyboard (used by keyguard) -->
71+
<dimen name="password_keyboard_verticalGap">9dip</dimen>
72+
73+
<!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
74+
<dimen name="keyguard_lockscreen_outerring_diameter">270dp</dimen>
75+
76+
<!-- Default target placement radius for GlowPadView. Should be 1/2 of outerring diameter. -->
77+
<dimen name="glowpadview_target_placement_radius">135dip</dimen>
78+
79+
<!-- Default glow radius for GlowPadView -->
80+
<dimen name="glowpadview_glow_radius">75dip</dimen>
81+
82+
<!-- Default distance beyond which GlowPadView snaps to the matching target -->
83+
<dimen name="glowpadview_snap_margin">40dip</dimen>
84+
85+
<!-- Default distance from each snap target that GlowPadView considers a "hit" -->
86+
<dimen name="glowpadview_inner_radius">15dip</dimen>
87+
88+
<!-- Preference activity side margins -->
89+
<dimen name="preference_screen_side_margin">0dp</dimen>
90+
<!-- Preference activity side margins negative-->
91+
<dimen name="preference_screen_side_margin_negative">0dp</dimen>
92+
<!-- Preference activity top margin -->
93+
<dimen name="preference_screen_top_margin">0dp</dimen>
94+
<!-- Preference activity bottom margin -->
95+
<dimen name="preference_screen_bottom_margin">0dp</dimen>
96+
<!-- Preference widget area width (to the left of the text) -->
97+
<dimen name="preference_widget_width">48dp</dimen>
98+
<!-- Preference fragment padding, bottom -->
99+
<dimen name="preference_fragment_padding_bottom">0dp</dimen>
100+
<!-- Preference fragment padding, sides -->
101+
<dimen name="preference_fragment_padding_side">16dp</dimen>
102+
<!-- Weight of the left pane in a multi-pane preference layout. -->
103+
<integer name="preferences_left_pane_weight">4</integer>
104+
<!-- Weight of the right pane in a multi-pane preference layout. So the split is 40:60 -->
105+
<integer name="preferences_right_pane_weight">6</integer>
106+
<!-- Padding to the left of the preference panel breadcrumb -->
107+
<dimen name="preference_breadcrumb_paddingLeft">0dp</dimen>
108+
<!-- Padding to the right of the preference panel breadcrumb -->
109+
<dimen name="preference_breadcrumb_paddingRight">0dp</dimen>
110+
<!-- Minimum space to allocate to the left of a preference item for an icon.
111+
This helps in aligning titles when some items have icons and some don't. When space is
112+
at a premium, we don't pre-allocate any space. -->
113+
<dimen name="preference_icon_minWidth">0dp</dimen>
114+
<!-- The platform's desired minimum size for a dialog's width when it
115+
is along the major axis (that is the screen is landscape). This may
116+
be either a fraction or a dimension. -->
117+
<item type="dimen" name="dialog_min_width_major">65%</item>
118+
119+
<!-- The platform's desired fixed width for a dialog along the major axis
120+
(the screen is in landscape). This may be either a fraction or a dimension.-->
121+
<item type="dimen" name="dialog_fixed_width_major">320dp</item>
122+
<!-- The platform's desired fixed width for a dialog along the minor axis
123+
(the screen is in portrait). This may be either a fraction or a dimension.-->
124+
<item type="dimen" name="dialog_fixed_width_minor">320dp</item>
125+
<!-- The platform's desired fixed height for a dialog along the major axis
126+
(the screen is in portrait). This may be either a fraction or a dimension.-->
127+
<item type="dimen" name="dialog_fixed_height_major">80%</item>
128+
<!-- The platform's desired fixed height for a dialog along the minor axis
129+
(the screen is in landscape). This may be either a fraction or a dimension.-->
130+
<item type="dimen" name="dialog_fixed_height_minor">100%</item>
131+
132+
<!-- Preference activity, vertical padding for the header list -->
133+
<dimen name="preference_screen_header_vertical_padding">0dp</dimen>
134+
135+
<dimen name="preference_screen_header_padding_side">16dip</dimen>
136+
<integer name="preference_screen_header_scrollbarStyle">0x02000000</integer> <!-- outsideOverlay -->
137+
138+
<integer name="preference_fragment_scrollbarStyle">0x02000000</integer> <!-- outsideOverlay -->
139+
140+
<dimen name="preference_item_padding_side">8dip</dimen>
141+
<dimen name="preference_item_padding_inner">8dip</dimen>
142+
<dimen name="preference_child_padding_side">16dip</dimen>
143+
144+
<!-- The platform's desired minimum size for a dialog's width when it
145+
is along the minor axis (that is the screen is portrait). This may
146+
be either a fraction or a dimension. -->
147+
<item type="dimen" name="dialog_min_width_minor">95%</item>
148+
149+
<!-- The width of the big icons in notifications. -->
150+
<dimen name="notification_large_icon_width">64dp</dimen>
151+
<!-- The width of the big icons in notifications. -->
152+
<dimen name="notification_large_icon_height">64dp</dimen>
153+
154+
<!-- Minimum width of the search view text entry area. -->
155+
<dimen name="search_view_text_min_width">160dip</dimen>
156+
157+
<!-- Preferred width of the search view. -->
158+
<dimen name="search_view_preferred_width">320dip</dimen>
159+
160+
<!-- Dialog title height -->
161+
<dimen name="alert_dialog_title_height">64dip</dimen>
162+
<!-- Dialog button bar height -->
163+
<dimen name="alert_dialog_button_bar_height">48dip</dimen>
164+
165+
<!-- Default height of an action bar. -->
166+
<dimen name="action_bar_default_height">48dip</dimen>
167+
<!-- Vertical padding around action bar icons. -->
168+
<dimen name="action_bar_icon_vertical_padding">8dip</dimen>
169+
<!-- Text size for action bar titles -->
170+
<dimen name="action_bar_title_text_size">18dp</dimen>
171+
<!-- Text size for action bar subtitles -->
172+
<dimen name="action_bar_subtitle_text_size">14dp</dimen>
173+
<!-- Top margin for action bar subtitles -->
174+
<dimen name="action_bar_subtitle_top_margin">-3dp</dimen>
175+
<!-- Bottom margin for action bar subtitles -->
176+
<dimen name="action_bar_subtitle_bottom_margin">5dip</dimen>
177+
178+
<!-- Size of clock font in LockScreen on Unsecure unlock screen. -->
179+
<dimen name="keyguard_lockscreen_clock_font_size">80dip</dimen>
180+
181+
<!-- Size of status line font on Unsecure unlock LockScreen. -->
182+
<dimen name="keyguard_lockscreen_status_line_font_size">14dip</dimen>
183+
184+
<!-- Size of right margin on Unsecure unlock LockScreen -->
185+
<dimen name="keyguard_lockscreen_status_line_font_right_margin">42dip</dimen>
186+
187+
<!-- Size of top margin on Clock font to edge on unlock LockScreen -->
188+
<dimen name="keyguard_lockscreen_status_line_clockfont_top_margin">22dip</dimen>
189+
190+
<!-- Size of top margin on Clock font to edge on unlock LockScreen -->
191+
<dimen name="keyguard_lockscreen_status_line_clockfont_bottom_margin">12dip</dimen>
192+
193+
<!-- Padding on left margin of PIN text entry field to center it when del button is showing -->
194+
<dimen name="keyguard_lockscreen_pin_margin_left">40dip</dimen>
195+
196+
<!-- Minimum popup width for selecting an activity in ActivityChooserDialog/ActivityChooserView. -->
197+
<dimen name="activity_chooser_popup_min_width">200dip</dimen>
198+
199+
<!-- The default gap between components in a layout. -->
200+
<dimen name="default_gap">8dip</dimen>
201+
202+
<!-- Text padding for dropdown items -->
203+
<dimen name="dropdownitem_text_padding_left">8dip</dimen>
204+
205+
<!-- Text padding for dropdown items -->
206+
<dimen name="dropdownitem_text_padding_right">8dip</dimen>
207+
208+
<!-- Width of the icon in a dropdown list -->
209+
<dimen name="dropdownitem_icon_width">32dip</dimen>
210+
211+
<!-- Default width for a textview error popup -->
212+
<dimen name="textview_error_popup_default_width">240dip</dimen>
213+
214+
<!-- Volume panel y offset -->
215+
<dimen name="volume_panel_top">80dp</dimen>
216+
217+
<!-- Default padding to apply to AppWidgetHostViews containing widgets targeting API level 14 and up. -->
218+
<dimen name="default_app_widget_padding_left">8dp</dimen>
219+
<dimen name="default_app_widget_padding_top">8dp</dimen>
220+
<dimen name="default_app_widget_padding_right">8dp</dimen>
221+
<dimen name="default_app_widget_padding_bottom">8dp</dimen>
222+
223+
<!-- Minimum width for an action button in the menu area of an action bar -->
224+
<dimen name="action_button_min_width">56dip</dimen>
225+
226+
<!-- Maximum height for a stacked tab bar as part of an action bar -->
227+
<dimen name="action_bar_stacked_max_height">48dp</dimen>
228+
229+
<!-- Maximum width for a stacked action bar tab. This prevents
230+
action bar tabs from becoming too wide on a wide screen when only
231+
a few are present. -->
232+
<dimen name="action_bar_stacked_tab_max_width">180dp</dimen>
233+
234+
<!-- Size of notification text (see TextAppearance.StatusBar.EventContent) -->
235+
<dimen name="notification_text_size">14dp</dimen>
236+
<!-- Size of notification text titles (see TextAppearance.StatusBar.EventContent.Title) -->
237+
<dimen name="notification_title_text_size">18dp</dimen>
238+
<!-- Size of smaller notification text (see TextAppearance.StatusBar.EventContent.Line2, Info, Time) -->
239+
<dimen name="notification_subtext_size">12dp</dimen>
240+
</resources>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Copyright (C) 2006 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+
<!--
18+
===============================================================
19+
PLEASE READ
20+
===============================================================
21+
22+
The Holo themes must not be modified in order to pass CTS.
23+
Many related themes and styles depend on other values defined in this file.
24+
If you would like to provide custom themes and styles for your device,
25+
please see themes_device_defaults.xml.
26+
27+
===============================================================
28+
PLEASE READ
29+
===============================================================
30+
-->
31+
<resources>
32+
<!-- The default theme for apps on API level 10 and lower. This is the theme used for
33+
activities that have not explicitly set their own theme.
34+
<p>You can count on this being a dark
35+
background with light text on top, but should try to make no
36+
other assumptions about its appearance. In particular, the text
37+
inside of widgets using this theme may be completely different,
38+
with the widget container being a light color and the text on top
39+
of it a dark color.
40+
<p>If you're developing for API level 11 and higher, you should instead use {@link
41+
#Theme_Holo} or {@link #Theme_DeviceDefault}.</p>
42+
-->
43+
<style name="Theme" parent="@android:style/Theme">
44+
<item name="errorMessageBackground">@drawable/popup_inline_error</item>
45+
<item name="errorMessageAboveBackground">@drawable/popup_inline_error_above</item>
46+
</style>
47+
48+
<!-- Honeycomb holographic theme (dark version).
49+
<p>This is the default system theme for apps that target API level 11 - 13. Starting
50+
with API level 14, the default system theme is supplied by {@link #Theme_DeviceDefault},
51+
which might apply a different style on different devices. If you want to ensure that your
52+
app consistenly uses the Holo theme at all times, you must explicitly declare it in your
53+
manifest. For example, {@code &lt;application android:theme="@android:style/Theme.Holo"&gt;}.
54+
For more information, read <a
55+
href="http://android-developers.blogspot.com/2012/01/holo-everywhere.html">Holo
56+
Everywhere</a>.</p>
57+
<p>The widgets in the holographic theme are translucent on their brackground, so
58+
applications must ensure that any background they use with this theme is itself
59+
dark; otherwise, it will be difficult to see the widgets. This UI style also includes a
60+
full action bar by default.</p>
61+
62+
<p>Styles used by the Holo theme are named using the convention Type.Holo.Etc
63+
(for example, {@code Widget.Holo.Button} and {@code
64+
TextAppearance.Holo.Widget.PopupMenu.Large}).
65+
Specific resources used by Holo are named using the convention @type/foo_bar_baz_holo
66+
with trailing _dark or _light specifiers if they are not shared between both light and
67+
dark versions of the theme. -->
68+
<style name="Theme.Holo" parent="@android:style/Theme.Holo">
69+
<item name="errorMessageBackground">@drawable/popup_inline_error_holo_dark</item>
70+
<item name="errorMessageAboveBackground">@drawable/popup_inline_error_above_holo_dark</item>
71+
</style>
72+
73+
<!-- Honeycomb holographic theme (light version). The widgets in the
74+
holographic theme are translucent on their brackground, so applications
75+
must ensure that any background they use with this theme is itself
76+
light; otherwise, it will be difficult to see the widgets. This
77+
UI style also includes a full action bar by default. -->
78+
<style name="Theme.Holo.Light" parent="@android:style/Theme.Holo.Light">
79+
<item name="errorMessageBackground">@drawable/popup_inline_error_holo_light</item>
80+
<item name="errorMessageAboveBackground">@drawable/popup_inline_error_above_holo_light</item>
81+
</style>
82+
</resources>

0 commit comments

Comments
 (0)