Rework tab tray preview dimensions




Firefox for Android
3 years ago
3 years ago


(Reporter: mhaigh, Unassigned)


(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)




3 years ago
The current tabs tray implementation doesn't quite get the preview image dimensions correct.  This bug is to track tweaking the dimens files

Comment 2

3 years ago
So I've taken the approach of splitting everything up in to buckets targeting the smallest width dimension of a given device, this approach is good for all devices on android 14 and over (4.0) - for GB devices we'll have to hard-code the values in the default dimens file.

Personally I don't own a device which is on Android 4+ which is under sw320dp, but just in case I've opted to support as low as 240.  These are the proposed buckets: sw240dp, sw280dp, sw320dp, sw360dp, sw400dp  

Tablet isn't as size restricted so these calculations will only concentrate on mobile.  For each bucket I assume we will want two columns in portrait mode.  For each bucket I work out the required tab preview width by subtracting from the smallest width the edge padding, desired middle column separation and two lots of two highlight border widths.

  (screen dimension - (2 * side padding) - desired middle column separation) / number of columns - (2 * highlight border width)

For example, for a sw320dp device with side and centre paddings of 15dp, the calculation looks like this:

  (320 - (2 * 15) - 15) / 2 - (2 * 4) = 129

and we're using an aspect ratio of 0.74 so the width is 129dp and the height is 129*0.74 = 96dp

This seems to work well on all the devices I've tried it on so far.

To maximize the thumbnail size, I've adjusted the side and middle spacings to:
 - sw240dp & sw280dp: 12dp
 - sw320dp : 15dp
 - sw360dp : 18dp
 - sw400dp and above : 20dp

APK here to try out:


3 years ago
Assignee: mhaigh → s.kaspari
Assignee: s.kaspari → nobody
Blocks: 1194281
You need to log in before you can comment on or make changes to this bug.