Improve the SwitchCompatMapper to make SwitchCompat have similar replay with the real UI.
Main Changes
Same as previous PR, the SwitchCompatMapper doesn't create ShapeWireframe any more for checked or unchecked state, instead, we extract the track drawable and thumb drawable to show the real graphic of the component.
Sample application is updated to demonstrate more state of switch buttons
Since the new implementation of SwitchCompatMapper create ImageWireframe other than ShapeWireframe, some overhead is in the expectation, to measure this, Method called metric is used to measure the total duration of creating a wire frame of each map method, here is the result
old implementation (Shape wireframe)
new implementation (Image wireframe)
As we can see the new implementation takes 180us on average, and old implementation takes 120~140us on average, the overhead is nearly 50% percent.
Review checklist (to be filled by reviewers)
[ ] Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
[ ] Make sure you discussed the feature or bugfix with the maintaining team in an Issue
[ ] Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
What does this PR do?
Improve the
SwitchCompatMapper
to makeSwitchCompat
have similar replay with the real UI.Main Changes
SwitchCompatMapper
doesn't createShapeWireframe
any more for checked or unchecked state, instead, we extract the track drawable and thumb drawable to show the real graphic of the component.Motivation
What inspired you to submit this pull request?
Session replay demo
https://mobile-integration.datadoghq.com/rum/replay/sessions/128703cf-1202-45c6-a34a-8a8a2df7275d?applicationId=38030dde-f9f9-4e52-9443-b9804a030080&seed=bd9e3c7b-fbbf-4a75-89b7-a323624f0cd2&ts=1719931750249
New implementation overhead
Since the new implementation of
SwitchCompatMapper
createImageWireframe
other thanShapeWireframe
, some overhead is in the expectation, to measure this,Method called
metric is used to measure the total duration of creating a wire frame of eachmap
method, here is the resultAs we can see the new implementation takes 180us on average, and old implementation takes 120~140us on average, the overhead is nearly 50% percent.
Review checklist (to be filled by reviewers)