Skip to content

Commit

Permalink
Version - v2.3.0 (#67)
Browse files Browse the repository at this point in the history
Co-authored-by: Kumaraswamy B G <71964026+XomaDev@users.noreply.github.com>
Co-authored-by: Nathan <43486313+hammerhai@users.noreply.github.com>
  • Loading branch information
3 people committed Apr 3, 2024
1 parent 676f519 commit d3f09bf
Show file tree
Hide file tree
Showing 10 changed files with 660 additions and 450 deletions.
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"git.detectSubmodules": true,
"java.project.referencedLibraries": [
"lib/**/*.jar"
],
"java.compile.nullAnalysis.mode": "automatic",
"[java]": {
"editor.tabSize": 2,
"files.trimTrailingWhitespace": true,
"editor.trimAutoWhitespace": true
},
"[xml]": {
"editor.tabSize": 2
},
"indentRainbow.excludedLanguages": [
"java"
]
}
60 changes: 39 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
![Icon](assets/icon.png)
# <img src="src/com/yusufcihan/DynamicComponents/aiwebres/icon.png" height="28"> &nbsp;Dynamic Components for AI2

# DynamicComponents-AI2 `Extension`
An extension for [MIT App Inventor 2](https://appinventor.mit.edu/) applications that allows to create components dynamically by its name at runtime with blocks.

[![forthebadge](https://forthebadge.com/images/badges/its-not-a-lie-if-you-believe-it.svg)](https://forthebadge.com)
It is based on Java's reflection feature, so this allows us to create instances of classes (components) by its name. Also, unlike other extensions that create components in runtime, this extension doesn't keep a list of all component names because it supports every component which is ever added to your App Inventor distribution by nature. So, not only can you dynamically create common components like `Button`, but you can also create `DatePicker` components.

[![Maintainability](https://api.codeclimate.com/v1/badges/31e4cd31de1bd0e186c8/maintainability)](https://codeclimate.com/github/ysfchn/DynamicComponents-AI2/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).

<img src="assets/other/thread_choice.png" height="150">
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. Creating instances of other extensions are also supported.

## 🧩 Blocks

Expand Down Expand Up @@ -49,7 +35,7 @@ This extension can create components asynchronously or synchronously based on yo
</table>
</td>-->
<td>
Creates a new dynamic component. It supports all component that added to your current AI2 distribution.
Creates a new dynamic component. It supports all component that added to your current AI2 distribution. Note that you can't create components in Screen directly, you will need to have an arrangement beforehand inside a Screen to do that.
<code>componentName</code> parameter can have these values:
<br><br>
<table>
Expand All @@ -68,6 +54,15 @@ This extension can create components asynchronously or synchronously based on yo
</table>
</td>
</tr>
<!-- CREATE EPHEMERAL -->
<tr>
<td align="right">
<img src="assets/blocks/method_createephemeral.png">
</td>
<td>
Creates a new dynamic component in given container (arrangement/canvas) and return it without saving it to the created components list, so it won't be attached to an ID. Note that you can't create components in Screen directly, you will need to have an arrangement beforehand inside a Screen to do that.
</td>
</tr>
<!-- CHANGE ID -->
<tr>
<td align="right">
Expand Down Expand Up @@ -131,7 +126,16 @@ This extension can create components asynchronously or synchronously based on yo
</table>
</td>-->
<td>
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.
Removes the component with specified ID from screen and the component list. So you will able to use its ID again as it will be deleted.
</td>
</tr>
<!-- REMOVE COMPONENT -->
<tr>
<td align="right">
<img src="assets/blocks/method_removecomponent.png">
</td>
<td>
Removes a component from the screen. It doesn't need to be created by this extension. But if the given component is dynamically created by this extension, this block will also de-register its ID so its ID can be reused for other components that are going to be created later.
</td>
</tr>
<!-- SET PROPERTY -->
Expand Down Expand Up @@ -431,14 +435,28 @@ This extension can create components asynchronously or synchronously based on yo
</tr>
</table>

### 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).

<img src="assets/other/thread_choice.png" height="150">

## 🔨 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.
After cloning the repository, make sure to fetch submodules first:

```
git submodule update --init --recursive
```

Then execute `ant extensions` in the root of the repository to build the extension.

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

Expand Down
Binary file added assets/blocks/method_createephemeral.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/blocks/method_removecomponent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icon.png
Binary file not shown.
Loading

0 comments on commit d3f09bf

Please sign in to comment.