Skip to content

An App Inventor extension to add full support for creating any type of component at runtime, in your app.

License

Notifications You must be signed in to change notification settings

AkshatDeveloper06/DynamicComponents-AI2

 
 

Repository files navigation

Icon

DynamicComponents-AI2 Extension

forthebadge

Maintainability

Fully supported Dynamic Components extension for MIT App Inventor 2. It is based on Java's reflection feature, so it creates the components by searching for a class by just typing its name. So it doesn't have a limited support for specific components, because it supports every component which is ever added to your App Inventor distribution!

So if you use Kodular, you will able to create all Kodular components, if you use App Inventor, you will able to create all App Inventor components and so on. Extension components are supported too!

⚠ The beta branch will be reset after every release. So stay on the main branch if you don't know what you do.


Asynchronous support

This extension can create components asynchronously or synchronously based on your choice. If you don't want to block the main app during creating a bunch of components, go to the Designer (after importing the extension) and select between "UI" (asynchronous) and "Main" (synchronous).

🧩 Blocks

Block Description
Creates a new dynamic component. It supports all component that added to your current AI2 distribution. componentName parameter can have these values:

Name of the component.
✅ Doesn't require to add existing component.
❌ Only components can be created.
Block of existing component to create new one from it.
❌ Requires a existing component.
✅ Extensions can be created also.
Full class name of the component.
✅ Doesn't require to add existing component.
✅ Extensions can be created also.

To learn the class name of the component use GetName block.
Changes ID of one of created components to a new one. The old ID must be exist and new ID mustn't exist.
When replacing an ID, it will loop through ALL IDs and replace each one that contains the old ID! Even if the ID you're wanting to replace is "Timmy", but there are IDs like "Timmy-truck". To be clear again, only "Timmy" from "Timmy-truck" will be replaced, the "-truck" part will stay the same!
Creates components from JSON string. Refer to the Wiki about creating your own templates.
Removes the component with specified ID from screen/layout and the component list. So you will able to use its ID again as it will be deleted.
Set a property of a component by typing its property name. Can be known as a Setter property block.
It can be also used to set properties that only exists in Designer. It works for common types. For other values, you should use Any Component blocks.
Same as SetProperty block, but for setting the properties with Dictionary.
Dictionary keys equal to property names and Dictionary values equal to property value.
Returns the component's itself for modifying purposes. ID must be a valid ID which is added with Create block.
ID --> Component
Returns the ID of component. Component needs to be created by Create block. Otherwise it will return blank string. Also known as reverse of the GetComponent block.
Component --> ID
Gets the position of the component according to its parent arrangement. Index starts from 1.
Sets the position of the component according to its parent arrangement. Index starts from 1. Typing 0 (zero) will move the component to the end.
Moves the component to an another arrangement.
Get a property value of a component by typing its property name. Can be known as a Getter property block. It can be also used to get properties that only exists in Designer.
Get meta data about the specified component.
Get meta data about events for the specified component.
Get meta data about properties for the specified component.
Get meta data about functions for the specified component.
Returns the last component's ID.
Returns all used IDs of current components as App Inventor list.
Makes a random unique UUID. Use this block in Create block if component ID is not required for you.
Returns 'true' if component has created by Dynamic Components extension. Otherwise, 'false'.
Calls a method of any component. If the return value is not important for you, use with evaluate but ignore result block.
Returns the version of the extension.
Returns the version name of the extension.
Raises after Schema has been created with Schema block.
Raises after a component has been created.

🔨 Building

You will need:

  • Java 1.8 (either OpenJDK or Oracle)
  • Ant 1.10 or higher

Then execute ant extensions in the root of the repository.

🏅 License

Source code is licensed under MIT license. You must include the license notice in all copies or substantial uses of the work.

About

An App Inventor extension to add full support for creating any type of component at runtime, in your app.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 74.6%
  • Python 25.4%