The ToolBox extension is a powerful utility toolkit designed to simplify common app development tasks and enhance user interaction in Kodular projects. With this extension, developers gain access to a versatile set of features, including dynamic text animation, smart variable replacement, and customizable case-result logic—all in one compact component.
Specifications
Package: com.syntax.toolbox Size: 7.98 KB Minimum API Level: 7 Updated On:2025-04-29T18:00:00Z Built & documented using:FAST-CLI
Features Overview
Animated Text Transitions
Animate text updates in a TextView with a smooth vertical slide and fade effect.
Automatically detects and animates only when the text changes.
Makes UI changes feel modern and responsive.
Dynamic Variable Parsing
Define dynamic variables with SetVariable(tag, value).
Parse any string and replace placeholders like %tag% with their corresponding values using ParseText(text).
Ideal for templating, localization, or dynamic content generation.
Custom Case–Result Logic (Switch Case Alternative)
Add case mappings using AddCase(key, value) and define a fallback using SetDefaultValue(value).
Retrieve results using GetResult(key), which automatically fires an event (WhenResultFound) indicating whether the default was used.
Optional SetAutoClear(true) allows one-time use logic (useful in state-driven apps).
Case Management
HasCase(key) to check for the presence of a case.
GetAllCases() returns a list of all keys.
Clear() resets all cases and the default value.
Practical Use Cases
Smoothly update chat messages, headlines, or dynamic labels.
Build localized or customizable strings for different users.
Create simplified decision trees or response systems.
Replace cluttered “if-then” or “select list” blocks with a cleaner case-result approach.
Events:
WhenResultFound
Triggered when a result is found.
Parameter
Type
key
any
value
any
isDefault
boolean
Methods:
SetTarget
Set the TextView component to animate
Parameter
Type
component
component
SetText
Animate text change
Parameter
Type
newText
text
SetVariable
Set a variable by tag and value
Parameter
Type
tag
text
value
text
ParseText
Parse text and replace %tag% with stored values
Parameter
Type
inputText
text
Return Type: text
AddCase
Add a case with a value.
Parameter
Type
key
any
value
any
SetDefaultValue
Set the default value if no case matches.
Parameter
Type
value
any
SetAutoClear
Set whether to automatically clear cases after GetResult.
how was the main items, Is in list or dictionary? already we have default blocks called dictionary is there. Why dont we prefer that instead of creating an extension?
it is a multi item extension ,not a spacific function or activity . it a switch-case statement like if-else if we have lot data then we use it.and a text slide animation and a join block replcement block. we add join block to add variable but i make it short like
variable name = kodular
result = hey, %name%!
result is "hey, kodular!"
then first you should give input to the extenstion then get the item
import java.util.HashMap;
public MyExtension(ComponentContainer container) {
super(container);
variablesMap = new HashMap<>();
}
// Method to set/update a variable
@SimpleFunction(description = "Set variable value")
public void SetVariable(String key, String value) {
variablesMap.put(key, value);
}
// Method to get a variable's value
public String GetVariable(String key) {
return variablesMap.getOrDefault(key, "");
}
public String getVariable(String key) {
return variableMap.getOrDefault(key, “”);
}
this one will work, based on input value if then case
// Suppose this is part of your extension class
private Map<String, String> variableMap = new HashMap<>();
// Method to get variable value
public String getVariable(String key) {
return variableMap.getOrDefault(key, "");
}
// Method where you perform switch-case logic
public void performLogic() {
String currentVal = getVariable("myVar");
switch (currentVal) {
case "value1":
// Handle value1
System.out.println("Handling value1");
break;
case "value2":
// Handle value2
System.out.println("Handling value2");
break;
default:
// Handle default case
System.out.println("Default case");
break;
}
}
ok thanks but now i want to get kodular variable
value by name of variable in java.user set varibale in kodualr buit-in initialize global name block but i want get this initialize global nameblock value in java.
In this case, as for my knowlege, may be i am unware if exits, my naswer is No, extensions cannot directly access or read internal default global or local variables unless you explicitly pass those values into the extension via method calls.