Merge "Fix full widgets picker fast scroller height." into sc-dev

This commit is contained in:
TreeHugger Robot 2021-05-25 21:43:40 +00:00 committed by Android (Google) Code Review
commit 17385ce33e
2 changed files with 12 additions and 5 deletions

View File

@ -49,6 +49,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
tools:text="App name" />

View File

@ -49,10 +49,10 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
private final int mScrollbarTop;
private final Point mFastScrollerOffset = new Point();
private final int mEstimatedWidgetListHeaderHeight;
private boolean mTouchDownOnScroller;
private HeaderViewDimensionsProvider mHeaderViewDimensionsProvider;
private int mLastVisibleWidgetContentTableHeight = 0;
private int mWidgetHeaderHeight = 0;
@Nullable private OnContentChangeListener mOnContentChangeListener;
public WidgetsRecyclerView(Context context) {
@ -71,9 +71,6 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
ActivityContext activity = ActivityContext.lookupContext(getContext());
DeviceProfile grid = activity.getDeviceProfile();
mEstimatedWidgetListHeaderHeight = grid.iconSizePx
+ 2 * context.getResources().getDimensionPixelSize(
R.dimen.widget_list_header_view_vertical_padding);
}
@Override
@ -164,6 +161,14 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
if (view instanceof TableLayout) {
// This assumes there is ever only one content shown in this recycler view.
mLastVisibleWidgetContentTableHeight = view.getMeasuredHeight();
} else if (view instanceof WidgetsListHeader
&& mLastVisibleWidgetContentTableHeight == 0
&& view.getMeasuredHeight() > 0) {
// This assumes all header views are of the same height.
RecyclerView.LayoutParams layoutParams =
(RecyclerView.LayoutParams) view.getLayoutParams();
mWidgetHeaderHeight = view.getMeasuredHeight() + layoutParams.topMargin
+ layoutParams.bottomMargin;
}
}
@ -262,7 +267,7 @@ public class WidgetsRecyclerView extends BaseRecyclerView implements OnItemTouch
WidgetsListBaseEntry entry = mAdapter.getItems().get(i);
if (entry instanceof WidgetsListHeaderEntry
|| entry instanceof WidgetsListSearchHeaderEntry) {
totalItemsHeight += mEstimatedWidgetListHeaderHeight;
totalItemsHeight += mWidgetHeaderHeight;
} else if (entry instanceof WidgetsListContentEntry) {
totalItemsHeight += mLastVisibleWidgetContentTableHeight;
} else {