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

Commit 99b691f5 authored by Stanley Wang's avatar Stanley Wang
Browse files

Fix the problem that the switch should gray out when preference

disabled.

- Use the switch style of SettingsTheme to make the switch UI
  consistent.

Fix: 189062669
Test: robotest and operate the switch preference manually
Change-Id: Ic0280fd3986726008225530fd1705ad7df0b17a6
parent 7461a557
Loading
Loading
Loading
Loading
+0 −33
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2021 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="@dimen/settingslib_switch_thumb_margin"
        android:left="@dimen/settingslib_switch_thumb_margin"
        android:right="@dimen/settingslib_switch_thumb_margin"
        android:bottom="@dimen/settingslib_switch_thumb_margin">
        <shape android:shape="oval">
            <size
                android:height="@dimen/settingslib_switch_thumb_size"
                android:width="@dimen/settingslib_switch_thumb_size"/>
            <solid
                android:color="@color/settingslib_thumb_off_color"
                android:alpha="?android:attr/disabledAlpha"/>
        </shape>
    </item>
</layer-list>
+0 −31
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2020 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="@dimen/settingslib_switch_thumb_margin"
        android:left="@dimen/settingslib_switch_thumb_margin"
        android:right="@dimen/settingslib_switch_thumb_margin"
        android:bottom="@dimen/settingslib_switch_thumb_margin">
        <shape android:shape="oval">
            <size
                android:height="@dimen/settingslib_switch_thumb_size"
                android:width="@dimen/settingslib_switch_thumb_size"/>
            <solid android:color="@color/settingslib_thumb_off_color"/>
        </shape>
    </item>
</layer-list>
+0 −31
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2020 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="@dimen/settingslib_switch_thumb_margin"
        android:left="@dimen/settingslib_switch_thumb_margin"
        android:right="@dimen/settingslib_switch_thumb_margin"
        android:bottom="@dimen/settingslib_switch_thumb_margin">
        <shape android:shape="oval">
            <size
                android:height="@dimen/settingslib_switch_thumb_size"
                android:width="@dimen/settingslib_switch_thumb_size"/>
            <solid android:color="@color/settingslib_state_on_color"/>
        </shape>
    </item>
</layer-list>
+0 −22
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2020 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:drawable="@drawable/settingslib_thumb_on" android:state_checked="true"/>
    <item android:drawable="@drawable/settingslib_thumb_off" android:state_checked="false"/>
    <item android:drawable="@drawable/settingslib_thumb_disabled" android:state_enabled="false"/>
</selector>
+0 −26
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2021 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.
  -->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:width="@dimen/settingslib_switch_track_width"
    android:height="@dimen/settingslib_switch_track_height">
    <solid
        android:color="@color/settingslib_track_off_color"
        android:alpha="?android:attr/disabledAlpha"/>
    <corners android:radius="@dimen/settingslib_switch_track_radius"/>
</shape>
Loading