Stop using framework-private switch asset

BUG: 16467249
Change-Id: I0829c3dea522cf59e0f92046ea7c6092d416ad4c
This commit is contained in:
Alan Viverette
2014-07-22 16:11:01 -07:00
parent 6d839875b7
commit 09be4b3c87
5 changed files with 8 additions and 67 deletions

View File

@@ -1,37 +0,0 @@
<?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:state_checked="true">
<bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
android:tint="?android:attr/colorControlNormal"
android:alpha="?android:attr/disabledAlpha" />
</item>
<item android:state_enabled="false">
<bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
android:tint="?android:attr/colorControlNormal"
android:alpha="?android:attr/disabledAlpha" />
</item>
<item android:state_checked="true">
<bitmap android:src="@*android:drawable/btn_switch_to_off_mtrl_000"
android:tint="@color/switch_accent_color" />
</item>
<item>
<bitmap android:src="@*android:drawable/btn_switch_to_on_mtrl_000"
android:tint="?android:attr/colorControlNormal" />
</item>
</selector>

View File

@@ -1,26 +0,0 @@
<?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_checked="true">
<nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
android:tint="@color/switch_accent_color" />
</item>
<item>
<nine-patch android:src="@*android:drawable/switch_track_mtrl_alpha"
android:tint="?android:attr/colorControlNormal" />
</item>
</selector>

View File

@@ -31,7 +31,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@null" />
android:background="@null"
android:theme="@style/ThemeOverlay.SwitchBar" />
</merge>

View File

@@ -204,4 +204,10 @@
<item name="@android:numbersBackgroundColor">@android:color/white</item>
</style>
<!-- Used to color the switch bar controls -->
<style name="ThemeOverlay.SwitchBar" parent="@android:style/ThemeOverlay">
<!-- Used by controls, e.g. CheckBox, ProgressBar, etc. -->
<item name="android:colorAccent">@color/switch_accent_color</item>
</style>
</resources>

View File

@@ -97,9 +97,6 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
}
});
mSwitch.setTrackResource(R.drawable.switch_track);
mSwitch.setThumbResource(R.drawable.switch_inner);
setOnClickListener(this);
// Default is hide