Bring up IME and focus on input when scroll to top.

Do this behind a feature flag AND only when "Always show keyboard" is selected or in prefix state.

Bug: 218846025
Test: keyboard shown when swiping up for QSB and AA+ (both main and work). Keyboard not shown when either the feature flag or Always show keyboard is disabled.
Change-Id: I3df2e0e44a8313eaf749cd6b91b7f9d0b9b80ec3
This commit is contained in:
Holly Sun
2022-10-03 16:56:26 -07:00
parent 5db9942c61
commit a793fc6e2c
4 changed files with 48 additions and 4 deletions
@@ -107,8 +107,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
updateHeaderScroll(
((AllAppsRecyclerView) recyclerView).computeVerticalScrollOffset());
updateHeaderScroll(recyclerView.computeVerticalScrollOffset());
}
};
@@ -192,7 +191,6 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
reset(true);
}
}
}
@Override
@@ -815,6 +813,10 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
}
}
protected void onInitializeRecyclerView(RecyclerView rv) {
rv.addOnScrollListener(mScrollListener);
}
/** Holds a {@link BaseAllAppsAdapter} and related fields. */
public class AdapterHolder {
public static final int MAIN = 0;
@@ -851,7 +853,7 @@ public abstract class BaseAllAppsContainerView<T extends Context & ActivityConte
mRecyclerView.setHasFixedSize(true);
// No animations will occur when changes occur to the items in this RecyclerView.
mRecyclerView.setItemAnimator(null);
mRecyclerView.addOnScrollListener(mScrollListener);
onInitializeRecyclerView(mRecyclerView);
FocusedItemDecorator focusedItemDecorator = new FocusedItemDecorator(mRecyclerView);
mRecyclerView.addItemDecoration(focusedItemDecorator);
mAdapter.setIconFocusListener(focusedItemDecorator.getFocusListener());