android / user-interface-samples

Multiple samples showing the best practices in the user interface on Android.
Apache License 2.0
4.44k stars 1.65k forks source link

Unnecessary object creation #410

Open udoy-touhid opened 1 year ago

udoy-touhid commented 1 year ago

Does this object creation is needed each time inside the Widget or we can move it out to class level? I wanted to create a PR out of this. But wanted to discuss first.

val supportedSizes = listOf(
                SizeFCompat(180.0f, 110.0f),
                SizeFCompat(270.0f, 110.0f),
                SizeFCompat(270.0f, 280.0f)
            )

https://github.com/android/user-interface-samples/blob/main/AppWidget/app/src/main/java/com/example/android/appwidget/rv/weather/WeatherForecastAppWidget.kt