Fix scrolling issue after MLS switches
Bug: 187546020 Test: on device Change-Id: Ie1c573396cbc8b3256db5e350c622e566a44495c
This commit is contained in:
@@ -55,11 +55,14 @@ import java.util.List;
|
|||||||
* implementation.
|
* implementation.
|
||||||
*/
|
*/
|
||||||
@SearchIndexable
|
@SearchIndexable
|
||||||
public class LocationSettings extends DashboardFragment {
|
public class LocationSettings extends DashboardFragment implements
|
||||||
|
LocationEnabler.LocationModeChangeListener {
|
||||||
|
|
||||||
private static final String TAG = "LocationSettings";
|
private static final String TAG = "LocationSettings";
|
||||||
|
private static final String RECENT_LOCATION_ACCESS_PREF_KEY = "recent_location_access";
|
||||||
|
|
||||||
private LocationSwitchBarController mSwitchBarController;
|
private LocationSwitchBarController mSwitchBarController;
|
||||||
|
private LocationEnabler mLocationEnabler;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetricsCategory() {
|
public int getMetricsCategory() {
|
||||||
@@ -75,6 +78,7 @@ public class LocationSettings extends DashboardFragment {
|
|||||||
switchBar.show();
|
switchBar.show();
|
||||||
mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
|
mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
|
||||||
getSettingsLifecycle());
|
getSettingsLifecycle());
|
||||||
|
mLocationEnabler = new LocationEnabler(getContext(), this, getSettingsLifecycle());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -98,6 +102,13 @@ public class LocationSettings extends DashboardFragment {
|
|||||||
return TAG;
|
return TAG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLocationModeChanged(int mode, boolean restricted) {
|
||||||
|
if (mLocationEnabler.isEnabled(mode)) {
|
||||||
|
scrollToPreference(RECENT_LOCATION_ACCESS_PREF_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void addPreferencesSorted(List<Preference> prefs, PreferenceGroup container) {
|
static void addPreferencesSorted(List<Preference> prefs, PreferenceGroup container) {
|
||||||
// If there's some items to display, sort the items and add them to the container.
|
// If there's some items to display, sort the items and add them to the container.
|
||||||
Collections.sort(prefs,
|
Collections.sort(prefs,
|
||||||
|
Reference in New Issue
Block a user