jaredrummler / Cyanea

A theme engine for Android
Apache License 2.0
1.45k stars 144 forks source link

Consider using LinkedHashSet instead of HashSet to preserve the ordering of CyaneaViewProcessor to make it possible to override default processors #82

Open K1rakishou opened 4 years ago

K1rakishou commented 4 years ago

Right now all processors are being added to a HashSet which reorders them randomly, due to how hashsets work, and it becomes impossible to override a default CyaneaViewProcessor because a custom processor may end up processed earlier than the default one.

Let's say I want to override TextViewProcessor to use a completely different color. Right now it's impossible because the order of processors is unpredictable so it may work for one processor but won't work for another. Using LinkedHashSet for CyaneaViewFactory.processors should fix this little issue since all custom processors are already added to the end of the list in CyaneaDelegateImplBase.getViewProcessors().

Maybe there is already a mechanism for that but I couldn't find it.