Merge "Set initialExpandedChildrenCount dynamically in location settings"

This commit is contained in:
Maggie Wang
2017-12-21 04:51:04 +00:00
committed by Android (Google) Code Review
2 changed files with 25 additions and 16 deletions

View File

@@ -72,6 +72,16 @@ public class LocationSettings extends DashboardFragment {
private LocationSwitchBarController mSwitchBarController;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
final RecentLocationApps recentLocationApps = new RecentLocationApps(getActivity());
int locationRequestsApps = recentLocationApps.getAppList().size();
int locationRequestsPrefs = locationRequestsApps == 0 ? 1 : locationRequestsApps;
getPreferenceScreen().setInitialExpandedChildrenCount(locationRequestsPrefs + 2);
}
@Override
public int getMetricsCategory() {
return MetricsEvent.LOCATION;