summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
diff options
context:
space:
mode:
authorRaff Tsai <rafftsai@google.com>2019-11-22 11:35:40 +0800
committerRaff Tsai <rafftsai@google.com>2019-11-25 13:11:12 +0800
commit2229585e889bd90d23576bf357786d538ec9f209 (patch)
tree868eda309f06ddc0cb4bcf1a402f266d87ff9ab4 /src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
parenta6198c25be73ea7870e024123fd29d2c8bc2623a (diff)
downloadpackages_apps_Settings-2229585e889bd90d23576bf357786d538ec9f209.tar.gz
packages_apps_Settings-2229585e889bd90d23576bf357786d538ec9f209.tar.bz2
packages_apps_Settings-2229585e889bd90d23576bf357786d538ec9f209.zip
Refactor LocationSettings
- Extends BasePreferenceController in LocationBasePreferenceController which binds preference key based on xml file instead of writing the key in java code. Then the controller can be used in many xmls. - Modify LocationServicePreferenceController to support only personal or profile user. Bug: 141601408 Test: manual, robolectric Change-Id: I51ee950dfb87474df84a8dc3db55fb911edcf599
Diffstat (limited to 'src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java')
-rw-r--r--src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java33
1 files changed, 6 insertions, 27 deletions
diff --git a/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java b/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
index 3abccf7d23..012cb8bbe7 100644
--- a/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
+++ b/src/com/android/settings/location/RecentLocationRequestSeeAllPreferenceController.java
@@ -22,44 +22,24 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceScreen;
-import com.android.settingslib.core.lifecycle.Lifecycle;
+import com.android.settings.R;
import com.android.settingslib.location.RecentLocationApps;
import com.android.settingslib.widget.apppreference.AppPreference;
import java.util.List;
-import com.android.settings.R;
-
/** Preference controller for preference category displaying all recent location requests. */
public class RecentLocationRequestSeeAllPreferenceController
extends LocationBasePreferenceController {
- /** Key for preference category "All recent location requests" */
- private static final String KEY_ALL_RECENT_LOCATION_REQUESTS = "all_recent_location_requests";
- private final RecentLocationRequestSeeAllFragment mFragment;
+
private PreferenceCategory mCategoryAllRecentLocationRequests;
private RecentLocationApps mRecentLocationApps;
private boolean mShowSystem = false;
private Preference mPreference;
- public RecentLocationRequestSeeAllPreferenceController(
- Context context, Lifecycle lifecycle, RecentLocationRequestSeeAllFragment fragment) {
- this(context, lifecycle, fragment, new RecentLocationApps(context));
- }
-
- @VisibleForTesting
- RecentLocationRequestSeeAllPreferenceController(
- Context context,
- Lifecycle lifecycle,
- RecentLocationRequestSeeAllFragment fragment,
- RecentLocationApps recentLocationApps) {
- super(context, lifecycle);
- mFragment = fragment;
- mRecentLocationApps = recentLocationApps;
- }
-
- @Override
- public String getPreferenceKey() {
- return KEY_ALL_RECENT_LOCATION_REQUESTS;
+ public RecentLocationRequestSeeAllPreferenceController(Context context, String key) {
+ super(context, key);
+ mRecentLocationApps = new RecentLocationApps(context);
}
@Override
@@ -70,8 +50,7 @@ public class RecentLocationRequestSeeAllPreferenceController
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
- mCategoryAllRecentLocationRequests =
- (PreferenceCategory) screen.findPreference(KEY_ALL_RECENT_LOCATION_REQUESTS);
+ mCategoryAllRecentLocationRequests = screen.findPreference(getPreferenceKey());
}
@Override