Merge "Add dynamic injection item to site map"

This commit is contained in:
Raff Tsai
2019-11-15 03:24:31 +00:00
committed by Android (Google) Code Review

View File

@@ -189,16 +189,22 @@ public class SettingsSearchIndexablesProvider extends SearchIndexablesProvider {
// Build parent-child class pairs for all children listed under this key. // Build parent-child class pairs for all children listed under this key.
for (Tile tile : category.getTiles()) { for (Tile tile : category.getTiles()) {
String childClass = null; String childClass = null;
CharSequence childTitle = "";
if (tile.getMetaData() != null) { if (tile.getMetaData() != null) {
childClass = tile.getMetaData().getString( childClass = tile.getMetaData().getString(
SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS); SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
} }
if (childClass == null) {
childClass = tile.getComponentName();
childTitle = tile.getTitle(getContext());
}
if (childClass == null) { if (childClass == null) {
continue; continue;
} }
cursor.newRow() cursor.newRow()
.add(SearchIndexablesContract.SiteMapColumns.PARENT_CLASS, parentClass) .add(SearchIndexablesContract.SiteMapColumns.PARENT_CLASS, parentClass)
.add(SearchIndexablesContract.SiteMapColumns.CHILD_CLASS, childClass); .add(SearchIndexablesContract.SiteMapColumns.CHILD_CLASS, childClass)
.add(SearchIndexablesContract.SiteMapColumns.CHILD_TITLE, childTitle);
} }
} }
// Done. // Done.
@@ -383,7 +389,8 @@ public class SettingsSearchIndexablesProvider extends SearchIndexablesProvider {
} }
} }
return rawList; } return rawList;
}
private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) { private static Object[] createIndexableRawColumnObjects(SearchIndexableRaw raw) {
final Object[] ref = new Object[INDEXABLES_RAW_COLUMNS.length]; final Object[] ref = new Object[INDEXABLES_RAW_COLUMNS.length];