Style and asset cleanup

Updates button drawable and colors, cleans up Quantum styles, updates
highlight attribute name and color, fixes popup backgrounds.

Also fixes GradientDrawable opacity check.

Change-Id: I75dd35e815a8a33ec9f0b16e881e774edfb8c092
This commit is contained in:
Alan Viverette
2014-05-21 18:10:53 -07:00
parent c106c12e56
commit 0a1c6f021b
14 changed files with 110 additions and 79 deletions

View File

@@ -390,8 +390,8 @@ package android {
field public static final int colorBackground = 16842801; // 0x1010031
field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
field public static final int colorButtonNormal = 16843822; // 0x101042e
field public static final int colorButtonPressed = 16843823; // 0x101042f
field public static final int colorControlActivated = 16843821; // 0x101042d
field public static final int colorControlHighlight = 16843823; // 0x101042f
field public static final int colorControlNormal = 16843820; // 0x101042c
field public static final int colorFocusedHighlight = 16843663; // 0x101038f
field public static final int colorForeground = 16842800; // 0x1010030

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="0.5" android:color="@color/quantum_grey_700"/>
<item android:color="@color/quantum_grey_700"/>
</selector>

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:alpha="0.5" android:color="@color/quantum_grey_300"/>
<item android:color="@color/quantum_grey_300"/>
</selector>

View File

@@ -15,7 +15,22 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorButtonPressed">
<item android:id="@id/mask"
android:drawable="@drawable/btn_qntm_alpha" />
android:tint="?attr/colorControlHighlight">
<item android:id="@id/mask">
<inset
android:insetLeft="4dp"
android:insetTop="4dp"
android:insetBottom="4dp"
android:insetRight="4dp">
<shape android:shape="rectangle">
<solid android:color="@color/white" />
<corners android:radius="2dp" />
<padding
android:left="4dp"
android:top="4dp"
android:bottom="4dp"
android:right="4dp" />
</shape>
</inset>
</item>
</ripple>

View File

@@ -18,11 +18,11 @@
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:autoMirrored="true">
<item android:state_pressed="true">
<color android:color="?attr/colorButtonPressed" />
<color android:color="?attr/colorControlHighlight" />
</item>
<item android:state_focused="true" android:state_enabled="true">
<nine-patch android:src="@drawable/btn_cab_done_qntm_alpha"
android:tint="?attr/colorButtonPressed" />
android:tint="?attr/colorControlHighlight" />
</item>
<item android:state_enabled="true">
<nine-patch android:src="@drawable/btn_cab_done_qntm_alpha"

View File

@@ -15,20 +15,22 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorButtonPressed">
android:tint="?attr/colorControlHighlight">
<item>
<selector>
<item android:state_enabled="false">
<nine-patch
android:src="@drawable/btn_qntm_alpha"
android:tint="?attr/colorButtonNormal"
android:alpha="?attr/disabledAlpha" />
</item>
<item>
<nine-patch
android:src="@drawable/btn_qntm_alpha"
android:tint="?attr/colorButtonNormal" />
</item>
</selector>
<inset
android:insetLeft="4dp"
android:insetTop="4dp"
android:insetBottom="4dp"
android:insetRight="4dp">
<shape android:shape="rectangle">
<solid android:color="?attr/colorButtonNormal" />
<corners android:radius="2dp" />
<padding
android:left="4dp"
android:top="4dp"
android:bottom="4dp"
android:right="4dp" />
</shape>
</inset>
</item>
</ripple>

View File

@@ -15,5 +15,5 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorButtonPressed"
android:tint="?attr/colorControlHighlight"
android:pinned="true" />

View File

@@ -15,7 +15,7 @@
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:tint="?attr/colorButtonPressed">
android:tint="?attr/colorControlHighlight">
<item android:id="@id/mask">
<color android:color="@color/white" />
</item>

View File

@@ -975,11 +975,11 @@
<!-- The color applied to framework controls in their activated (ex. checked) state. -->
<attr name="colorControlActivated" format="color" />
<!-- The color applied to framework control highlights (ex. ripples, selection). -->
<attr name="colorControlHighlight" format="color" />
<!-- The color applied to framework buttons in their normal state. -->
<attr name="colorButtonNormal" format="color" />
<!-- The color applied to framework buttons in their pressed state. -->
<attr name="colorButtonPressed" format="color" />
</declare-styleable>
<!-- **************************************************************** -->

View File

@@ -2134,7 +2134,7 @@
<public type="attr" name="colorControlNormal" />
<public type="attr" name="colorControlActivated" />
<public type="attr" name="colorButtonNormal" />
<public type="attr" name="colorButtonPressed" />
<public type="attr" name="colorControlHighlight" />
<public type="attr" name="persistable" />
<public type="attr" name="titleTextAppearance" />
<public type="attr" name="subtitleTextAppearance" />

View File

@@ -364,6 +364,7 @@ please see styles_device_defaults.xml.
<item name="textColor">?attr/textColorPrimary</item>
<item name="minHeight">48dip</item>
<item name="minWidth">96dip</item>
<item name="elevation">2dip</item>
<item name="stateListAnimator">@anim/button_state_list_anim_quantum</item>
</style>
@@ -437,7 +438,7 @@ please see styles_device_defaults.xml.
<style name="Widget.Quantum.AutoCompleteTextView" parent="Widget.AutoCompleteTextView">
<item name="dropDownSelector">@drawable/list_selector_quantum</item>
<item name="popupBackground">?attr/colorBackground</item>
<item name="popupBackground">@drawable/popup_background_quantum</item>
</style>
<style name="Widget.Quantum.CompoundButton" parent="Widget.CompoundButton"/>
@@ -528,7 +529,10 @@ please see styles_device_defaults.xml.
<item name="calendarViewShown">true</item>
</style>
<style name="Widget.Quantum.ActivityChooserView" parent="Widget.ActivityChooserView"/>
<style name="Widget.Quantum.ActivityChooserView" parent="Widget.ActivityChooserView">
<item name="background">@drawable/ab_share_pack_quantum</item>
</style>
<style name="Widget.Quantum.ImageWell" parent="Widget.ImageWell"/>
<style name="Widget.Quantum.ListView" parent="Widget.ListView">
@@ -610,7 +614,7 @@ please see styles_device_defaults.xml.
<style name="Widget.Quantum.Spinner" parent="Widget.Spinner.DropDown">
<item name="background">@drawable/spinner_background_quantum</item>
<item name="dropDownSelector">@drawable/list_selector_quantum</item>
<item name="popupBackground">?attr/colorBackground</item>
<item name="popupBackground">@drawable/popup_background_quantum</item>
<item name="dropDownVerticalOffset">0dip</item>
<item name="dropDownHorizontalOffset">0dip</item>
<item name="dropDownWidth">wrap_content</item>
@@ -805,21 +809,12 @@ please see styles_device_defaults.xml.
<style name="Widget.Quantum.Light.TextSelectHandle" parent="Widget.Quantum.TextSelectHandle"/>
<style name="Widget.Quantum.Light.TextSuggestionsPopupWindow" parent="Widget.Quantum.TextSuggestionsPopupWindow"/>
<style name="Widget.Quantum.Light.AbsListView" parent="Widget.Quantum.AbsListView"/>
<style name="Widget.Quantum.Light.AutoCompleteTextView" parent="Widget.AutoCompleteTextView">
<item name="dropDownSelector">@drawable/list_selector_quantum</item>
<item name="popupBackground">?attr/colorBackground</item>
</style>
<style name="Widget.Quantum.Light.AutoCompleteTextView" parent="Widget.Quantum.AutoCompleteTextView" />
<style name="Widget.Quantum.Light.CompoundButton" parent="Widget.Quantum.CompoundButton"/>
<style name="Widget.Quantum.Light.CompoundButton.CheckBox" parent="Widget.Quantum.CompoundButton.CheckBox"/>
<style name="Widget.Quantum.Light.CompoundButton.RadioButton" parent="Widget.Quantum.CompoundButton.RadioButton"/>
<style name="Widget.Quantum.Light.CompoundButton.Star" parent="Widget.Quantum.CompoundButton.Star"/>
<style name="Widget.Quantum.Light.CompoundButton.Switch" parent="Widget.Quantum.CompoundButton.Switch">
<item name="switchTextAppearance">@style/TextAppearance.Quantum.Widget.Switch</item>
</style>
<style name="Widget.Quantum.Light.CompoundButton.Switch" parent="Widget.Quantum.CompoundButton.Switch" />
<style name="Widget.Quantum.Light.ListView.DropDown" parent="Widget.Quantum.ListView.DropDown"/>
<style name="Widget.Quantum.Light.EditText" parent="Widget.Quantum.EditText"/>
<style name="Widget.Quantum.Light.ExpandableListView" parent="Widget.Quantum.ExpandableListView"/>
@@ -847,11 +842,7 @@ please see styles_device_defaults.xml.
</style>
<style name="Widget.Quantum.Light.DatePicker" parent="Widget.Quantum.DatePicker"/>
<style name="Widget.Quantum.Light.ActivityChooserView" parent="Widget.Quantum.ActivityChooserView">
<item name="background">@drawable/ab_share_pack_quantum</item>
</style>
<style name="Widget.Quantum.Light.ActivityChooserView" parent="Widget.Quantum.ActivityChooserView" />
<style name="Widget.Quantum.Light.ImageWell" parent="Widget.Quantum.ImageWell"/>
<style name="Widget.Quantum.Light.ListView" parent="Widget.Quantum.ListView"/>
<style name="Widget.Quantum.Light.ListView.White" parent="Widget.Quantum.ListView.White"/>
@@ -890,17 +881,7 @@ please see styles_device_defaults.xml.
<style name="Widget.Quantum.Light.ScrollView" parent="Widget.Quantum.ScrollView"/>
<style name="Widget.Quantum.Light.HorizontalScrollView" parent="Widget.Quantum.HorizontalScrollView"/>
<style name="Widget.Quantum.Light.Spinner" parent="Widget.Quantum.Spinner">
<item name="background">@drawable/spinner_background_quantum</item>
<item name="dropDownSelector">@drawable/list_selector_quantum</item>
<item name="popupBackground">?attr/colorBackground</item>
<item name="dropDownVerticalOffset">0dip</item>
<item name="dropDownHorizontalOffset">0dip</item>
<item name="dropDownWidth">wrap_content</item>
<item name="popupPromptView">@layout/simple_dropdown_hint</item>
</style>
<style name="Widget.Quantum.Light.Spinner" parent="Widget.Quantum.Spinner" />
<style name="Widget.Quantum.Light.Spinner.DropDown" parent="Widget.Quantum.Spinner.DropDown"/>
<style name="Widget.Quantum.Light.Spinner.DropDown.ActionBar" parent="Widget.Quantum.Spinner.DropDown.ActionBar"/>
<style name="Widget.Quantum.Light.TabWidget" parent="Widget.Quantum.TabWidget"/>
@@ -924,15 +905,8 @@ please see styles_device_defaults.xml.
<style name="Widget.Quantum.Light.ActionBar.TabView" parent="Widget.Quantum.ActionBar.TabView"/>
<style name="Widget.Quantum.Light.ActionBar.TabBar" parent="Widget.Quantum.ActionBar.TabBar"/>
<style name="Widget.Quantum.Light.ActionBar.TabText" parent="Widget.Quantum.ActionBar.TabText"/>
<style name="Widget.Quantum.Light.ActionMode" parent="Widget.Quantum.ActionMode">
<item name="titleTextStyle">@style/TextAppearance.Quantum.Widget.ActionMode.Title</item>
<item name="subtitleTextStyle">@style/TextAppearance.Quantum.Widget.ActionMode.Subtitle</item>
</style>
<style name="Widget.Quantum.Light.ActionButton.CloseMode">
<item name="background">@drawable/btn_cab_done_quantum</item>
</style>
<style name="Widget.Quantum.Light.ActionMode" parent="Widget.Quantum.ActionMode" />
<style name="Widget.Quantum.Light.ActionButton.CloseMode" parent="Widget.Quantum.ActionButton.CloseMode" />
<style name="Widget.Quantum.Light.ActionBar" parent="Widget.Quantum.ActionBar">
<item name="titleTextStyle">@style/TextAppearance.Quantum.Widget.ActionBar.Title</item>
@@ -952,10 +926,7 @@ please see styles_device_defaults.xml.
</style>
<style name="Widget.Quantum.Light.FastScroll" parent="Widget.Quantum.FastScroll"/>
<style name="Widget.Quantum.Light.MediaRouteButton" parent="Widget.Quantum.MediaRouteButton">
<item name="externalRouteEnabledDrawable">@drawable/ic_media_route_quantum</item>
</style>
<style name="Widget.Quantum.Light.MediaRouteButton" parent="Widget.Quantum.MediaRouteButton" />
<!-- Animation Styles -->

View File

@@ -58,7 +58,7 @@ please see themes_device_defaults.xml.
<item name="colorPrimaryLight">@color/legacy_primary_light</item>
<item name="colorControlActivated">@color/legacy_control_activated</item>
<item name="colorControlNormal">@color/legacy_control_normal</item>
<item name="colorButtonPressed">@color/legacy_button_pressed</item>
<item name="colorControlHighlight">@color/legacy_button_pressed</item>
<item name="colorButtonNormal">@color/legacy_button_normal</item>
<item name="disabledAlpha">0.5</item>
@@ -455,7 +455,7 @@ please see themes_device_defaults.xml.
<item name="colorPrimaryLight">@color/legacy_light_primary_light</item>
<item name="colorControlActivated">@color/legacy_light_control_activated</item>
<item name="colorControlNormal">@color/legacy_light_control_normal</item>
<item name="colorButtonPressed">@color/legacy_light_button_pressed</item>
<item name="colorControlHighlight">@color/legacy_light_button_pressed</item>
<item name="colorButtonNormal">@color/legacy_light_button_normal</item>
<item name="textColorPrimary">@android:color/primary_text_light</item>
@@ -970,7 +970,7 @@ please see themes_device_defaults.xml.
<item name="colorPrimaryLight">@color/holo_primary_light</item>
<item name="colorControlActivated">@color/holo_control_activated</item>
<item name="colorControlNormal">@color/holo_control_normal</item>
<item name="colorButtonPressed">@color/holo_button_pressed</item>
<item name="colorControlHighlight">@color/holo_button_pressed</item>
<item name="colorButtonNormal">@color/holo_button_normal</item>
<!-- Text styles -->
@@ -1310,7 +1310,7 @@ please see themes_device_defaults.xml.
<item name="colorPrimaryLight">@color/holo_light_primary_light</item>
<item name="colorControlActivated">@color/holo_light_control_activated</item>
<item name="colorControlNormal">@color/holo_light_control_normal</item>
<item name="colorButtonPressed">@color/holo_light_button_pressed</item>
<item name="colorControlHighlight">@color/holo_light_button_pressed</item>
<item name="colorButtonNormal">@color/holo_light_button_normal</item>
<!-- Text styles -->

View File

@@ -320,7 +320,7 @@ please see themes_device_defaults.xml.
<item name="dividerVertical">?attr/listDivider</item>
<item name="dividerHorizontal">?attr/listDivider</item>
<item name="buttonBarStyle">@style/Widget.Quantum.ButtonBar</item>
<item name="buttonBarButtonStyle">@style/Widget.Quantum.Button.Borderless.Small</item>
<item name="buttonBarButtonStyle">@style/Widget.Quantum.Button.Borderless</item>
<item name="segmentedButtonStyle">@style/Widget.Quantum.SegmentedButton</item>
<!-- SearchView attributes -->
@@ -377,8 +377,9 @@ please see themes_device_defaults.xml.
<item name="colorControlNormal">?attr/textColorSecondary</item>
<item name="colorControlActivated">?attr/colorPrimary</item>
<item name="colorButtonNormal">@color/quantum_grey_700</item>
<item name="colorButtonPressed">@color/quantum_grey_500</item>
<item name="colorControlHighlight">#30ffffff</item>
<item name="colorButtonNormal">@color/btn_default_quantum_dark</item>
</style>
<!-- Quantum Paper theme (light version). -->
@@ -718,8 +719,9 @@ please see themes_device_defaults.xml.
<item name="colorControlNormal">?attr/textColorSecondary</item>
<item name="colorControlActivated">?attr/colorPrimary</item>
<item name="colorButtonNormal">@color/quantum_grey_100</item>
<item name="colorButtonPressed">@color/quantum_grey_500</item>
<item name="colorControlHighlight">#30000000</item>
<item name="colorButtonNormal">@color/btn_default_quantum_light</item>
</style>
<!-- Variant of the quantum (light) theme that has a solid (opaque) action bar

View File

@@ -818,7 +818,8 @@ public class GradientDrawable extends Drawable {
@Override
public int getOpacity() {
return mGradientState.mOpaque ? PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT;
return (mAlpha == 255 && mGradientState.mOpaque) ?
PixelFormat.OPAQUE : PixelFormat.TRANSLUCENT;
}
@Override