Is there a specific reason why the notification setting xml is defined as a custom view in folder /res/layout not using the standard <PreferenceScreen> tag like the other settings in folder /res/xml.
Because this custom definition brings a lot of boilerplate when adding a simple switch setting.
Just compare my 2 PR
appearance setting: #4642
notification setting: #4643
From IRC:
Android has a special way to build simple settings activities by using the files in xml/. If you take a look at those you will see those are not layouts, but just specifications for how settings should be displayed and changed.
For the notification settings I used a custom layout written like all other Android layouts (i.e. there is nothing specific to settings), since I needed to build a specific custom UI which wouldn't have been possible with normal settings xml/
I see.
I looked around a bit and i would change it so it is the same as the peertube instance setting under content.
this would require another click from the user, but adding new settings is a lot more convenient for developers.
I don't know about that. I would prefer something as pleasant as possible to the user instead of to the developer. At the end of the day settings only have to be added once, so doing some more work for the 2-3 settings we want to add is reasonable in my opinion
Ok. I managed to retain the old UI while being able to use prebuild android elements for simple preferences by letting NotificationSettingsFragment inherit from Preference instead of Fragment and some minor adjustments.
I just have to find out what the equivalent to Fragment.onPause() is, but for Preference to call the save and broadcast method. I'll open a PR when i have that and cleaned it up a bit
Most helpful comment
Ok. I managed to retain the old UI while being able to use prebuild android elements for simple preferences by letting
NotificationSettingsFragmentinherit fromPreferenceinstead ofFragmentand some minor adjustments.I just have to find out what the equivalent to
Fragment.onPause()is, but forPreferenceto call the save and broadcast method. I'll open a PR when i have that and cleaned it up a bit