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

Commit c2ea62d1 authored by Yu-Han Yang's avatar Yu-Han Yang
Browse files

Retain and restore showSystem state when rotated

Bug: 182275573
Test: on device
Change-Id: I8a7e2d1ceb715cb6df470d7e3131b82d12ba6fa1
parent 54e74cae
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.settings.location;

import android.content.Context;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@@ -36,6 +37,7 @@ public class RecentLocationAccessSeeAllFragment extends DashboardFragment {

    private static final int MENU_SHOW_SYSTEM = Menu.FIRST + 1;
    private static final int MENU_HIDE_SYSTEM = Menu.FIRST + 2;
    private static final String EXTRA_SHOW_SYSTEM = "show_system";

    private boolean mShowSystem = false;
    private MenuItem mShowSystemMenu;
@@ -59,6 +61,23 @@ public class RecentLocationAccessSeeAllFragment extends DashboardFragment {
        }
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (savedInstanceState != null) {
            mShowSystem = savedInstanceState.getBoolean(EXTRA_SHOW_SYSTEM, mShowSystem);
        }
        if (mController != null) {
            mController.setShowSystem(mShowSystem);
        }
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putBoolean(EXTRA_SHOW_SYSTEM, mShowSystem);
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.location_recent_access_see_all;