Workaround to get smooth scroll on group expand
Get smooth scrolling on group expand in bookmark grid
working.
Change-Id: I5ce9dd7a2c9b16725df8fd723b0fa39408ebec61
diff --git a/src/com/android/browser/view/BookmarkExpandableGridView.java b/src/com/android/browser/view/BookmarkExpandableGridView.java
index 0c8f669..800f6d9 100644
--- a/src/com/android/browser/view/BookmarkExpandableGridView.java
+++ b/src/com/android/browser/view/BookmarkExpandableGridView.java
@@ -240,11 +240,16 @@
@Override
public void onClick(View v) {
int groupPosition = (Integer) v.getTag(R.id.group_position);
- if (isGroupExpanded(groupPosition)) {
- collapseGroup(groupPosition);
- } else {
- expandGroup(groupPosition);
+ // This little trick gets the built in smooth scroll when
+ // expanding a group that a call to expandGroup will not
+ int flatPos = 0;
+ for (int i = 0; i < groupPosition; i++) {
+ if (isGroupExpanded(i)) {
+ flatPos += mAdapter.getChildrenCount(i);
+ }
+ flatPos++;
}
+ performItemClick(v, flatPos, 0);
}
};