Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69ad52d4 authored by Amit Kumar's avatar Amit Kumar
Browse files

Style the switch

Change-Id: I21e4db5355cb3433d68f45bf553105b349b448c1
parent 33a634d5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -863,7 +863,7 @@ public class Switch extends CompoundButton {
        }

        final int switchWidth = Math.max(mSwitchMinWidth,
                2 * mThumbWidth + paddingLeft + paddingRight);
                (int) (1.8 * mThumbWidth) + paddingLeft + paddingRight);
        final int switchHeight = Math.max(trackHeight, thumbHeight);
        mSwitchWidth = switchWidth;
        mSwitchHeight = switchHeight;
+2 −2
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_enabled="false"
          android:color="?attr/colorForeground"
          android:color="#848484"
          android:alpha="?attr/disabledAlpha" />
    <item android:state_checked="true"
          android:color="?attr/colorControlActivated" />
    <item android:color="?attr/colorForeground" />
    <item android:color="#848484" />
</selector>
+25 −0
Original line number Diff line number Diff line
<?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.
-->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:top="4dp"
    android:bottom="4dp">
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
               android:shape="oval">
            <solid android:color="#ffffff"/>
            <size android:width="24dp" android:height="24dp"/>
        </shape>
    </item>
</layer-list>
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2015 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:gravity="center_vertical|fill_horizontal">
        <shape android:shape="rectangle"
               android:tint="@color/switch_track_material">
            <padding android:left="4dp"
                     android:right="4dp"/>
            <corners android:radius="16dp" />
            <solid android:color="#FFF" />
            <size android:height="32dp" />
        </shape>
    </item>
</layer-list>
+2 −2
Original line number Diff line number Diff line
@@ -627,8 +627,8 @@ please see styles_device_defaults.xml.
    </style>

    <style name="Widget.Material.CompoundButton.Switch">
        <item name="track">@drawable/switch_track_material</item>
        <item name="thumb">@drawable/switch_thumb_material_anim</item>
        <item name="track">@drawable/switch_track_eelo</item>
        <item name="thumb">@drawable/switch_thumb_eelo</item>
        <item name="switchTextAppearance">@style/TextAppearance.Material.Widget.Switch</item>
        <item name="textOn">@string/capital_on</item>
        <item name="textOff">@string/capital_off</item>