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

Resetting the button background creates a temporary button #21579

Open
mattleibow opened this issue Apr 2, 2024 · 0 comments
Open

Resetting the button background creates a temporary button #21579

mattleibow opened this issue Apr 2, 2024 · 0 comments
Labels
area-controls-button Button, ImageButton platform/android 🤖 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Milestone

Comments

@mattleibow
Copy link
Member

Passing the default drawable has been changed to copy the tints from a temporary button. It is not an operation that happens frequently, set a background and then removing it, but is this perhaps more expensive?

Originally posted by @jsuarezruiz in #20412 (comment)

It is a bit more expensive, but we don't need to add fields to handlers and pass the default drawable around. That requires new APIs and a bunch of old ones not working. It is more expensive, but this is smei-temporary because all I am using is the tint:

var defaultTintList = btn.BackgroundTintList;
var defaultColor = defaultTintList?.GetColorForState([R.Attribute.StateEnabled], AColor.Black) ?? AColor.Black;

A better option is to not do either and just figure out the default tint color. There is probably some theme resource or some API to just get the raw color. However the color goes from android resources to the main color of the button - some primary color thing. If we can do that in our code, it will just be reading a resource color from the android resources.

@mattleibow mattleibow added platform/android 🤖 legacy-area-perf Startup / Runtime performance legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-button Button, ImageButton labels Apr 2, 2024
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor legacy-area-perf Startup / Runtime performance labels May 10, 2024
@jsuarezruiz jsuarezruiz added this to the Backlog milestone Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-button Button, ImageButton platform/android 🤖 t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.)
Projects
None yet
Development

No branches or pull requests

3 participants