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

Commit fb6e1186 authored by Jason Monk's avatar Jason Monk
Browse files

Fix accessibility for account sync

Needed to get views recycling so that feedback could occur during
switch turning off.

Bug: 20020216
Change-Id: Ib7b1cdca78f5ac5064cdf521122ff7a5ee49f572
parent 91ba69df
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -97,6 +97,10 @@
        <item name="android:layout">@layout/preference_material_settings</item>
    </style>

    <style name="SyncSwitchPreference" parent="Preference">
        <item name="android:widgetLayout">@layout/preference_widget_sync_toggle</item>
    </style>

    <style name="PreferenceHeaderPanelSinglePane">
        <item name="android:layout_marginStart">0dp</item>
        <item name="android:layout_marginEnd">0dp</item>
+5 −0
Original line number Diff line number Diff line
@@ -16,4 +16,9 @@

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">

    <!-- Needed so PreferenceGroupAdapter allows SyncStateSwitchPreference to be
         recycled. Removed in onResume -->
    <com.android.settings.accounts.SyncStateSwitchPreference
        android:key="dummy" />

</PreferenceScreen>
+3 −3
Original line number Diff line number Diff line
@@ -149,6 +149,8 @@ public class AccountSyncSettings extends AccountPreferenceBase {
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setPreferenceScreen(null);
        addPreferencesFromResource(R.xml.account_sync_settings);

        setHasOptionsMenu(true);
    }
@@ -167,8 +169,6 @@ public class AccountSyncSettings extends AccountPreferenceBase {
    }

    protected void initializeUi(final View rootView) {
        addPreferencesFromResource(R.xml.account_sync_settings);

        mErrorInfoView = (TextView) rootView.findViewById(R.id.sync_settings_error_info);
        mErrorInfoView.setVisibility(View.GONE);

@@ -202,6 +202,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {

    @Override
    public void onResume() {
        removePreference("dummy");
        mAuthenticatorHelper.listenToAccountUpdates();
        updateAuthDescriptions();
        onAccountsUpdate(UserHandle.getCallingUserHandle());
@@ -540,7 +541,6 @@ public class AccountSyncSettings extends AccountPreferenceBase {
            mProviderIcon.setImageDrawable(getDrawableForType(mAccount.type));
            mProviderId.setText(getLabelForType(mAccount.type));
        }
        addPreferencesFromResource(R.xml.account_sync_settings);
    }

    @Override
+3 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.preference.SwitchPreference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.android.settings.R;
@@ -43,17 +44,15 @@ public class SyncStateSwitchPreference extends SwitchPreference {
    private boolean mOneTimeSyncMode = false;

    public SyncStateSwitchPreference(Context context, AttributeSet attrs) {
        super(context, attrs);
        setWidgetLayoutResource(R.layout.preference_widget_sync_toggle);
        super(context, attrs, 0, R.style.SyncSwitchPreference);
        mAccount = null;
        mAuthority = null;
    }

    public SyncStateSwitchPreference(Context context, Account account, String authority) {
        super(context, null);
        super(context, null, 0, R.style.SyncSwitchPreference);
        mAccount = account;
        mAuthority = authority;
        setWidgetLayoutResource(R.layout.preference_widget_sync_toggle);
    }

    @Override