Skip to content
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

Conversation

@sblatz
Copy link
Contributor

@sblatz sblatz commented Jun 8, 2020


Old Behavior

old 2020-06-09 09_28_55

New Behavior

new behavior 2020-06-09 09_25_13

Pull Request checklist

  • Quality: This PR builds and passes detekt/ktlint checks (A pre-push hook is recommended)
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry or does not need one
  • Accessibility: The code in this PR follows accessibility best practices or does not include any user facing features

After merge

  • Milestone: Make sure issues closed by this pull request are added to the milestone of the version currently in development.
  • Breaking Changes: If this is a breaking change, please push a draft PR on Reference Browser to address the breaking issues.

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #7301 into master will increase coverage by 0.02%.
The diff coverage is 60.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #7301      +/-   ##
============================================
+ Coverage     77.35%   77.37%   +0.02%     
  Complexity     5054     5054              
============================================
  Files           674      674              
  Lines         24731    24718      -13     
  Branches       3654     3652       -2     
============================================
- Hits          19130    19126       -4     
+ Misses         4088     4080       -8     
+ Partials       1513     1512       -1     
Impacted Files Coverage Δ Complexity Δ
...lla/components/browser/toolbar/edit/EditToolbar.kt 63.63% <33.33%> (ø) 24.00 <0.00> (ø)
...mponents/browser/toolbar/display/DisplayToolbar.kt 78.68% <100.00%> (ø) 47.00 <1.00> (ø)
...mponents/support/migration/TelemetryIdentifiers.kt 0.00% <0.00%> (ø) 0.00% <0.00%> (ø%)
...components/support/sync/telemetry/SyncTelemetry.kt 87.39% <0.00%> (+1.68%) 41.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9473211...dc80037. Read the comment docs.

@mcarare
Copy link
Contributor

mcarare commented Jun 9, 2020

@sblatz I've checked your changes against Fenix app, the buttons work as expected, but there are issues with the positioning and a visible "snap" and reordering of items.

after
after1

The issue with ripple being cut can be solved with adding android:clipChildren="false" to the parent of the view that "hosts" the ripple ( the topmost layout in this case). It will still be cut by the system bar if on some devices the ripple is big enough.

The open tabs button will still be cut by the url view because they are on the same parent.

IMO after aligning the icons and solving that snapping it will still be a big improvement comparing to the current behavior.

LE: The edit-toolbar appears to be broken in this PR.

@sblatz sblatz force-pushed the fix-drawable-ripple branch 5 times, most recently from 26534e4 to 934289b Compare June 9, 2020 16:27
@sblatz sblatz marked this pull request as ready for review June 9, 2020 16:29
@sblatz sblatz requested review from Amejia481, mcarare and pocmo June 9, 2020 16:29
@sblatz sblatz changed the title Work on drawable ripple Fixes #4673: Fixes BrowserToolbar ripple issues Jun 9, 2020
@sblatz sblatz force-pushed the fix-drawable-ripple branch from 934289b to 6e3cfdf Compare June 9, 2020 16:38
@pocmo pocmo self-assigned this Jun 9, 2020
@pocmo pocmo added the 🕵️‍♀️ needs review PRs that need to be reviewed label Jun 9, 2020
@pocmo
Copy link
Contributor

pocmo commented Jun 9, 2020

Looks like some tests are failing:

[task 2020-06-09T16:42:17.308Z] e: /builds/worker/checkouts/src/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/display/DisplayToolbarTest.kt: (478, 52): Unresolved reference: drawable
[task 2020-06-09T16:42:17.308Z] e: /builds/worker/checkouts/src/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/display/DisplayToolbarTest.kt: (484, 55): Unresolved reference: drawable
[task 2020-06-09T16:42:17.308Z] e: /builds/worker/checkouts/src/components/browser/toolbar/src/test/java/mozilla/components/browser/toolbar/display/DisplayToolbarTest.kt: (488, 52): Unresolved reference: drawable

@sblatz
Copy link
Contributor Author

sblatz commented Jun 9, 2020

@pocmo I'm hopping on those now!

@sblatz sblatz force-pushed the fix-drawable-ripple branch from 6e3cfdf to dc80037 Compare June 9, 2020 17:14
<ImageView
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mozac_browser_toolbar_background"
android:clipChildren="false"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you want the ripple to not be cut, this should be on the parent constraint layout.

<ImageView
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/mozac_browser_toolbar_background"
android:clipChildren="false"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue as for display toolbar.

Copy link
Contributor

@pocmo pocmo left a comment

Choose a reason for hiding this comment

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

