Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Widgets #44

Open
iyxan23 opened this issue Nov 29, 2020 · 1 comment
Open

Custom Widgets #44

iyxan23 opened this issue Nov 29, 2020 · 1 comment
Labels
enhancement New feature or request future version Current issue will be fixed in the future version
Milestone

Comments

@iyxan23
Copy link
Member

iyxan23 commented Nov 29, 2020

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);
@iyxan23 iyxan23 added enhancement New feature or request future version Current issue will be fixed in the future version labels Nov 29, 2020
@ToastcodeDev
Copy link

300px-Android_Oreo_8.1_logo.svg.png

@ryenyuku ryenyuku added this to the 4.0.0 milestone Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request future version Current issue will be fixed in the future version
Projects
None yet
Development

No branches or pull requests

3 participants