Directly use BaseIndexableProvider
- Add function getXmlResourceId, Fragments don't need to write xml resource id twice. - Remove getPreferenceControllers from Indexable.java. Because it will move to SettingsLib later for other apps which don't need this function Bug: 135053028 Test: robolectric Change-Id: I1e74519aecdea3dde64a5aea79f08d766dbc0003
This commit is contained in:
@@ -22,6 +22,7 @@ import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.PreferenceControllerListHelper;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.DatabaseIndexingUtils;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settingslib.core.AbstractPreferenceController;
|
||||
@@ -45,8 +46,8 @@ public class DashboardFragmentSearchIndexProviderInspector {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Indexable.SearchIndexProvider provider =
|
||||
DatabaseIndexingUtils.getSearchIndexProvider(clazz);
|
||||
final BaseSearchIndexProvider provider =
|
||||
(BaseSearchIndexProvider) DatabaseIndexingUtils.getSearchIndexProvider(clazz);
|
||||
if (provider == null) {
|
||||
return true;
|
||||
}
|
||||
|
@@ -70,7 +70,7 @@ public class FakeSettingsFragment extends DashboardFragment {
|
||||
}
|
||||
|
||||
/** Index provider used to expose this fragment in search. */
|
||||
public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableRaw> getRawDataToIndex(Context context,
|
||||
|
@@ -29,7 +29,7 @@ public class FakeIndexProvider implements Indexable {
|
||||
|
||||
public static final String KEY = "TestKey";
|
||||
|
||||
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider(R.xml.location_settings) {
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user