InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.74k stars 936 forks source link

Add SettingScreenBase to create a generic checkbox screen #1508

Closed Riksu9000 closed 1 year ago

Riksu9000 commented 1 year ago

This will reduce duplication greatly once applied to other settings screens as well.

The checkbox object array is stored in the class creating the checkbox screen. This is so there can be any number of checkboxes, without using templates.

Do you have ideas for a better name for this class?

Let me know what you think about this approach.

minacode commented 1 year ago

How does this compare against displayapp/screens/CheckboxList?

Riksu9000 commented 1 year ago

Oops, I forgot about that. I should take a look at that soon.

Riksu9000 commented 1 year ago

1510 practically obsoletes this PR, but I'd still like to hear your feedback since I could implement these ideas in CheckboxList. Passing unlimited arrays and an array of objects allows any number of checkboxes to be used, and a function doesn't need to be passed to save the settings.

minacode commented 1 year ago

The code looks cleaner to me from a quick look and I cannot think of a settings screen right now where what you showed with the refactored screen would not be enough.