mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 724348 - Only use the necessary vertical space for top sites in about:home (r=mfinkle)
This commit is contained in:
parent
0851a39133
commit
2db6c1f414
@ -628,11 +628,22 @@ public class AboutHomeContent extends ScrollView {
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
int numRows;
|
||||
|
||||
SimpleCursorAdapter adapter = (SimpleCursorAdapter) getAdapter();
|
||||
int nSites = Integer.MAX_VALUE;
|
||||
|
||||
if (adapter != null) {
|
||||
Cursor c = adapter.getCursor();
|
||||
if (c != null)
|
||||
nSites = c.getCount();
|
||||
}
|
||||
|
||||
Configuration config = getContext().getResources().getConfiguration();
|
||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
numRows = NUMBER_OF_TOP_SITES_LANDSCAPE / NUMBER_OF_COLS_LANDSCAPE;
|
||||
nSites = Math.min(nSites, NUMBER_OF_TOP_SITES_LANDSCAPE);
|
||||
numRows = (int) Math.round((double) nSites / NUMBER_OF_COLS_LANDSCAPE);
|
||||
} else {
|
||||
numRows = NUMBER_OF_TOP_SITES_PORTRAIT / NUMBER_OF_COLS_PORTRAIT;
|
||||
nSites = Math.min(nSites, NUMBER_OF_TOP_SITES_PORTRAIT);
|
||||
numRows = (int) Math.round((double) nSites / NUMBER_OF_COLS_PORTRAIT);
|
||||
}
|
||||
int expandedHeightSpec =
|
||||
MeasureSpec.makeMeasureSpec((int)(mDisplayDensity * numRows * kTopSiteItemHeight),
|
||||
|
Loading…
Reference in New Issue
Block a user