Hello all! So i started working in Kodular Extension IDE yesterday and have been working non stop to learn as much as possible. Ive also taken 5 courses on the basics to java so I have a little bit of knowledge to get me started. Ive already created a basic extension and it worked fine. Im trying to push my skills a little more but need some advice. My goal is to create a a Dark Theme, Light Theme extension. Heres my code posted below.
~ CODE ~
package io.makeroid.jc1bryan_82242.Confidential;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.DesignerProperty;
import com.google.appinventor.components.annotations.PropertyCategory;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.annotations.UsesPermissions;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.common.PropertyTypeConstants;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
/import java.util.Scanner;/
@DesignerComponent(
version = 1,
description = “Extension description coming soon!”,
category = ComponentCategory.EXTENSION,
nonVisible = true,
iconName = “https://ide.kodular.io/assets/logo.png”)
@SimpleObject(external = true)
public final class Confidential extends AndroidNonvisibleComponent {
/**
- Creates a new component
*/
public Confidential(ComponentContainer container) {
super(container.$form());
}
private String DarkColor, LightColor;
DarkColor = “Black”;
LightColor = “White”;
@SimpleFunction(description = “Block for Light Theme”)
public String SetLightTheme(String LightTheme) {
LightColor=LightTheme;
String res = LightColor;
GotValue(res);
}
@SimpleEvent(description="")
public void GotValue(String result){
EventDispatcher.dispatchEvent(this, “LightTheme”, result);
}
@SimpleFunction(description = “Block Description Coming Soon”)
public void DarkTheme() {
EventDispatcher.dispatchEvent(this, “DarkTheme”);
}
@SimpleFunction(description = “Block Description Coming Soon”)
public void Settings() {
EventDispatcher.dispatchEvent(this, “Settings”);
}
@SimpleFunction(description = “Block Description Coming Soon”)
public void Reset() {
EventDispatcher.dispatchEvent(this, “Reset”);
}
/* Where do I put this?? */
If (LightColor == “White”) {
System.out.println(“Hi”)
}
}
Ive gotten pretty far which is good. Basically when the user presses a button they can choose to flip between dark mode and light mode. I cant figure out how to make the input for the themes color only (not text or number). Shouldnt be hard if i take more time. Also If the user chooses light theme the background would change and vise versa for dark theme. Ive gotten pretty far on my own just need a push.
Any help is great! Advice, encouragement, suggestions is greatly appreciated. 1 thing though – Dont give me the whole code. I want to really learn on my own. Again just small pieces im missing. Thanks everyone.