GithubHelp home page GithubHelp logo

thatcakeid / os-thm-sketchware Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 65 KB

os-thm Implementation for sketchware by using static methods.

Home Page: https://osthm.thatcakeid.com

License: GNU General Public License v3.0

Java 100.00%
theme managing-themes sketchware theme-manager java

os-thm-sketchware's Introduction

os-thm Logo

os-thm-sketchware

os-thm implementation for sketchware.

What is os-thm?

os-thm is a simple library used to manage themes that can be applied globaly.

Original GitHub Repository

NOTE: THIS REPOSITORY IS DEPRECATED, USE OS-THM-SKETCHWARE SKETCHUB PROJECT INSTEAD.

Implementing os-thm

There are 2 ways of implementing os-thm to your sketchware app:

  1. Injecting the osthm library
  2. Using ASD

Injecting the osthm library

To implement os-thm to your sketchware app,

  • Add your package in the first line of osthm.java

    Example:

    package my.newproject23.yay;
    
    // osthm.java contents //
  • Grant READ and WRITE External storage permission.

  • Inject the osthm.java file, and ignore the os-thm-sketchware-asd.java

And you're all set!

Using ASD

  • Create a new activity named osthm
  • Grant READ and WRITE External storage permission.
  • Add an ASD block in onCreate ontop of the File block you placed
  • Copy and paste the os-thm-sketchware-asd.java file into the ASD, and ignore the osthm.java

To grant storage permission, you can use external tools, or write something in a random temporal file and then delete that file.

Note: We suggest you to check if the user denied the dialog because if the permission is denied, os-thm will not work.

And you're all set!

Using os-thm

Here is an example code to apply theme to your sketchware app:

Note: For the people using ASD to implement os-thm, replace the osthm word into OsthmActivity, Because sketchware is concating the word Activity after the given text, and uppercasing the first letter.

// Put this in onStart

// Getting current applied theme
osthm.Theme currentTheme = osthm.getCurrentTheme();

// Applying color to the ActionBar
getSupportActionBar().setBackgroundDrawable(new android.graphics.drawable.ColorDrawable(currentTheme.colorPrimary));

// Applying color to the StatusBar
// Check if the android version is 5+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    android.view.Window window = getWindow();
    window.addFlags(android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.setStatusBarColor(currentTheme.colorPrimaryDark);
}

// Applying color to the FAB
_fab.setBackgroundTintList(android.graphics.drawable.ColorDrawable.valueOf(currentTheme.colorAccent));

// Applying ripple color to the FAB
_fab.setRippleColor(currentTheme.colorControlHighlight);

// etc.

Don't understand what are the colors means? Click Here

Still don't understand? Download the os-thm Theme Manager, and try playing around with the Theme Editor to determine which colors point to which.

Have questions? Join our discord server.

Documentation written by Iyxan23.

(c) Copyright 2020 ThatCakeID

os-thm-sketchware's People

Contributors

iyxan23 avatar ryenyuku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

oleglr

os-thm-sketchware's Issues

jelp

what the fuck is github please help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.