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

Commit 634efd60 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add backward compatible for MainSwitchPreference" into sc-dev am: 5f331bb7

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13775019

Change-Id: I979d241e57a80d631af6b4f025133d4b6b5eefde
parents b05bc9a4 5f331bb7
Loading
Loading
Loading
Loading
+75 −0
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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:background="?android:attr/colorBackground"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/frame"
        android:minHeight="@dimen/min_switch_bar_height"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:background="?android:attr/selectableItemBackground"
        android:paddingLeft="@dimen/switchbar_margin_start"
        android:paddingRight="@dimen/switchbar_margin_end">

        <TextView
            android:id="@+id/switch_text"
            android:layout_height="wrap_content"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_marginRight="16dp"
            android:layout_gravity="center_vertical"
            android:maxLines="2"
            android:ellipsize="end"
            android:textAppearance="?android:attr/textAppearanceListItem"
            android:textAlignment="viewStart"
            style="@style/MainSwitchText" />

        <ImageView
            android:id="@+id/restricted_icon"
            android:layout_width="@dimen/restricted_icon_size"
            android:layout_height="@dimen/restricted_icon_size"
            android:tint="?android:attr/colorAccent"
            android:theme="@android:style/Theme.Material"
            android:layout_gravity="center_vertical"
            android:layout_marginEnd="@dimen/restricted_icon_margin_end"
            android:src="@*android:drawable/ic_info"
            android:visibility="gone" />

        <Switch
            android:id="@android:id/switch_widget"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:track="@drawable/track_selector"
            android:thumb="@drawable/thumb_selector"
            android:theme="@style/Settings.MainSwitch"/>
    </LinearLayout>

    <View
        android:id="@+id/below_divider"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="?android:attr/listDivider" />
</LinearLayout>

+33 −51
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2020 The Android Open Source Project
  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.
@@ -18,31 +18,21 @@
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:background="?android:attr/colorBackground"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/frame"
        android:minHeight="@dimen/min_switch_bar_height"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:background="?android:attr/selectableItemBackground"
        android:paddingLeft="@dimen/switchbar_margin_start"
        android:paddingRight="@dimen/switchbar_margin_end">
    android:layout_width="match_parent">

    <TextView
        android:id="@+id/switch_text"
        android:layout_height="wrap_content"
        android:layout_width="0dp"
        android:layout_weight="1"
            android:layout_marginRight="16dp"
        android:layout_gravity="center_vertical"
        android:maxLines="2"
        android:ellipsize="end"
            android:textAppearance="?android:attr/textAppearanceListItem"
            android:textAlignment="viewStart"
            style="@style/MainSwitchText" />
        android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Widget.ActionBar.Title"
        android:textSize="16sp"
        android:textColor="?android:attr/textColorPrimaryInverse"
        android:layout_marginStart="@dimen/switchbar_subsettings_margin_start"
        android:textAlignment="viewStart"/>

    <ImageView
        android:id="@+id/restricted_icon"
@@ -60,16 +50,8 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
            android:track="@drawable/track_selector"
            android:thumb="@drawable/thumb_selector"
            android:theme="@style/Settings.MainSwitch"/>
    </LinearLayout>

    <View
        android:id="@+id/below_divider"
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="?android:attr/listDivider" />
        android:layout_marginEnd="@dimen/switchbar_subsettings_margin_end"
        android:theme="@style/Widget.SwitchBar.Switch"/>
</LinearLayout>

+2 −0
Original line number Diff line number Diff line
@@ -20,4 +20,6 @@
    <color name="thumb_off">#BFFFFFFF</color>
    <color name="track_off">@*android:color/material_grey_600</color>

    <color name="switchbar_switch_track_tint">#82000000</color>
    <color name="switchbar_switch_thumb_tint">@android:color/black</color>
</resources>
+22 −0
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.
  -->

<resources>

    <!-- SwitchBar sub settings margin start / end -->
    <dimen name="switchbar_subsettings_margin_start">80dp</dimen>
</resources>
+23 −0
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.
  -->

<resources>

    <!-- SwitchBar sub settings margin start / end -->
    <dimen name="switchbar_subsettings_margin_start">128dp</dimen>
    <dimen name="switchbar_subsettings_margin_end">128dp</dimen>
</resources>
Loading