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

Commit fca5e3a1 authored by Edgar Wang's avatar Edgar Wang Committed by Android (Google) Code Review
Browse files

Merge "MainSwitchPreference minor fix"

parents 1243fde2 caad2bc4
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
<!--
    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.
-->
<!-- copy from frameworks/base/core/res/res/drawable/ic_info.xml-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24"
        android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
</vector>
 No newline at end of file
+3 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@
        android:theme="@android:style/Theme.Material"
        android:layout_gravity="center_vertical"
        android:layout_marginEnd="@dimen/settingslib_restricted_icon_margin_end"
        android:src="@android:drawable/ic_info"
        android:src="@drawable/settingslib_ic_info"
        android:visibility="gone"/>

    <Switch
@@ -51,6 +51,8 @@
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginEnd="@dimen/settingslib_switchbar_subsettings_margin_end"
        android:focusable="false"
        android:clickable="false"
        android:theme="@style/SwitchBar.Switch.Settingslib"/>
</LinearLayout>
+11 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.widget.Switch;
import android.widget.TextView;

import androidx.annotation.ColorInt;
import androidx.annotation.Nullable;

import com.android.settingslib.utils.BuildCompatUtils;

@@ -97,6 +98,10 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
        }
        addOnSwitchChangeListener((switchView, isChecked) -> setChecked(isChecked));

        if (mSwitch.getVisibility() == VISIBLE) {
            mSwitch.setOnCheckedChangeListener(this);
        }

        setChecked(mSwitch.isChecked());

        if (attrs != null) {
@@ -117,6 +122,12 @@ public class MainSwitchBar extends LinearLayout implements CompoundButton.OnChec
        propagateChecked(isChecked);
    }

    @Override
    public void setOnClickListener(@Nullable OnClickListener l) {
        super.setOnClickListener(l);
        mSwitch.setOnClickListener(l);
    }

    @Override
    public boolean performClick() {
        return mSwitch.performClick();