Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Tab switcher UI issues #5736

Merged
merged 21 commits into from
Mar 20, 2025
Merged

Fix: Tab switcher UI issues #5736

merged 21 commits into from
Mar 20, 2025

Conversation

0nko
Copy link
Member

@0nko 0nko commented Mar 5, 2025

Task/Issue URL: https://app.asana.com/0/1207418217763355/1209581022862153

Description

This PR fixes a couple of minor UI issues in the tab switcher:

Steps to test this PR

Tab switcher item layout

  • Verify the tab layout matches the design here and here

image

Tab switcher item layout

  • Open the tab switcher
  • Verify the screen scrolls to the current tab
  • Scroll away from the current tab
  • Switch the tab layout
  • Verify the screen keeps the previous scroll position (doesn't scroll to current tab)

Tab preview image

  • Make sure you have a few tabs
  • Swipe between them
  • Open the tab switcher
  • Verify they have a preview image

Favicon

  • Clear all tabs
  • Start with a new tab in the browser
  • Go to the tab switcher
  • Verify the dax icon and dax logo are displayed
  • Go back to the browser
  • Enter cnn.com and don't wait for it to fully load and open the tab switcher
  • Verify the favicon is eventually updated to the correct icon

@0nko 0nko requested a review from mikescamell March 5, 2025 17:55
@mikescamell mikescamell self-assigned this Mar 6, 2025
Copy link
Contributor

@mikescamell mikescamell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that in some instances we animate to the selected tab rather than being on it immediately. I need to look into how to reproduce.

Screen_recording_20250306_093644.mp4

@@ -92,6 +92,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/title" />

<ImageView
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓Why do we need a new ImageView to load the dax logo into? What was stopping us from using the existing tabPreview ImageView and adjusting as needed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The webpage previews need to use matrix scaling, which doesn't work for the logo. I thought it'd be complicating things trying to change it on the fly when views are recycled. But after giving it another thought it's not that bad: Use a single ImageView for all tabs

@@ -219,6 +219,7 @@ open class BrowserActivity : DuckDuckGoActivity() {
if (wasSwipingStarted) {
wasSwipingStarted = false

currentTab?.onTabSwipedAway()
viewModel.onTabsSwiped()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡Could we not make this part of onTabPageSwiped? Feels like this belongs there as well

app:layout_constraintHorizontal_bias="0.0"
app:typography="h5"
tools:text="Slashdot" />
tools:text="Slashdot test tes tes tes tes tes tew tes tes tes tes tes tes tes" />

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍Maybe we can reduce this a bit? 😅

android:layout_marginEnd="7dp"
android:layout_marginBottom="10dp">
android:layout_marginHorizontal="@dimen/keyline_2"
android:layout_marginVertical="6dp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on MM, it's probably worth following up and finding out why our List item does not currently match the designs and if there is any good reason why 👍

app:layout_constraintTop_toTopOf="parent" />
android:src="@drawable/ic_dax_icon"
android:layout_marginStart="@dimen/keyline_2"
app:layout_constraintTop_toTopOf="@id/close"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓Shouldn't this be keyline_3 (12dp)?

Copy link
Member Author

@0nko 0nko Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. It seems like the 12dp margin in the spec is used to compensate for the narrow icon used. Yes. Fixed.

@0nko 0nko requested review from malmstein and nalcalag as code owners March 6, 2025 11:13
@0nko 0nko requested a review from mikescamell March 6, 2025 11:13
@0nko 0nko force-pushed the fix/ondrej/tab-switcher-ui-issues branch from ad1e231 to f80c7ce Compare March 11, 2025 19:44
@mikescamell
Copy link
Contributor

@0nko Still seeing the animated scroll every now and then with the selected tab but I still think it's better than not scrolling at all to the current selected tab

Screen_recording_20250312_181815.mp4

Also the favicon is not updating if I switch to the TabSwitcher before the website loads

Screenshot_20250312_182329

@0nko
Copy link
Member Author

0nko commented Mar 19, 2025

@mikescamell I've removed the tab switcher scroll bug fix and updated the favicon loading. Ready for another round.

@mikescamell
Copy link
Contributor

@0nko Grid and List items look good design wise now! ✅

But I'm still not seeing a favicon load when i switch to the tab switcher before the website has finished loading. Ign.com was the website I was using

@0nko
Copy link
Member Author

0nko commented Mar 19, 2025

@mikescamell It's a timing issue -- the favicon isn't fetched when the tab switcher is displayed. I've added 3 retries, which should take care for the majority of cases.

view.loadFavicon(bitmap, url, placeholder)

// sometimes it takes a while to fetch a favicon, so we try to load it from disk again
repeat(FAVICON_LOAD_RETRIES) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works now! But as discussed on MM this is probably not the best long term fix and we probably need a reactive solution that loads the Favicon when it's ready, as this may not work still on a slow connection. As we discussed probably worth creating a task in the Android backlog to look into this more on a hack days/quick win day.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created a task for us to come back to: https://app.asana.com/0/1202552961248957/1209728703137860/f

@0nko 0nko merged commit 02811ad into develop Mar 20, 2025
8 checks passed
@0nko 0nko deleted the fix/ondrej/tab-switcher-ui-issues branch March 20, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants