Use FooterPreference in AccountSyncSettings page

.Use the new FooterPreference and removed the old FooterPreferenceMixin
 from the AccountSyncSettings page.
.Add the ShadowAuthenticationHelper for commnon shadow util.

Fixes: 138978130
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.accounts
Change-Id: I93ae46b3b66e7e504320a9ed120ab7948dd06423
This commit is contained in:
Sunny Shao
2019-08-06 16:48:55 +08:00
parent b843707ef5
commit 1908cb6bd2
5 changed files with 117 additions and 67 deletions

View File

@@ -42,12 +42,14 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.widget.FooterPreference;
import com.google.android.collect.Lists;
@@ -458,8 +460,7 @@ public class AccountSyncSettings extends AccountPreferenceBase {
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
}
if (syncIsFailing) {
mFooterPreferenceMixin.createFooterPreference()
.setTitle(R.string.sync_is_failing);
createFooterPreference();
}
}
@@ -552,4 +553,11 @@ public class AccountSyncSettings extends AccountPreferenceBase {
| DateUtils.FORMAT_SHOW_YEAR
| DateUtils.FORMAT_SHOW_TIME);
}
@VisibleForTesting
void createFooterPreference() {
final FooterPreference footerPreference = new FooterPreference(getActivity());
footerPreference.setTitle(R.string.sync_is_failing);
getPreferenceScreen().addPreference(footerPreference);
}
}