Device controls support
Hi, this PR adds support for Device Controls introduced with Android 11.
Code is mostly just modified example from https://developer.android.com/develop/ui/views/device-control
It's pretty much ready to merge, a few things though:
- [x] ~~there are some hardcoded strings in the
DeviceControlsProviderService, I'll remove them later today~~ - [ ] I didn't add any strings to
strings-fr.xmlsince I don't know the language well enough to do that - [x] ~~I'm not sure weather to show 0-255 or 0%-100% in the Device controls (there's a
TODOfor this in the code) - asking for your opinion here~~ - [x] ~~long-pressing the device in the device controls view doesn't open device specific screen (I'm not sure how to achieve that in a simple way and didn't want to mess with UI code much, maybe can be implemented later) (there are two
TODOs for this in the code)~~ - [ ] two methods are copied straight from another ViewModel (annotated in the code) - maybe should be exported into some common utils?
- [ ] after clearing app data (or an app reinstall) first tap and hold opens
MainActivity, but it only shows up for a split second before turning transparent. this happens before and after changes in this PS and I don't know whats causing it
probably closes https://github.com/Moustachauve/WLED-Native-Android/issues/21 (at least for people on Android 11 and higher) and helps with https://github.com/Moustachauve/WLED-Native-Android/issues/17
I addressed some of the gemini's review. Duplicated functions are left (but modified) and I didn't touch createAppIntentForDevice since there's no corresponding part for it in the MainActivity.
interesting wording used by AI
When skimming through gemeni's messages I saw this beauty:
Android Device Controls Integration: I've added support for Android 11+ Device Controls, allowing users to manage WLED devices directly from their quick settings or power menu.
you haven't added anything. This wording should have never shown up.
Waiting for a non-AI review.
I haven't checked out the code yet but I just compiled your branch and it works great! One thing I noticed though, is that it showed e.g 128,0 for me underneath the name with the first one being the brightness value. Not sure what the other number means in that context.
Speaking about the number, I would prefer it using percent (0%-100%) instead of the brightness value that you see in WLED because I think it's a cleaner approach for this part of the Android UI.
I am further of the opinion that getting straight into the details page by long pressing the tile is an absolute must for this feature. If I find some time, maybe I can see if I'll manage to fix support it.
Thanks for now, great idea! 😁
I haven't checked out the code yet but I just compiled your branch and it works great!
Glad to hear.
One thing I noticed though, is that it showed e.g 128,0 for me underneath the name with the first one being the brightness value. Not sure what the other number means in that context.
it's just 128, but I might have set it to display as float. This will change when moving to 0-100% scale.
I am further of the opinion that getting straight into the details page by long pressing the tile is an absolute must for this feature. If I find some time, maybe I can see if I'll manage to fix support it.
I'll make an attempt too. It's not an absolute must for me, but it sure would be nice to have.
Alright, I've fixed the format in device controls view and added navigation to specific device. I not a huge fan of this navigation code, so if there's a better way to write it I'd be happy to change it.
Other then that there is still some duplicated code in DeviceControlsProviderService, not sure if this should be merged with the one in DeviceListViewModel. Strings aren't translated and I'd like to go over the whole PR to check for anything left. Since some of this is more a matter of opinion I'd like some input from @Moustachauve if you have some time.
Wow, this is great! I will have to test it myself (might take a while, sorry) but I didn't think this was possible for local controls!
It's pretty cool. What happens when you are away from home, I assume it says unavailable or something like that?
Related to the AI, feel free to ignore it, but I find it nice to have a summary and initial look, even though it's not super accurate for reviews.
Wow, this is great! I will have to test it myself (might take a while, sorry) but I didn't think this was possible for local controls!
Awesome. Take as much time as you need.
What happens when you are away from home, I assume it says unavailable or something like that?
Yea, Offline to be specific.
Related to the AI, feel free to ignore it, but I find it nice to have a summary and initial look, even though it's not super accurate for reviews.
Well, it got things right. It's just that most of those already had a note attached.
I personally approve of the 0-100% range. It's funny because I did almost the exact same changes on my local branch, but yours are a bit cleaner. Just from a usage perspective, it seems that the implementation is not completely reliably yet. Sometimes I'm unable to toggle or change, and then it works again a few seconds later. This could very well be an issue of the DeviceControl implementation itself, but I don't know. Thanks for the work! 😄
I personally approve of the 0-100% range.
❤️
Just from a usage perspective, it seems that the implementation is not completely reliably yet. Sometimes I'm unable to toggle or change, and then it works again a few seconds later.
I'm having the same issues on my main strip, but that one is running on ESP01 so not exactly a recommended configuration. I did setup another one with ESP32 to test multiple devices and I don't recall having problems there. Not sure how to troubleshoot this either.