Merge "Fix non-unique keys for location settings"

This commit is contained in:
TreeHugger Robot
2018-03-02 20:19:36 +00:00
committed by Android (Google) Code Review
3 changed files with 4 additions and 4 deletions

View File

@@ -25,7 +25,7 @@
android:title="@string/location_category_recent_location_requests"/>
<Preference
android:key="recent_location_requests_see_all"
android:key="recent_location_requests_see_all_button"
android:title="@string/location_recent_location_requests_see_all"
android:icon="@drawable/ic_chevron_right_24dp"
android:selectable="true"

View File

@@ -34,7 +34,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
/** Key for preference category "Recent location requests" */
private static final String KEY_RECENT_LOCATION_REQUESTS = "recent_location_requests";
@VisibleForTesting
static final String KEY_SEE_ALL = "recent_location_requests_see_all";
static final String KEY_SEE_ALL_BUTTON = "recent_location_requests_see_all_button";
private final LocationSettings mFragment;
private final RecentLocationApps mRecentLocationApps;
private PreferenceCategory mCategoryRecentLocationRequests;
@@ -93,7 +93,7 @@ public class RecentLocationRequestPreferenceController extends LocationBasePrefe
super.displayPreference(screen);
mCategoryRecentLocationRequests =
(PreferenceCategory) screen.findPreference(KEY_RECENT_LOCATION_REQUESTS);
mSeeAllButton = screen.findPreference(KEY_SEE_ALL);
mSeeAllButton = screen.findPreference(KEY_SEE_ALL_BUTTON);
}

View File

@@ -86,7 +86,7 @@ public class RecentLocationRequestPreferenceControllerTest {
mController = spy(new RecentLocationRequestPreferenceController(
mContext, mFragment, mLifecycle, mRecentLocationApps));
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mCategory);
when(mScreen.findPreference(mController.KEY_SEE_ALL)).thenReturn(mSeeAllButton);
when(mScreen.findPreference(mController.KEY_SEE_ALL_BUTTON)).thenReturn(mSeeAllButton);
final String key = mController.getPreferenceKey();
when(mCategory.getKey()).thenReturn(key);
when(mCategory.getContext()).thenReturn(mContext);