Bug 686528 - (4 of 5) kTopSiteHeight in AboutHomeContent uses a dimen constant. r=sriram

This commit is contained in:
Michael Comella 2012-08-01 22:23:51 -04:00
Родитель f893913f82
Коммит 679c5665d5
2 изменённых файлов: 4 добавлений и 17 удалений

Просмотреть файл

@ -626,22 +626,8 @@ public class AboutHomeContent extends ScrollView
} }
public static class TopSitesGridView extends GridView { public static class TopSitesGridView extends GridView {
/** From layout xml:
* 80dip image height
* + 2dip image paddingTop
* + 1dip image padding (for bottom)
* + 3dip marginTop on the TextView
* +15dip TextView height
* + 8dip vertical spacing in the GridView
* ------
* 109dip total height per top site grid item
*/
private static final int kTopSiteItemHeight = 109;
float mDisplayDensity ;
public TopSitesGridView(Context context, AttributeSet attrs) { public TopSitesGridView(Context context, AttributeSet attrs) {
super(context, attrs); super(context, attrs);
mDisplayDensity = context.getResources().getDisplayMetrics().density;
} }
@Override @Override
@ -661,9 +647,9 @@ public class AboutHomeContent extends ScrollView
numRows = (int) Math.round((double) nSites / mNumberOfCols); numRows = (int) Math.round((double) nSites / mNumberOfCols);
setNumColumns(mNumberOfCols); setNumColumns(mNumberOfCols);
int expandedHeightSpec = int expandedHeightSpec = MeasureSpec.makeMeasureSpec(numRows * getResources().
MeasureSpec.makeMeasureSpec((int)(mDisplayDensity * numRows * kTopSiteItemHeight), getDimensionPixelSize(R.dimen.abouthome_content_top_sites_item_height),
MeasureSpec.EXACTLY); MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, expandedHeightSpec); super.onMeasure(widthMeasureSpec, expandedHeightSpec);
} }

Просмотреть файл

@ -7,6 +7,7 @@
<dimen name="abouthome_gutter_small">0dp</dimen> <dimen name="abouthome_gutter_small">0dp</dimen>
<dimen name="abouthome_gutter_large">0dp</dimen> <dimen name="abouthome_gutter_large">0dp</dimen>
<dimen name="abouthome_content_top_sites_item_height">106dp</dimen>
<dimen name="autocomplete_min_width">200dp</dimen> <dimen name="autocomplete_min_width">200dp</dimen>
<dimen name="autocomplete_row_height">32dp</dimen> <dimen name="autocomplete_row_height">32dp</dimen>
<dimen name="awesomebar_header_row_height">20dp</dimen> <dimen name="awesomebar_header_row_height">20dp</dimen>