diff options
author | Adam Powell <adamp@google.com> | 2010-11-09 21:28:59 -0800 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-11-11 14:53:29 -0800 |
commit | 021aad952bee3ac9ee4a98c09f1a012359088dd2 (patch) | |
tree | da02b1eba3c84ea6cbc95ace97c0ad7f9a52b17e /core/res | |
parent | d781089731127bd9199d47f53b170895868b8750 (diff) | |
download | frameworks_base-021aad952bee3ac9ee4a98c09f1a012359088dd2.zip frameworks_base-021aad952bee3ac9ee4a98c09f1a012359088dd2.tar.gz frameworks_base-021aad952bee3ac9ee4a98c09f1a012359088dd2.tar.bz2 |
First pass at styling progress bars for Holo.
Added attribute to let scale drawables size based on the intrinsic
width and height as a minimum. This helps prevent artifacts when
some 9-patches are used in situations like progress bars.
Change-Id: I168a232d3225afe9b5578a05a9b8634a1084404c
Diffstat (limited to 'core/res')
17 files changed, 75 insertions, 2 deletions
diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..192df6d --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_bg_holo_dark.9.png diff --git a/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png Binary files differnew file mode 100644 index 0000000..223416d --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_bg_holo_light.9.png diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..1a59124 --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png Binary files differnew file mode 100644 index 0000000..f119c6a --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..3c6c5ed --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_secondary_holo_dark.9.png diff --git a/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png Binary files differnew file mode 100644 index 0000000..cab3888 --- /dev/null +++ b/core/res/res/drawable-hdpi/progress_secondary_holo_light.9.png diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..316af64 --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_bg_holo_dark.9.png diff --git a/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png Binary files differnew file mode 100644 index 0000000..e286136 --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_bg_holo_light.9.png diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..0502669 --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png Binary files differnew file mode 100644 index 0000000..1ba9e34 --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png Binary files differnew file mode 100644 index 0000000..a2fe2b3 --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_secondary_holo_dark.9.png diff --git a/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png Binary files differnew file mode 100644 index 0000000..3b264ab --- /dev/null +++ b/core/res/res/drawable-mdpi/progress_secondary_holo_light.9.png diff --git a/core/res/res/drawable/progress_horizontal_holo_dark.xml b/core/res/res/drawable/progress_horizontal_holo_dark.xml new file mode 100644 index 0000000..ff270b3 --- /dev/null +++ b/core/res/res/drawable/progress_horizontal_holo_dark.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:id="@android:id/background" + android:drawable="@android:drawable/progress_bg_holo_dark" /> + + <item android:id="@android:id/secondaryProgress"> + <scale android:scaleWidth="100%" + android:drawable="@android:drawable/progress_secondary_holo_dark" /> + </item> + + <item android:id="@android:id/progress"> + <scale android:scaleWidth="100%" + android:drawable="@android:drawable/progress_primary_holo_dark" /> + </item> + +</layer-list> diff --git a/core/res/res/drawable/progress_horizontal_holo_light.xml b/core/res/res/drawable/progress_horizontal_holo_light.xml new file mode 100644 index 0000000..4935185 --- /dev/null +++ b/core/res/res/drawable/progress_horizontal_holo_light.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + + <item android:id="@android:id/background" + android:drawable="@android:drawable/progress_bg_holo_light" /> + + <item android:id="@android:id/secondaryProgress"> + <scale android:scaleWidth="100%" + android:drawable="@android:drawable/progress_secondary_holo_light" /> + </item> + + <item android:id="@android:id/progress"> + <scale android:scaleWidth="100%" + android:drawable="@android:drawable/progress_primary_holo_light" /> + </item> + +</layer-list> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 5d3dc03..115e59d 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -3021,6 +3021,10 @@ </attr> <!-- Reference to a drawable resource to draw with the specified scale. --> <attr name="drawable" /> + <!-- Use the drawable's intrinsic width and height as minimum size values. + Useful if the target drawable is a 9-patch or otherwise should not be scaled + down beyond a minimum size. --> + <attr name="useIntrinsicSizeAsMinimum" format="boolean" /> </declare-styleable> <declare-styleable name="ClipDrawable"> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index ff12e8f..a1b9dc9 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1364,6 +1364,7 @@ <public type="attr" name="exitFadeDuration" /> <public type="attr" name="selectableItemBackground" /> <public type="attr" name="autoAdvanceViewId" /> + <public type="attr" name="useIntrinsicSizeAsMinimum" /> <public type="anim" name="animator_fade_in" /> <public type="anim" name="animator_fade_out" /> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index f63805b..457175b 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1359,6 +1359,9 @@ </style> <style name="Widget.Holo.ProgressBar.Horizontal" parent="Widget.ProgressBar.Horizontal"> + <item name="android:progressDrawable">@android:drawable/progress_horizontal_holo_dark</item> + <item name="android:minHeight">16dip</item> + <item name="android:maxHeight">16dip</item> </style> <style name="Widget.Holo.ProgressBar.Small" parent="Widget.ProgressBar.Horizontal"> @@ -1383,8 +1386,8 @@ <item name="android:indeterminateOnly">false</item> <item name="android:progressDrawable">@android:drawable/scrubber_progress_horizontal_holo_dark</item> <item name="android:indeterminateDrawable">@android:drawable/scrubber_progress_horizontal_holo_dark</item> - <item name="android:minHeight">16dip</item> - <item name="android:maxHeight">16dip</item> + <item name="android:minHeight">6dip</item> + <item name="android:maxHeight">6dip</item> <item name="android:thumb">@android:drawable/scrubber_control_holo</item> <item name="android:thumbOffset">16dip</item> <item name="android:focusable">true</item> @@ -1646,6 +1649,7 @@ </style> <style name="Widget.Holo.Light.ProgressBar.Horizontal" parent="Widget.ProgressBar.Horizontal"> + <item name="android:progressDrawable">@android:drawable/progress_horizontal_holo_light</item> </style> <style name="Widget.Holo.Light.ProgressBar.Small" parent="Widget.ProgressBar.Small"> |