rework UI in Jetpack Compose
Hi, I couldn't help myself on this one, I just kept on thinking of ways to improve the UI, and I also wanted an excuse to dig into Jetpack Compose. I baselined a lot of the design off of the AOSP Settings portions written in Jetpack Compose.
This is still WIP as there are at least several remaining things to do:
- [x] implement color schemes for < Android 12
- [x] decide on back navigation (icon in top bar versus relying on system back action). See screenshot of "Extra" for what this could look like.
- [x] improve bottom toggle
- [x] fix day/night mode text coloring for Repeated screen
- [x] add back permission requesting
- [x] refactor all hardcoded values out of code (resource sizes, hardcoded strings, etc.)
- [x] update screenshots (maybe make some videos/GIFs)
And of course, pictures are worth a thousand words!
Animations:
Default theme for Android <12:
Question: what is the purpose of the "GOTO" button on this screen? It takes me to Settings -> Notifications -> Device & app notifications, and Silence isn't even listed on that screen. I'm leaving it out of the new UI unless this is another bug that needs to be fixed.
@TinfoilSubmarine Hello, thank you very much for this. The app has to be in Device & app notifications, but Google has changed smth in recent Android versions and Silence was tested on Android 12 as I remember. Text trigger on your last screenshot requires read notifications permission to extract phone numbers from them.
OK, I just checked and it actually is there, not sure what was going on. I added the button to the new UI. Maybe we can redirect the user to the screen if they try to enable the Text toggle.
I dont remember why it was done like this. Maybe I havent found a way to check for BIND_NOTIFICATION_LISTENER_SERVICE permission without binding to the listener service.
I just pushed the changes needed to incorporate the few latest changes, as well as converting the regex blocking over to Jetpack Compose as well. I put it in the Extras menu, not sure if there was a better place:
/home/runner/work/Silence/Silence/app/src/main/java/me/lucky/silence/NotificationManager.kt:28: Error: Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission) or explicitly handle a potential SecurityException [MissingPermission] manager.notify( ^ Explanation for issues of type "MissingPermission": This check scans through your code and libraries and looks at the APIs being used, and checks this against the set of permissions required to access those APIs. If the code using those APIs is called at runtime, then the program will crash. Furthermore, for permissions that are revocable (with targetSdkVersion 23), client code must also be prepared to handle the calls throwing an exception if the user rejects the request for permission at runtime.
My code doesn't cause this CI failure, it was already there.
Thank you very much for this @TinfoilSubmarine Merging