Custom Widgets
Opened this issue · 1 comments
iyxan23 commented
Custom Widgets, like qt and gtk. Basically, you can change how widgets (button, imageview, textview, slider, etc) are drawn on the screen by applying a theme.
Not only that, we can also add custom attributes to the custom widgets, making it very easy for the developer to set color for widgets in the xml code without messing around with the java code (except for the getCurrentTheme()
function, we still need that).
Example (note that this example code is for demonstration purposes, it is not the final version):
A piece of the XML Layout code:
<tw.osthm.widgets.Button
android:id="@+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:text="button"
osthm:foregroundColor="colorAccent"
osthm:textColor="colorBackgroundText"
osthm:shadowColor="colorShadow"
osthm:isShadowEnabled="true/false/default (theme dependant)"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Java code:
OsThmTheme currentTheme = osthmEngine.getCurrentTheme();
osthmLayout layout = new osthmLayout(MainActivity.this);
layout.apply(currentTheme);
ToastcodeDev commented