Handle IME selection focus for ENABLE_DEVICE_SEARCH

Bug: 162861289
Change-Id: I15e4eae09be2aa9f89a5157fd74c95e91e64bc53
This commit is contained in:
Hyunyoung Song
2020-08-04 22:22:49 -07:00
parent 70a556da1d
commit 5dd045bec6
11 changed files with 138 additions and 21 deletions

View File

@@ -527,6 +527,22 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
return mViewPager == null ? getActiveRecyclerView() : mViewPager;
}
/**
* Returns the ItemInfo of a view that is in focus, ready to be launched by an IME.
*/
public ItemInfo getHighlightedItemInfo() {
View view = getFloatingHeaderView().getFocusedChild();
if (view != null && view.getTag() instanceof ItemInfo) {
return ((ItemInfo) view.getTag());
}
if (getActiveRecyclerView().getApps().getFocusedChild() != null) {
// TODO: when new pipelines are included, getSearchResults
// should be supported at recycler view level and not apps list level.
return getActiveRecyclerView().getApps().getFocusedChild().appInfo;
}
return null;
}
public RecyclerViewFastScroller getScrollBar() {
AllAppsRecyclerView rv = getActiveRecyclerView();
return rv == null ? null : rv.getScrollbar();
@@ -658,7 +674,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
applyPadding();
setupOverlay();
if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
recyclerView.addItemDecoration(new AllAppsSectionDecorator(getApps()));
recyclerView.addItemDecoration(new AllAppsSectionDecorator(
AllAppsContainerView.this));
}
}