Enable use of CandyBar as a library
This PR is a big refactoring accomplishing two things:
- All information that we have about launchers is now neatly encapsulated. Most notably, calling apps can use these methods:
-
supportsIconPacks -
supportsDirectApply -
supportsManualApply -
applyDirectly -
applyManually
-
- There's now a standard flow of events that all launchers adhere to automatically. No more forgetting
((AppCompatActivity) context).finish()and no more ambiguity whether Google Play is opened as a fallback. :) It's now easier than ever to spot if launchers are missing information. For example Blackberry where we used to open theMainActivitybut without any instructions whatsoever. Fixing this is out of scope of this PR but it's now a clearly visible flaw in the definition.
If more freedom is necessary, launchers also offer DirectApply.getActivity (and DirectApply.getBroadcast if necessary) and ManualApply.getInstructionSteps.
Why?
After 3 years of using CandyBar, I now feel like I've outgrown the UI and Icon Request mechanics but I don't want to make a whole new fork of the library. Instead, I want to keep CandyBar as a dependency and leverage the sane defaults for the icon picker, etc., but build a new UI on top. :)
I believe the refactoring makes sense far beyond that, as it should invite more contributions: More manual descriptions as a fallback if the direct apply fails for whatever reason, links to settings in the respective launchers, you name it.
@sarsamurmu is this something you can imagine to merge? It's still a work in progress and I'd be testing this in my own apps for 1-2 months before requesting a merge, but before I go that route and invest more time, I want to see whether this change would be welcome.
@moertel Yeah, we can merge that. I always wanted to improve the overall code structure to make things more modular, but I guess I never got enough motivation. So, thanks for these improvements
This has been running in my app for 20 days now with zero complaints and zero exceptions. Ready for review! :)
Two more notable changes here:
- I split up Lawnchair to reflect their split into Lawnchair and Lawnchair Legacy on Google Play
- Included the partial fix of https://github.com/pashapuma/candybarMoto/commit/cb931b62ec7bca403cc3126572d0786a1094922a suggested in https://github.com/zixpo/candybar/issues/230
For MOTO, we might need an override of isSupported for its ManualApply implementation in the future. Out of scope for this PR, so I'd suggest merging as-is.
Thank you @moertel and all others who are working on CandyBar. I'm kind of busy this whole month. I will come back in September and merge all the changes. Please wait until then.
Thanks for the heads-up, @sarsamurmu, and please no rush at all!