Merge "Update material switch styling" into lmp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
edf82bd269
20
core/res/res/color/switch_thumb_material_dark.xml
Normal file
20
core/res/res/color/switch_thumb_material_dark.xml
Normal 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:color="@color/switch_thumb_disabled_material_dark"/>
|
||||
<item android:color="@color/switch_thumb_normal_material_dark"/>
|
||||
</selector>
|
||||
20
core/res/res/color/switch_thumb_material_light.xml
Normal file
20
core/res/res/color/switch_thumb_material_light.xml
Normal 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:color="@color/switch_thumb_disabled_material_light"/>
|
||||
<item android:color="@color/switch_thumb_normal_material_light"/>
|
||||
</selector>
|
||||
@@ -16,22 +16,12 @@
|
||||
|
||||
<animated-selector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:constantSize="true">
|
||||
<item
|
||||
android:state_enabled="false"
|
||||
android:state_checked="true">
|
||||
<nine-patch
|
||||
android:src="@drawable/btn_switch_to_on_mtrl_00012"
|
||||
android:gravity="center"
|
||||
android:tintMode="multiply"
|
||||
android:tint="?attr/colorControlActivated"
|
||||
android:alpha="?attr/disabledAlpha" />
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<item android:state_enabled="false" android:id="@+id/off">
|
||||
<nine-patch
|
||||
android:src="@drawable/btn_switch_to_on_mtrl_00001"
|
||||
android:gravity="center"
|
||||
android:tintMode="multiply"
|
||||
android:tint="?attr/colorButtonNormal" />
|
||||
android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item
|
||||
android:state_checked="true"
|
||||
@@ -47,29 +37,29 @@
|
||||
android:src="@drawable/btn_switch_to_on_mtrl_00001"
|
||||
android:gravity="center"
|
||||
android:tintMode="multiply"
|
||||
android:tint="?attr/colorButtonNormal" />
|
||||
android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<transition
|
||||
android:fromId="@+id/off"
|
||||
android:toId="@+id/on">
|
||||
<animation-list>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00001" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00001" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00002" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00002" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00003" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00003" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00004" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00004" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00005" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00005" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00006" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00006" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_on_mtrl_00007" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorControlActivated" />
|
||||
@@ -112,22 +102,22 @@
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00006" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorControlActivated" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00007" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00007" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00008" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00008" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00009" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00009" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00010" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00010" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00011" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00011" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
<item android:duration="15">
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00012" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorButtonNormal" />
|
||||
<nine-patch android:src="@drawable/btn_switch_to_off_mtrl_00012" android:gravity="center" android:tintMode="multiply" android:tint="?attr/colorSwitchThumbNormal" />
|
||||
</item>
|
||||
</animation-list>
|
||||
</transition>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
-->
|
||||
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="false" android:state_checked="true">
|
||||
<item android:state_enabled="false">
|
||||
<nine-patch android:src="@drawable/switch_track_mtrl_alpha"
|
||||
android:tint="?attr/colorControlActivated"
|
||||
android:alpha="0.2" />
|
||||
android:tint="?attr/colorForeground"
|
||||
android:alpha="0.1" />
|
||||
</item>
|
||||
<item android:state_checked="true">
|
||||
<nine-patch android:src="@drawable/switch_track_mtrl_alpha"
|
||||
@@ -27,7 +27,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/switch_track_mtrl_alpha"
|
||||
android:tint="?attr/colorButtonNormal"
|
||||
android:tint="?attr/colorForeground"
|
||||
android:alpha="0.3" />
|
||||
</item>
|
||||
</selector>
|
||||
|
||||
@@ -1005,6 +1005,9 @@
|
||||
<!-- The color applied to framework buttons in their normal state. -->
|
||||
<attr name="colorButtonNormal" format="color" />
|
||||
|
||||
<!-- The color applied to framework switch thumbs in their normal state. -->
|
||||
<attr name="colorSwitchThumbNormal" format="color" />
|
||||
|
||||
<!-- ================== -->
|
||||
<!-- Hardware rendering -->
|
||||
<!-- ================== -->
|
||||
|
||||
@@ -25,6 +25,11 @@
|
||||
<color name="button_material_dark">#ff5a595b</color>
|
||||
<color name="button_material_light">#ffd6d7d7</color>
|
||||
|
||||
<color name="switch_thumb_normal_material_dark">#ffbdbdbd</color>
|
||||
<color name="switch_thumb_normal_material_light">#fff1f1f1</color>
|
||||
<color name="switch_thumb_disabled_material_dark">#ff616161</color>
|
||||
<color name="switch_thumb_disabled_material_light">#ffbdbdbd</color>
|
||||
|
||||
<color name="bright_foreground_material_dark">@color/white</color>
|
||||
<color name="bright_foreground_material_light">@color/black</color>
|
||||
<!-- White 50% -->
|
||||
|
||||
@@ -116,12 +116,12 @@ please see themes_device_defaults.xml.
|
||||
|
||||
<!-- Button styles -->
|
||||
<item name="buttonStyle">@style/Widget.Button</item>
|
||||
|
||||
<item name="buttonStyleSmall">@style/Widget.Button.Small</item>
|
||||
<item name="buttonStyleInset">@style/Widget.Button.Inset</item>
|
||||
|
||||
<item name="buttonStyleToggle">@style/Widget.Button.Toggle</item>
|
||||
|
||||
<item name="switchStyle">@style/Widget.CompoundButton.Switch</item>
|
||||
|
||||
<item name="selectableItemBackground">@drawable/item_background</item>
|
||||
<item name="selectableItemBackgroundBorderless">?attr/selectableItemBackground</item>
|
||||
<item name="borderlessButtonStyle">?attr/buttonStyle</item>
|
||||
|
||||
@@ -379,6 +379,7 @@ please see themes_device_defaults.xml.
|
||||
|
||||
<item name="colorControlHighlight">@color/ripple_material_dark</item>
|
||||
<item name="colorButtonNormal">@color/btn_default_material_dark</item>
|
||||
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- Material theme (light version). -->
|
||||
@@ -721,6 +722,7 @@ please see themes_device_defaults.xml.
|
||||
|
||||
<item name="colorControlHighlight">@color/ripple_material_light</item>
|
||||
<item name="colorButtonNormal">@color/btn_default_material_light</item>
|
||||
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item>
|
||||
</style>
|
||||
|
||||
<!-- Variant of the material (light) theme that has a solid (opaque) action bar
|
||||
@@ -774,6 +776,7 @@ please see themes_device_defaults.xml.
|
||||
<item name="colorControlNormal">?attr/textColorSecondary</item>
|
||||
<item name="colorControlHighlight">@color/ripple_material_light</item>
|
||||
<item name="colorButtonNormal">@color/btn_default_material_light</item>
|
||||
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_light</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme overlay that replaces colors with their dark versions but preserves
|
||||
@@ -811,6 +814,7 @@ please see themes_device_defaults.xml.
|
||||
<item name="colorControlNormal">?attr/textColorSecondary</item>
|
||||
<item name="colorControlHighlight">@color/ripple_material_dark</item>
|
||||
<item name="colorButtonNormal">@color/btn_default_material_dark</item>
|
||||
<item name="colorSwitchThumbNormal">@color/switch_thumb_material_dark</item>
|
||||
</style>
|
||||
|
||||
<!-- Theme overlay that replaces the normal control color, which by default is the same as the
|
||||
|
||||
Reference in New Issue
Block a user