Optimize categories loading and refresh
See bug: #15091992 Opening sub activities in settings is very slow Change-Id: I6e2e7a07fed72f35850da0614adaafde94618a4e
This commit is contained in:
@@ -477,9 +477,6 @@ public class SettingsActivity extends Activity
|
|||||||
|
|
||||||
mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
|
mDisplayHomeAsUpEnabled = savedState.getBoolean(SAVE_KEY_SHOW_HOME_AS_UP);
|
||||||
} else {
|
} else {
|
||||||
// We need to build the Categories in all cases
|
|
||||||
buildDashboardCategories(mCategories);
|
|
||||||
|
|
||||||
if (!mIsShowingDashboard) {
|
if (!mIsShowingDashboard) {
|
||||||
final ComponentName cn = getIntent().getComponent();
|
final ComponentName cn = getIntent().getComponent();
|
||||||
// No UP is we are launched thru a Settings shortcut
|
// No UP is we are launched thru a Settings shortcut
|
||||||
@@ -494,6 +491,9 @@ public class SettingsActivity extends Activity
|
|||||||
switchToFragment( initialFragmentName, initialArguments, true, false,
|
switchToFragment( initialFragmentName, initialArguments, true, false,
|
||||||
mInitialTitle, false);
|
mInitialTitle, false);
|
||||||
} else {
|
} else {
|
||||||
|
// We need to build the Categories in all cases
|
||||||
|
buildDashboardCategories(mCategories);
|
||||||
|
|
||||||
// No UP if we are displaying the main Dashboard
|
// No UP if we are displaying the main Dashboard
|
||||||
mDisplayHomeAsUpEnabled = false;
|
mDisplayHomeAsUpEnabled = false;
|
||||||
if (mCategories.size() > 0) {
|
if (mCategories.size() > 0) {
|
||||||
@@ -634,8 +634,6 @@ public class SettingsActivity extends Activity
|
|||||||
mDevelopmentPreferences.registerOnSharedPreferenceChangeListener(
|
mDevelopmentPreferences.registerOnSharedPreferenceChangeListener(
|
||||||
mDevelopmentPreferencesListener);
|
mDevelopmentPreferencesListener);
|
||||||
|
|
||||||
invalidateCategories();
|
|
||||||
|
|
||||||
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
registerReceiver(mBatteryInfoReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
|
||||||
|
|
||||||
mDynamicIndexableContentMonitor.register(this);
|
mDynamicIndexableContentMonitor.register(this);
|
||||||
@@ -651,17 +649,17 @@ public class SettingsActivity extends Activity
|
|||||||
|
|
||||||
unregisterReceiver(mBatteryInfoReceiver);
|
unregisterReceiver(mBatteryInfoReceiver);
|
||||||
|
|
||||||
mDevelopmentPreferences.unregisterOnSharedPreferenceChangeListener(
|
|
||||||
mDevelopmentPreferencesListener);
|
|
||||||
|
|
||||||
mDevelopmentPreferencesListener = null;
|
|
||||||
|
|
||||||
mDynamicIndexableContentMonitor.unregister();
|
mDynamicIndexableContentMonitor.unregister();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
|
|
||||||
|
mDevelopmentPreferences.unregisterOnSharedPreferenceChangeListener(
|
||||||
|
mDevelopmentPreferencesListener);
|
||||||
|
mDevelopmentPreferencesListener = null;
|
||||||
|
|
||||||
if (mListeningToAccountUpdates) {
|
if (mListeningToAccountUpdates) {
|
||||||
AccountManager.get(this).removeOnAccountsUpdatedListener(this);
|
AccountManager.get(this).removeOnAccountsUpdatedListener(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user