Add dynamic injection item to site map

- That will make injection able to build site map

Bug: 143116297
Test: manual
Change-Id: Ic07280519bb7f904a3e80e172b6cb8785b94616f
This commit is contained in:
Raff Tsai
2019-11-12 17:06:36 +08:00
parent cd216b1de3
commit a1678dade1

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];