Closed Bug 1325931 Opened 7 years ago Closed 7 years ago

Activity stream - Title is not centred in the Top sites tile when website is pinned

Categories

(Firefox for Android Graveyard :: General, defect, P1)

53 Branch
ARM
Android
defect

Tracking

(firefox53 affected, firefox54 verified)

VERIFIED FIXED
Firefox 54
Tracking Status
firefox53 --- affected
firefox54 --- verified

People

(Reporter: cfat, Assigned: ahunt)

Details

(Whiteboard: [MobileAS])

Attachments

(5 files)

Attached image Pin icon and title.png
Environment: 
Device: Prestigio Grace 5x (Android 4.4.2);
Build: latest Nightly 53.0a1 (2016-12-26);

Steps to reproduce:
1. Launch Firefox;
2. Tap on the 3 dots menu of a website from Top sites area;
3. Tap on “Pin site” option.

Expected result:
Website is pinned and the title remains centred inside the tile.

Actual result:
Website is pinned, but the title is moved a bit to the right side of the tile. 

Notes:
Please see the screenshot attached.
Whiteboard: [MobileAS]
Bryan, do we have mocks for this somewhere?
Flags: needinfo?(bbell)
Priority: -- → P2
I've been playing with this a little, and it's slightly tricky (Android doesn't seem to support the concept of centering text relative to the parent View, it insists on centering within the available area - which gets reduced when we add a drawable - even if it's in a separate ImageView). One option is to have hardcoded padding on both sides (where we can then draw the pin), but that might look odd too. Or we can do dynamic calculations, but those will be tricky to perform correctly.

Or we can make the pin float (i.e. not make it aligned to the left of the card), which make it easier to center things.

Or we could align the text to the left (which is what conventional topsites does)
Heh, old topsites on desktop does _exactly_ the same thing (which makes me wonder if this is MVP-worthy).

I've managed to create an incredibly hacky fix, I'll leave this as P2 until I decide if it's really the right approach. (I'll probably move the code involved into ViewUtil, mainly for cleanliness, and also in case we ever need it elsewhere.)
Assignee: nobody → ahunt
Iteration: --- → 1.15
Priority: P2 → P1
A screenshot from when I was testing with a drawable on the right (my patches keep it on the left, I was just verifying that my code covers both sides as needed).
Attachment #8835613 - Flags: review?(s.kaspari)
Attachment #8835738 - Flags: review?(s.kaspari)
Attachment #8835739 - Flags: review?(s.kaspari)
Comment on attachment 8835613 [details]
Bug 1325931 - Pre: add drawable padding to pin

https://reviewboard.mozilla.org/r/111288/#review113000

::: mobile/android/base/resources/layout/activity_stream_topsites_card.xml:33
(Diff revision 2)
>              android:layout_below="@id/favicon"
>              android:background="@color/activity_stream_divider" />
>  
>          <TextView
>              android:id="@+id/title"
> +            android:drawablePadding="2dp"

I'm not sure what the "right" value would be, but currently we have no padding which can look bad.
Comment on attachment 8835613 [details]
Bug 1325931 - Pre: add drawable padding to pin

https://reviewboard.mozilla.org/r/111288/#review113812
Attachment #8835613 - Flags: review?(s.kaspari) → review+
Comment on attachment 8835738 [details]
Bug 1325931 - Implement ViewUtil.setCenteredText() for TextViews with compound drawables

https://reviewboard.mozilla.org/r/111352/#review113814
Attachment #8835738 - Flags: review?(s.kaspari) → review+
Comment on attachment 8835739 [details]
Bug 1325931 - Use compound drawable text centering hack for AS Topsites

https://reviewboard.mozilla.org/r/111354/#review113816
Attachment #8835739 - Flags: review?(s.kaspari) → review+
Pushed by ahunt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d5d12ac7e213
Pre: add drawable padding to pin r=sebastian
https://hg.mozilla.org/integration/autoland/rev/596c114a2524
Implement ViewUtil.setCenteredText() for TextViews with compound drawables r=sebastian
https://hg.mozilla.org/integration/autoland/rev/7697b05969f8
Use compound drawable text centering hack for AS Topsites r=sebastian
Tested using the latest Nightly build 54.0a1 (2017-02-16) with the following devices:
- Oneplus Two (Android 6.0.1);
- Samsung Galaxy Note 4 (Android 5.0.1);
- Huawei MediaPad M2 (Android 5.1.1).

After pinning a website, it's title stays centred into the tile as in the next Screenshot: http://imgur.com/a/sKW1A

I'm marking this as Verified.
Status: RESOLVED → VERIFIED
Flags: needinfo?(bbell)
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: