Merge "Override scrollToPosition and snoothScrollToPosition to forward events to the nested RV" into pi-car-dev
diff --git a/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiRecyclerView.java b/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiRecyclerView.java
index 0b608a2..75e8d99 100644
--- a/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiRecyclerView.java
+++ b/car-ui-lib/src/com/android/car/ui/recyclerview/CarUiRecyclerView.java
@@ -485,6 +485,24 @@
}
}
+ @Override
+ public void scrollToPosition(int position) {
+ if (mScrollBarEnabled) {
+ mNestedRecyclerView.scrollToPosition(position);
+ } else {
+ super.scrollToPosition(position);
+ }
+ }
+
+ @Override
+ public void smoothScrollToPosition(int position) {
+ if (mScrollBarEnabled) {
+ mNestedRecyclerView.smoothScrollToPosition(position);
+ } else {
+ super.smoothScrollToPosition(position);
+ }
+ }
+
@SuppressWarnings("rawtypes")
@Override
public void setAdapter(@Nullable Adapter adapter) {