gmatyszczak/screen-generator-plugin

Multiple Categories

Closed this issue · 10 comments

Hi Grzegorz,

This is absolutely incredible work, and this is something I was looking for for quite some time. Thank you for taking the time to build it, and also for making it open source.

I was thinking, one more great feature here could be having multiple categories for file creation.

For example, I could have a different template for my files for Activity creation using MVVM, and I could have a different set for file templates for a RecyclerView Adapter.

Maybe, we could have a dropdown to select the Category at the very top, which would internally contain completely different templates for all files.

I'm trying to work on the same thing with your open source code, and if I do succeed I will go ahead and raise a PR for the same.

Hi Rachit,

I really like the idea, sounds like a good enhancement!

If you started working on this, please go ahead and create a PR whenever you're ready :) Also if you need some help or have any questions, don't hesitate to ask.

Hey Grzegorz,

I've created the PR. It is by no means very well written, it's more of a quick fix.
I've not written any test cases yet, and there is a known issue that the Settings are being persisted even when the user clicks "Cancel" in the settings dialog. I've not been able to figure out the cause behind this issue.

Please give the PR / branch a look and it would be great if we could connect and continue this discussion over email.

There is one more change I've done, wherein if a template has a package name which is different from the original package - for example package %packageName%.custom.path - the directory path for customPath would also be created and the files would be moved to those directories.

So in the above example, the directories "custom" and "path" would be created, and the file would be placed inside "path" directory.

Hope that makes sense.

How do I get these changes?

Hi BitMobix.
If you share your email ID, I can send you the updated version.. However, it's not foolproof, and there are some bugs here and there.. Also, no test cases are written for this part of code yet.

I understand. Very sorry. I thought it was ready).

Since now in Android Studio 4.1 it is no longer possible to use templates, and this plugin is very cool.

It is strange that it is not so popular

Hi @rayzone107, these multiple categories are AWESOME!
I've been forked your branch and fix bug here and there and modified it a little bit for personal and some of my colleagues use. I've been using it on daily basis and no major issues so far. Perhaps I can help with the unit test and some of the bugs. Just let me know if you need a helping hand!

It took a while but requested feature was officially added to v1.2.0 :)

There are couple more features like custom variables for each category, related android component, subdirectory and source set for each screen element.