Use shape drawable for button asset, enable shadows

BUG: 15316437
Change-Id: I8c2ddce50fcf8082c8ba01350606d6f344e03306
This commit is contained in:
Alan Viverette
2014-07-01 16:12:35 -07:00
parent 564560e46d
commit 349a9bd760
20 changed files with 106 additions and 40 deletions

View File

@@ -18,16 +18,37 @@
<set>
<objectAnimator android:propertyName="translationZ"
android:duration="@integer/button_pressed_animation_duration"
android:valueTo="@dimen/button_pressed_z"
android:valueTo="@dimen/button_pressed_z_material"
android:valueType="floatType"/>
<objectAnimator android:propertyName="elevation"
android:duration="0"
android:valueTo="@dimen/button_elevation_material"
android:valueType="floatType"/>
</set>
</item>
<!-- base state -->
<item>
<item android:state_enabled="true">
<set>
<objectAnimator android:propertyName="translationZ"
android:duration="@integer/button_pressed_animation_duration"
android:valueTo="0"
android:startDelay="@integer/button_pressed_animation_delay"
android:valueType="floatType"/>
<objectAnimator android:propertyName="elevation"
android:duration="0"
android:valueTo="@dimen/button_elevation_material"
android:valueType="floatType" />
</set>
</item>
<item>
<set>
<objectAnimator android:propertyName="translationZ"
android:duration="0"
android:valueTo="0"
android:valueType="floatType"/>
<objectAnimator android:propertyName="elevation"
android:duration="0"
android:valueTo="0"
android:valueType="floatType"/>
</set>
</item>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 325 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -14,8 +14,13 @@
limitations under the License.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item android:id="@id/mask"
android:drawable="@drawable/btn_mtrl_alpha" />
</ripple>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/control_inset_material"
android:insetTop="@dimen/control_inset_material"
android:insetBottom="@dimen/control_inset_material"
android:insetRight="@dimen/control_inset_material">
<ripple android:color="?attr/colorControlHighlight">
<item android:id="@id/mask"
android:drawable="@drawable/btn_default_mtrl_shape" />
</ripple>
</inset>

View File

@@ -14,10 +14,12 @@
limitations under the License.
-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?attr/colorControlHighlight">
<item>
<nine-patch android:src="@drawable/btn_mtrl_alpha"
android:tint="?attr/colorButtonNormal" />
</item>
</ripple>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/control_inset_material"
android:insetTop="@dimen/control_inset_material"
android:insetBottom="@dimen/control_inset_material"
android:insetRight="@dimen/control_inset_material">
<ripple android:color="?attr/colorControlHighlight">
<item android:drawable="@drawable/btn_default_mtrl_shape" />
</ripple>
</inset>

View File

@@ -0,0 +1,26 @@
<?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.
-->
<!-- Used as the canonical button shape. -->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/control_corner_material" />
<solid android:color="?attr/colorButtonNormal" />
<padding android:top="@dimen/control_padding_material"
android:bottom="@dimen/control_padding_material"
android:left="@dimen/control_padding_material"
android:right="@dimen/control_padding_material" />
</shape>

View File

@@ -15,16 +15,24 @@
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="4dp"
android:insetTop="4dp"
android:insetBottom="4dp"
android:insetRight="4dp">
android:insetLeft="@dimen/control_inset_material"
android:insetTop="@dimen/control_inset_material"
android:insetBottom="@dimen/control_inset_material"
android:insetRight="@dimen/control_inset_material">
<layer-list android:paddingMode="stack">
<item>
<ripple android:color="?attr/colorControlHighlight">
<item>
<nine-patch android:src="@drawable/btn_toggle_mtrl_alpha"
android:tint="?attr/colorButtonNormal" />
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:topLeftRadius="@dimen/control_corner_material"
android:topRightRadius="@dimen/control_corner_material"/>
<solid android:color="?attr/colorButtonNormal" />
<padding android:top="@dimen/control_padding_material"
android:bottom="@dimen/control_padding_material"
android:left="@dimen/control_padding_material"
android:right="@dimen/control_padding_material" />
</shape>
</item>
</ripple>
</item>

View File

@@ -335,7 +335,6 @@
<item>@drawable/btn_check_to_on_mtrl_013</item>
<item>@drawable/btn_check_to_on_mtrl_014</item>
<item>@drawable/btn_check_to_on_mtrl_015</item>
<item>@drawable/btn_mtrl_alpha</item>
<item>@drawable/btn_radio_to_off_mtrl_000</item>
<item>@drawable/btn_radio_to_off_mtrl_001</item>
<item>@drawable/btn_radio_to_off_mtrl_002</item>
@@ -402,7 +401,6 @@
<item>@drawable/btn_switch_to_on_mtrl_013</item>
<item>@drawable/btn_switch_to_on_mtrl_014</item>
<item>@drawable/btn_toggle_indicator_mtrl_alpha</item>
<item>@drawable/btn_toggle_mtrl_alpha</item>
<item>@drawable/expander_close_mtrl_alpha</item>
<item>@drawable/expander_open_mtrl_alpha</item>
<item>@drawable/fastscroll_thumb_mtrl_alpha</item>

View File

@@ -58,6 +58,14 @@
<dimen name="floating_window_margin_right">16dp</dimen>
<dimen name="floating_window_margin_bottom">32dp</dimen>
<!-- Amount of elevation for pressed button state -->
<dimen name="button_pressed_z">2dp</dimen>
<!-- Elevation when button is pressed -->
<dimen name="button_elevation_material">1dp</dimen>
<!-- Z translation to apply when button is pressed -->
<dimen name="button_pressed_z_material">2dp</dimen>
<!-- Default insets (outer padding) around controls -->
<dimen name="control_inset_material">4dp</dimen>
<!-- Default inner padding within controls -->
<dimen name="control_padding_material">4dp</dimen>
<!-- Default rounded corner for controls -->
<dimen name="control_corner_material">2dp</dimen>
</resources>

View File

@@ -20,4 +20,5 @@
<integer name="kg_carousel_angle">75</integer>
<integer name="kg_glowpad_rotation_offset">0</integer>
<integer name="button_pressed_animation_duration">100</integer>
<integer name="button_pressed_animation_delay">100</integer>
</resources>

View File

@@ -355,35 +355,35 @@ please see styles_device_defaults.xml.
<style name="TextAppearance.StatusBar.Material" />
<style name="TextAppearance.StatusBar.Material.EventContent">
<item name="android:textColor">#90000000</item>
<item name="android:textSize">@dimen/notification_text_size</item>
<item name="textColor">#90000000</item>
<item name="textSize">@dimen/notification_text_size</item>
</style>
<style name="TextAppearance.StatusBar.Material.EventContent.Title">
<item name="android:textColor">#DD000000</item>
<item name="android:textSize">@dimen/notification_title_text_size</item>
<item name="textColor">#DD000000</item>
<item name="textSize">@dimen/notification_title_text_size</item>
</style>
<style name="TextAppearance.StatusBar.Material.EventContent.Line2">
<item name="android:textSize">@dimen/notification_subtext_size</item>
<item name="textSize">@dimen/notification_subtext_size</item>
</style>
<style name="TextAppearance.StatusBar.Material.EventContent.Info">
<item name="android:textSize">@dimen/notification_subtext_size</item>
<item name="textSize">@dimen/notification_subtext_size</item>
</style>
<style name="TextAppearance.StatusBar.Material.EventContent.Time">
<item name="android:textSize">@dimen/notification_subtext_size</item>
<item name="textSize">@dimen/notification_subtext_size</item>
</style>
<style name="TextAppearance.StatusBar.Material.EventContent.Emphasis">
<item name="android:textColor">#66000000</item>
<item name="textColor">#66000000</item>
</style>
<style name="Widget.StatusBar.Material.ProgressBar" parent="Widget.Material.Light.ProgressBar.Horizontal" />
<style name="Widget.StatusBar.Material.ProgressBar.Media">
<item name="android:progressDrawable">@drawable/notification_material_media_progress</item>
<item name="progressDrawable">@drawable/notification_material_media_progress</item>
</style>
<!-- Widget Styles -->
@@ -399,9 +399,7 @@ please see styles_device_defaults.xml.
<item name="textColor">?attr/textColorPrimary</item>
<item name="minHeight">48dip</item>
<item name="minWidth">88dip</item>
<!-- TODO: Turn this back on when we support inset drawable outlines. -->
<!-- <item name="stateListAnimator">@anim/button_state_list_anim_material</item> -->
<item name="stateListAnimator">@anim/button_state_list_anim_material</item>
</style>
<!-- Small bordered ink button -->
@@ -430,7 +428,6 @@ please see styles_device_defaults.xml.
<item name="background">@drawable/btn_toggle_material</item>
<item name="textOn">@string/capital_on</item>
<item name="textOff">@string/capital_off</item>
<item name="minHeight">48dip</item>
</style>
<style name="Widget.Material.ButtonBar">
@@ -515,7 +512,7 @@ please see styles_device_defaults.xml.
<style name="Widget.Material.GestureOverlayView" parent="Widget.GestureOverlayView"/>
<style name="Widget.Material.GridView" parent="Widget.GridView">
<item name="android:listSelector">?attr/selectableItemBackground</item>
<item name="listSelector">?attr/selectableItemBackground</item>
</style>
<style name="Widget.Material.CalendarView" parent="Widget.CalendarView">
@@ -687,11 +684,11 @@ please see styles_device_defaults.xml.
</style>
<style name="Widget.Material.Toolbar" parent="Widget.Toolbar">
<item name="android:navigationButtonStyle">@android:style/Widget.Material.Toolbar.Button.Navigation</item>
<item name="navigationButtonStyle">@android:style/Widget.Material.Toolbar.Button.Navigation</item>
</style>
<style name="Widget.Material.Toolbar.Button.Navigation" parent="Widget.Toolbar.Button.Navigation">
<item name="android:background">?attr/selectableItemBackgroundBorderless</item>
<item name="background">?attr/selectableItemBackgroundBorderless</item>
</style>
<style name="Widget.Material.WebTextView" parent="Widget.WebTextView"/>