Use Builder to replace the Uitls.addFooterPreference

Fixes: 139163212
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.bluetooth
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.accounts
Change-Id: I861434b81c07db785e6f1cfb3e34871ffba41e5f
This commit is contained in:
Sunny Shao
2019-08-09 11:42:04 +08:00
parent 7be752269b
commit 7e866b670e
5 changed files with 113 additions and 169 deletions

View File

@@ -42,7 +42,6 @@ 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;
@@ -460,7 +459,8 @@ public class AccountSyncSettings extends AccountPreferenceBase {
syncPref.setChecked(oneTimeSyncMode || syncEnabled);
}
if (syncIsFailing) {
createFooterPreference();
getPreferenceScreen().addPreference(new FooterPreference.Builder(
getActivity()).setTitle(R.string.sync_is_failing).build());
}
}
@@ -553,11 +553,4 @@ 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);
}
}