To get to the assets blocks
I have to choose one of the components in my project and get it there. Would it be possible to generate this block if I drag and drop one of the files from the media pane?
To get to the assets blocks
I have to choose one of the components in my project and get it there. Would it be possible to generate this block if I drag and drop one of the files from the media pane?
@Peter, that's certainly an interesting idea. In theory it's possible but it will take a bit of work to make it happen.
Hi Peter! Thanks for the suggestion, I think it sounds like a cool idea! As such, I filed an issue to track it. If you have any further things you'd like to add, feel free to leave a comment there.
can we actually do something like this if we wanna make our own?
If you follow Beka's link above to her final GSOC writeup there is a link from that page about how to add your own helper blocks for components (which should include extensions). Note that while her work has been merged into ucr
, it won't be publicly available in the production version of App Inventor until sometime mid-July when our next release goes out.
Yep! Like Evan said, this should work with extensions. I tested it before putting up the PR, so unless something in App Inventor has changed since then it should be good. Extension compatibility was one of the priorities for the project =)
Here is the documentation for adding helper blocks (all kinds) to your component. And here is the document specifically for static dropdown blocks (which are a bit more involved hehe). Best of luck! If you have further questions about it feel free to message me or post a new message in the extension developer category
Oh and if you make somethig cool with it, send me a link once the helper blocks are in the production version of App Inventor! I'd love to see what people make
Best,
--Beka
the main thing is where is the OptionList and Default annotation inside common
Hmmm I'm not sure if this is what you're asking, but the files live here. Currenlty they're only on the ucr branch though, not master =)
I absolutely like that this was able to merged *š¤*, can't wait to add it to my extensions!
i just wanna know what to import for IDropdown interface if you can find it in docs then pls show it
I am not sure but there could be an annotation same like methods and events
i saw the code but i did not saw?
In the final implementation IDropdown
was renamed to OptionList<>
. You can use it as specified here:
import com.google.appinventor.components.common.OptionList;
public enum Animal implements OptionList<String> {
// Enum values etc...
}
Best wishes =)
Beka
when i used your code to make extension i got error -
[javac] An annotation processor threw an uncaught exception.
[javac] Consult the following stack trace for details.
[javac] java.lang.IllegalArgumentException: OptionList Class: com.aktech.test.Animal is not available. Make sure that it is available to the compiler.
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.tryAddOptionList(ComponentProcessor.java:1923)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.optionListToHelperKey(ComponentProcessor.java:1898)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.hasOptionListHelper(ComponentProcessor.java:1865)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.elementToHelperKey(ComponentProcessor.java:1823)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.varElemToParameter(ComponentProcessor.java:2075)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.processMethods(ComponentProcessor.java:2524)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.processComponent(ComponentProcessor.java:1709)
[javac] at com.google.appinventor.components.scripts.ComponentProcessor.process(ComponentProcessor.java:1417)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:794)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:705)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1035)
[javac] at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1176)
[javac] at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:523)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:381)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:370)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:361)
[javac] at com.sun.tools.javac.Main.compile(Main.java:56)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:57)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1388)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:1117)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at java.util.Vector.forEach(Vector.java:1277)
[javac] at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:391)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at org.apache.tools.ant.Target.execute(Target.java:449)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:470)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
[javac] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:36)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
[javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:437)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
[javac] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javac] at java.lang.reflect.Method.invoke(Method.java:498)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
[javac] at org.apache.tools.ant.Task.perform(Task.java:350)
[javac] at org.apache.tools.ant.Target.execute(Target.java:449)
[javac] at org.apache.tools.ant.Target.performTasks(Target.java:470)
[javac] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
[javac] at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
[javac] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[javac] at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
[javac] at org.apache.tools.ant.Main.runBuild(Main.java:827)
[javac] at org.apache.tools.ant.Main.startAnt(Main.java:223)
[javac] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
[javac] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
BUILD FAILED
C:\AppinventorShadowBlock\appinventor-sources-ucr\appinventor\build.xml:46: The following error occurred while executing this line:
C:\AppinventorShadowBlock\appinventor-sources-ucr\appinventor\components\build.xml:217: The following error occurred while executing this line:
C:\AppinventorShadowBlock\appinventor-sources-ucr\appinventor\build-common.xml:125: Compile failed; see the compiler error output for details.
I'm sorry man, I'm quite busy with other projects at the moment and I'm not set up for App Inventor development right now If you start a new thread with info about what you're doing and that stack trace I'm sure someone more active can help you out =)
Sorry I can't be more help Best of luck on your project!
--Beka
Do your sources even have the code of her pr ? U will need to manually add it for now as I think it is not yet merged with master
i am using her sources only