Skip to content

Conversation

@moertel
Copy link
Contributor

@moertel moertel commented Jan 21, 2025

This PR is a big refactoring accomplishing two things:

  1. All information that we have about launchers is now neatly encapsulated. Most notably, calling apps can use these methods:
    • supportsIconPacks
    • supportsDirectApply
    • supportsManualApply
    • applyDirectly
    • applyManually
  2. 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 the MainActivity but 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.

@moertel moertel changed the title Enable use of CandyBar as a library [WIP - DO NOT MERGE] Enable use of CandyBar as a library Jan 21, 2025
@moertel moertel marked this pull request as draft January 21, 2025 21:35
@moertel moertel changed the title [WIP - DO NOT MERGE] Enable use of CandyBar as a library Enable use of CandyBar as a library Jan 21, 2025
@moertel
Copy link
Contributor Author

moertel commented Jan 21, 2025

@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.

@sarsamurmu
Copy link
Collaborator

@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

@GitGitro GitGitro mentioned this pull request Feb 6, 2025
moertel added 14 commits May 28, 2025 17:56
The Candybar default behaviour is to close the activity once a
meaningful action has been done, e.g. the icon pack has been applied or
the user tapped on a dialog option. This might not always be desirable,
so we provide a DEFAULT_CALLBACK which preserves what Candybar is doing
but also allows overrides.
Unfortunately, enums behave like singletons throughout the code. This is
nice when they're truly immutable but we need to store the actual
installed package (if there is one), so we can use applyDirectly() and
applyManually() without issues.
@moertel
Copy link
Contributor Author

moertel commented Jul 20, 2025

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:

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.

@moertel moertel marked this pull request as ready for review July 20, 2025 11:55
@sarsamurmu
Copy link
Collaborator

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.

@moertel
Copy link
Contributor Author

moertel commented Jul 20, 2025

Thanks for the heads-up, @sarsamurmu, and please no rush at all!

@sarsamurmu sarsamurmu merged commit ab33474 into zixpo:main Aug 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants