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

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

Merge "[expressive desing] Update SynStateSwitchPreference" into main

parents 1f9e503a f46fa2cc
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2025 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.
-->

<!-- Layout used by SyncStateSwitchPreference. This is inflated
     inside android.R.layout.preference. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_vertical|end"
    android:gravity="center_vertical|end">

    <ImageView
        android:id="@+id/sync_failed"
        android:src="@drawable/ic_sync_problem_24dp"
        android:layout_width="wrap_content"
        android:layout_marginEnd="8dip"
        android:layout_height="wrap_content"
        android:contentDescription="@string/sync_failed" />

    <com.android.settingslib.widget.AnimatedImageView
        android:id="@+id/sync_active"
        android:src="@drawable/ic_list_sync_anim"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dip"
        android:contentDescription="@string/sync_active" />

    <include layout="@layout/settingslib_expressive_preference_switch" />
</LinearLayout>
+4 −0
Original line number Diff line number Diff line
@@ -26,4 +26,8 @@
        <item name="twoStateButtonPreferenceStyle">@style/TwoStateButtonPreference</item>
        <item name="preferenceFragmentCompatStyle">@style/SettingsPreferenceFragmentStyle</item>
    </style>

    <style name="SyncSwitchPreference.Expressive" parent="@style/SettingsLibPreference.SwitchPreferenceCompat.Expressive">
        <item name="android:widgetLayout">@layout/preference_widget_sync_toggle_expreesive</item>
    </style>
</resources>
+5 −2
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import androidx.preference.SwitchPreferenceCompat;

import com.android.settings.R;
import com.android.settingslib.widget.AnimatedImageView;
import com.android.settingslib.widget.SettingsThemeHelper;

public class SyncStateSwitchPreference extends SwitchPreferenceCompat {

@@ -48,7 +49,8 @@ public class SyncStateSwitchPreference extends SwitchPreferenceCompat {
    private boolean mOneTimeSyncMode = false;

    public SyncStateSwitchPreference(Context context, AttributeSet attrs) {
        super(context, attrs, 0, R.style.SyncSwitchPreference);
        super(context, attrs, 0, SettingsThemeHelper.isExpressiveTheme(context)
                ? R.style.SyncSwitchPreference_Expressive : R.style.SyncSwitchPreference);
        mAccount = null;
        mAuthority = null;
        mPackageName = null;
@@ -57,7 +59,8 @@ public class SyncStateSwitchPreference extends SwitchPreferenceCompat {

    public SyncStateSwitchPreference(Context context, Account account, String authority,
            String packageName, int uid) {
        super(context, null, 0, R.style.SyncSwitchPreference);
        super(context, null, 0, SettingsThemeHelper.isExpressiveTheme(context)
                ? R.style.SyncSwitchPreference_Expressive : R.style.SyncSwitchPreference);
        setup(account, authority, packageName, uid);
    }