Merge "Round up time calculations in LinearSmoothScroller" into lmp-preview-dev
diff --git a/v17/leanback/res/values/dimens.xml b/v17/leanback/res/values/dimens.xml
index de9b452..b3ec3ee 100644
--- a/v17/leanback/res/values/dimens.xml
+++ b/v17/leanback/res/values/dimens.xml
@@ -22,7 +22,7 @@
<dimen name="lb_browse_padding_right">56dp</dimen>
<dimen name="lb_browse_padding_bottom">48dp</dimen>
<dimen name="lb_browse_rows_margin_start">238dp</dimen>
- <dimen name="lb_browse_rows_margin_top">140dp</dimen>
+ <dimen name="lb_browse_rows_margin_top">167dp</dimen>
<dimen name="lb_browse_rows_fading_edge">16dp</dimen>
<dimen name="lb_browse_title_height">60dp</dimen>
@@ -51,7 +51,8 @@
<dimen name="lb_browse_row_hovercard_max_width">400dp</dimen>
<dimen name="lb_browse_row_hovercard_title_font_size">18sp</dimen>
<dimen name="lb_browse_row_hovercard_description_font_size">14sp</dimen>
- <dimen name="lb_browse_item_margin">12dp</dimen>
+ <dimen name="lb_browse_item_horizontal_margin">8dp</dimen>
+ <dimen name="lb_browse_item_vertical_margin">10dp</dimen>
<item name="lb_focus_zoom_factor_small" type="fraction">106%</item>
<item name="lb_focus_zoom_factor_medium" type="fraction">110%</item>
@@ -62,7 +63,7 @@
<dimen name="lb_details_overview_margin_left">132dp</dimen>
<dimen name="lb_details_overview_margin_right">132dp</dimen>
<dimen name="lb_details_overview_margin_bottom">40dp</dimen>
-
+
<dimen name="lb_details_overview_description_margin_top">24dp</dimen>
<dimen name="lb_details_overview_description_margin_left">24dp</dimen>
<dimen name="lb_details_overview_description_margin_right">24dp</dimen>
diff --git a/v17/leanback/res/values/styles.xml b/v17/leanback/res/values/styles.xml
index a8c316d..535f7e3 100644
--- a/v17/leanback/res/values/styles.xml
+++ b/v17/leanback/res/values/styles.xml
@@ -134,10 +134,10 @@
<item name="android:focusableInTouchMode">true</item>
<item name="android:paddingLeft">?attr/browsePaddingLeft</item>
<item name="android:paddingRight">?attr/browsePaddingRight</item>
- <item name="android:paddingBottom">@dimen/lb_browse_item_margin</item>
- <item name="android:paddingTop">@dimen/lb_browse_item_margin</item>
- <item name="horizontalMargin">@dimen/lb_browse_item_margin</item>
- <item name="verticalMargin">@dimen/lb_browse_item_margin</item>
+ <item name="android:paddingBottom">@dimen/lb_browse_item_vertical_margin</item>
+ <item name="android:paddingTop">@dimen/lb_browse_item_vertical_margin</item>
+ <item name="horizontalMargin">@dimen/lb_browse_item_horizontal_margin</item>
+ <item name="verticalMargin">@dimen/lb_browse_item_vertical_margin</item>
<item name="focusOutFront">true</item>
<item name="rowHeight">wrap_content</item>
</style>
@@ -148,11 +148,11 @@
<item name="android:focusableInTouchMode">true</item>
<item name="android:paddingLeft">?attr/browsePaddingLeft</item>
<item name="android:paddingRight">?attr/browsePaddingRight</item>
- <item name="android:paddingBottom">@dimen/lb_browse_item_margin</item>
+ <item name="android:paddingBottom">@dimen/lb_browse_item_vertical_margin</item>
<item name="android:paddingTop">?attr/browseRowsMarginTop</item>
<item name="android:gravity">center_horizontal</item>
- <item name="horizontalMargin">@dimen/lb_browse_item_margin</item>
- <item name="verticalMargin">@dimen/lb_browse_item_margin</item>
+ <item name="horizontalMargin">@dimen/lb_browse_item_horizontal_margin</item>
+ <item name="verticalMargin">@dimen/lb_browse_item_vertical_margin</item>
<item name="focusOutFront">true</item>
</style>
diff --git a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
index 19e70b8..bb9a613 100644
--- a/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
+++ b/v7/recyclerview/src/android/support/v7/widget/RecyclerView.java
@@ -2362,7 +2362,7 @@
*/
public void clear() {
mAttachedScrap.clear();
- mCachedViews.clear();
+ recycleCachedViews();
}
/**
@@ -2456,6 +2456,18 @@
recycleViewHolder(getChildViewHolderInt(view));
}
+ void recycleCachedViews() {
+ final int count = mCachedViews.size();
+ for (int i = count - 1; i >= 0; i--) {
+ final ViewHolder cachedView = mCachedViews.get(i);
+ if (cachedView.isRecyclable()) {
+ getRecycledViewPool().putRecycledView(cachedView);
+ dispatchViewRecycled(cachedView);
+ }
+ mCachedViews.remove(i);
+ }
+ }
+
void recycleViewHolder(ViewHolder holder) {
if (holder.isScrap() || holder.itemView.getParent() != null) {
throw new IllegalArgumentException(