Change updatePreferenceOrder() to onCreateView()
Root Cause: change preferences' order in onViewCreated() will see the order moving animation. Solution: * Move to onCreateView() can avoid seeing the order moving animation. * Move onProcessArguments() to onCreate() to let it be called as early as possible. Also let it align the calling getArguments() behavior in parent class PreferenceFragmentCompat. Bug: 171272809 Test: make RunSettingsRoboTests ROBOTEST_FILTLTER=ToggleFeaturePreferenceFragmentTest Change-Id: Ib9cb9b6df232ddcb681683ac2fcd2c6406c7a487
This commit is contained in:
@@ -137,6 +137,8 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
onProcessArguments(getArguments());
|
||||
// Restore the user shortcut type and tooltip.
|
||||
if (savedInstanceState != null) {
|
||||
if (savedInstanceState.containsKey(KEY_SAVED_USER_SHORTCUT_TYPE)) {
|
||||
@@ -182,9 +184,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Need to be called as early as possible. Protected variables will be assigned here.
|
||||
onProcessArguments(getArguments());
|
||||
|
||||
initTopIntroPreference();
|
||||
initAnimatedImagePreference();
|
||||
initToggleServiceSwitchPreference();
|
||||
@@ -202,6 +201,8 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
removeDialog(DialogEnums.EDIT_SHORTCUT);
|
||||
mShortcutPreference.setSummary(getShortcutTypeSummary(getPrefContext()));
|
||||
};
|
||||
|
||||
updatePreferenceOrder();
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
@@ -235,8 +236,6 @@ public abstract class ToggleFeaturePreferenceFragment extends DashboardFragment
|
||||
final SettingsMainSwitchBar switchBar = activity.getSwitchBar();
|
||||
switchBar.hide();
|
||||
|
||||
updatePreferenceOrder();
|
||||
|
||||
// Reshow tooltip when activity recreate, such as rotate device.
|
||||
if (mNeedsQSTooltipReshow) {
|
||||
getView().post(this::showQuickSettingsTooltipIfNeeded);
|
||||
|
Reference in New Issue
Block a user