Updating alignment of search input

Bug: 30017936
Change-Id: I2f68711762872bc100b41b2b4768d33e2c0cd902
This commit is contained in:
Peter Schiller
2016-07-07 18:52:21 -07:00
parent 2ee27b12e9
commit 243ad3dbf8
3 changed files with 8 additions and 6 deletions
+1
View File
@@ -64,6 +64,7 @@
<dimen name="all_apps_grid_section_y_offset">8dp</dimen>
<dimen name="all_apps_grid_section_text_size">24sp</dimen>
<dimen name="all_apps_search_bar_height">60dp</dimen>
<dimen name="all_apps_search_bar_margin_top">5dp</dimen>
<dimen name="all_apps_search_bar_icon_margin_right">4dp</dimen>
<dimen name="all_apps_search_bar_icon_margin_top">1dp</dimen>
<dimen name="all_apps_icon_top_bottom_padding">8dp</dimen>
@@ -153,6 +153,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
private ExtendedEditText mSearchInput;
private ImageView mSearchIcon;
private HeaderElevationController mElevationController;
private int mSearchContainerOffsetTop;
private SpannableStringBuilder mSearchQueryBuilder = null;
@@ -312,6 +313,8 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mSearchContainer = findViewById(R.id.search_container);
mSearchInput = (ExtendedEditText) findViewById(R.id.search_box_input);
mSearchIcon = (ImageView) findViewById(R.id.search_icon);
mSearchContainerOffsetTop = getResources().getDimensionPixelSize(
R.dimen.all_apps_search_bar_margin_top);
final LinearLayout.LayoutParams searchParams =
(LinearLayout.LayoutParams) mSearchInput.getLayoutParams();
@@ -419,13 +422,12 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
mAdapter.setNumAppsPerRow(mNumAppsPerRow);
mApps.setNumAppsPerRow(mNumAppsPerRow, mNumPredictedAppsPerRow, new FullMergeAlgorithm());
if (mNumAppsPerRow > 0) {
int iconSize = availableWidth / mNumAppsPerRow;
int iconSpacing = (iconSize - grid.allAppsIconSizePx) / 2;
int rvPadding = mAppsRecyclerView.getPaddingStart(); // Assumes symmetry
final int thumbMaxWidth =
getResources().getDimensionPixelSize(
R.dimen.container_fastscroll_thumb_max_width);
mSearchContainer.setPaddingRelative(
iconSpacing + thumbMaxWidth, 0, iconSpacing + thumbMaxWidth, 0);
mSearchContainer.setPaddingRelative(rvPadding + thumbMaxWidth, 0, rvPadding +
thumbMaxWidth, 0);
}
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
@@ -525,7 +527,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc
LinearLayout.LayoutParams llp =
(LinearLayout.LayoutParams) mSearchInput.getLayoutParams();
llp.topMargin = insets.top;
llp.topMargin = insets.top + mSearchContainerOffsetTop;
mSearchInput.setLayoutParams(llp);
mSearchIcon.setLayoutParams(llp);
@@ -203,7 +203,6 @@ public class AllAppsGridAdapter extends RecyclerView.Adapter<AllAppsGridAdapter.
continue;
}
// Find the section name bounds
PointF sectionBounds = getAndCacheSectionBounds(sectionName);