Some random thoughts:

  • When we rewrote the layouts of the toolbar we tried to have a flat layout structure to avoid the performance penalties that come from nested layouts. I'm a bit sad if we need to introduce a nested structure again. :(

  • The patch seems to solve the problem for indicators and page actions that live inside the nested layout. But it seems like we still have the problem that browser actions, the menu button or navigation actions (depending on how the toolbar in configured) will be drawn behind the background.

  • Nit: Is extending the ripple something we actually want? Clipping them seems to be more in line with desktop at least (although it uses a rectangle shape)

@pocmo
Copy link
Contributor

pocmo commented Jun 10, 2020

Two alternative ideas that we could try to fix it for all actions and with keeping the flat structure:

  • Replace the views rendering the button with a custom button that renders the ripple effect on the button itself (background or foreground) instead of a parent. But this has the downside that we'd have to change the views of all the actions. And there may be a bunch of custom ones too (e.g. the tab switcher)

  • Replace the CoordinatorLayout of the display toolbar with a custom layout extending coordinatorlayout. This layout could turn the background view invisible (so that it does not get drawn, but still gets measured) and then draw the background on itself - before the actual layout background gets drawn (with the ripple). Then the ripple effect would be drawn on top of the display toolbar background and on top of the background.

🤔

@pocmo
Copy link
Contributor

pocmo commented Jun 10, 2020

I did try to prototype option 2 and something like this seems to work:

class DisplayToolbarView @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
    init {
        // Forcing transparent background so that draw methods will get called and ripple effect
        // for children will be drawn on this layout.
        setBackgroundColor(0x00000000)
    }

    lateinit var backgroundView: ImageView

    override fun onFinishInflate() {
        backgroundView = findViewById(R.id.mozac_browser_toolbar_background)
        backgroundView.visibility = View.INVISIBLE
    }

    // Overrding draw instead of onDraw since we want to draw the background before the actual
    // (transparent) background (with a ripple effect) is drawn.
    override fun draw(canvas: Canvas) {
        canvas.save()
        canvas.translate(backgroundView.x, backgroundView.y)
        backgroundView.drawable.draw(canvas)
        canvas.restore()

        super.draw(canvas)
    }
}

@sblatz
Copy link
Contributor Author

sblatz commented Jun 10, 2020

Closing in favor of @pocmo's solution here: #7323

@sblatz sblatz closed this Jun 10, 2020
bors bot pushed a commit that referenced this pull request Jun 11, 2020
7323: For #7301: Fix drawable ripple issues on BrowserToolbar r=pocmo a=sblatz

Co-authored-by: pocmo <skaspari@mozilla.com>


![improved 2020-06-10 14_33_30](https://user-images.githubusercontent.com/4400286/84321015-5f598d00-ab27-11ea-80e4-70ef7485f646.gif)


Thanks for the much simpler solution @pocmo! 😄 



7343: For #6996: Slightly increase delay to fix intermittent loginDialog issues r=Amejia481 a=sblatz





7344: Closes #6680: Handle exceptions thrown by capturePixels r=jonalmeida a=csadilek

We're still seeing `IllegalStateException`s (Compositor not ready) when capturing thumbnails.

We fixed this a while ago by checking if `firstContentfulPaint` has happened, but that's not working/reliable. There's currently no other way to handle this but to catch-all and return an empty/null bitmap. See #6680.

I've also added a missing test for the `onFirstContentfulPaint` observer which was missing from #6844.

The internal var we can remove now.

r? @jonalmeida ticket is labelled "skittle", but this is really independent of the new tabs tray work.

Co-authored-by: Sawyer Blatz <sdblatz@gmail.com>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
bors bot pushed a commit that referenced this pull request Jun 11, 2020
7323: For #7301: Fix drawable ripple issues on BrowserToolbar r=pocmo a=sblatz

Co-authored-by: pocmo <skaspari@mozilla.com>


![improved 2020-06-10 14_33_30](https://user-images.githubusercontent.com/4400286/84321015-5f598d00-ab27-11ea-80e4-70ef7485f646.gif)


Thanks for the much simpler solution @pocmo! 😄 



7343: For #6996: Slightly increase delay to fix intermittent loginDialog issues r=Amejia481 a=sblatz





7344: Closes #6680: Handle exceptions thrown by capturePixels r=jonalmeida a=csadilek

We're still seeing `IllegalStateException`s (Compositor not ready) when capturing thumbnails.

We fixed this a while ago by checking if `firstContentfulPaint` has happened, but that's not working/reliable. There's currently no other way to handle this but to catch-all and return an empty/null bitmap. See #6680.

I've also added a missing test for the `onFirstContentfulPaint` observer which was missing from #6844.

The internal var we can remove now.

r? @jonalmeida ticket is labelled "skittle", but this is really independent of the new tabs tray work.

Co-authored-by: Sawyer Blatz <sdblatz@gmail.com>
Co-authored-by: Christian Sadilek <christian.sadilek@gmail.com>
@pocmo pocmo modified the milestone: 45.0.0 Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🕵️‍♀️ needs review PRs that need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants