mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 712559 - top sites section of about:home resizes when thumbnails populate r=mfinkle
This commit is contained in:
parent
b0ed0e6ffa
commit
01e745cb0b
@ -62,6 +62,7 @@ import android.text.SpannableString;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
@ -300,16 +301,41 @@ public class AboutHomeContent extends ScrollView {
|
||||
}
|
||||
|
||||
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) {
|
||||
super(context, attrs);
|
||||
DisplayMetrics dm = new DisplayMetrics();
|
||||
GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(dm);
|
||||
mDisplayDensity = dm.density;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
// This is to ensure that the GridView always has a size that shows
|
||||
// all items with no need for scrolling.
|
||||
int expandedHeightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
|
||||
MeasureSpec.AT_MOST);
|
||||
int numCols;
|
||||
int numRows;
|
||||
Configuration config = getContext().getResources().getConfiguration();
|
||||
if (config.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
numCols = NUMBER_OF_COLS_LANDSCAPE;
|
||||
numRows = NUMBER_OF_TOP_SITES_LANDSCAPE / NUMBER_OF_COLS_LANDSCAPE;
|
||||
} else {
|
||||
numCols = NUMBER_OF_COLS_PORTRAIT;
|
||||
numRows = NUMBER_OF_TOP_SITES_PORTRAIT / NUMBER_OF_COLS_PORTRAIT;
|
||||
}
|
||||
int expandedHeightSpec =
|
||||
MeasureSpec.makeMeasureSpec((int)(mDisplayDensity * numRows * kTopSiteItemHeight),
|
||||
MeasureSpec.EXACTLY);
|
||||
super.onMeasure(widthMeasureSpec, expandedHeightSpec);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
<TextView android:id="@+id/title"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="15dip"
|
||||
android:layout_marginTop="3dip"
|
||||
android:singleLine="true"
|
||||
android:textColor="#000000"
|
||||
|
Loading…
Reference in New Issue
Block a user