Closed Bug 825088 Opened 12 years ago Closed 12 years ago

Compound Drawable for Addon rows on about:home

Categories

(Firefox for Android Graveyard :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 20

People

(Reporter: sriram, Assigned: sriram)

References

Details

Attachments

(1 file)

Addon rows can use compound drawable to show icons, and Spannable string to show the version in different color. This reduces the number of views required to have one single row.
Blocks: 819468
I was able to reduce the number of views to a single text view. However, the divider below is giving issues. If the divider has to a view, we would have a layout like

<RelativeLayout>
    <TextView/>
    <View .. for divider />
</RelativeLayout>

This doesn't sound optimal.

The other option would be to use nine-patch images with 1dp of solid line at the bottom and empty space at the top. This will work fine on mdpi and xhdpi. However on hdpi, 1dp will translate to 1.5px. We wouldn't be able to come up with a proper nine patch for this half-pixel.

The last option is to use a complex shape for background

<Layers>
  <Rectangle of size 46dp with blue color>
  <Rectangle of size 47dp with divider color>
</Layers>

But this is a overkill. We are re-painting two backgrounds unnecessarily. Is there a better option for this?

If we go with nine-patch images, I would need new resources.
Can we use a listview instead of a linearlayout for the container inside here and then use real android dividers? http://developer.android.com/reference/android/widget/ListView.html#attr_android:divider

Sadly (stupidly?) LinearLayout's seem to support dividers, but specifically mention only showing them between horizontal lists of buttons.
ListView is an overkill here. We want to remove the GridView in about:home first :D
LinearLayout supports dividers only from v14 I guess.

Probably the other option:
We could add/remove a View (as a divider) when we add/remove an item to LinearLayout.
Attached patch PatchSplinter Review
This removes quite a few views. Just one TextView is used for addon-row and sync-tab rows. The textAppearance for the version is applied as a Span. The drawables are set when loaded.

The re-usable values are held as static values.
Attachment #696419 - Flags: review?(mark.finkle)
I tried using the same principle for last-tab-rows. The icon setting was fine. It worked fine if the the title and the url length is shorter and fits within the row's width. However if they are longer, especially the title, the title doesn't ellipsize and the url is lost (which is expected). Other sorts of spans like BulletSpan didn't help either. If we can specify ellipsis per line, we can use this logic there.. and by extension, awesomebar-tabs-rows.
Attachment #696419 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/8dc63fc43d1a
Assignee: nobody → sriram
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 20
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: