Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2718cea0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix scrolling issue after MLS switches" into sc-dev

parents 07b7a97c fdff6af0
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -55,11 +55,14 @@ import java.util.List;
 * implementation.
 */
@SearchIndexable
public class LocationSettings extends DashboardFragment {
public class LocationSettings extends DashboardFragment implements
        LocationEnabler.LocationModeChangeListener {

    private static final String TAG = "LocationSettings";
    private static final String RECENT_LOCATION_ACCESS_PREF_KEY = "recent_location_access";

    private LocationSwitchBarController mSwitchBarController;
    private LocationEnabler mLocationEnabler;

    @Override
    public int getMetricsCategory() {
@@ -75,6 +78,7 @@ public class LocationSettings extends DashboardFragment {
        switchBar.show();
        mSwitchBarController = new LocationSwitchBarController(activity, switchBar,
                getSettingsLifecycle());
        mLocationEnabler = new LocationEnabler(getContext(), this, getSettingsLifecycle());
    }

    @Override
@@ -98,6 +102,13 @@ public class LocationSettings extends DashboardFragment {
        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) {
        // If there's some items to display, sort the items and add them to the container.
        Collections.sort(prefs,