Giter VIP home page Giter VIP logo

wffdsl's Introduction

WFF DSL

Kotlin DSL to generate XML based Watch Face Format (WFF) for Wear OS : https://developer.android.com/training/wearables/wff/watch-face

Example of what you can do with it

This is Digitalog Sharp, built with Splitties WFF DSL. Just $3.5 on the Play Store.

Disclaimer

The API is likely to break in future releases. That shouldn't prevent you from trying it, but be warned that future upgrades might require code changes. Also, keep in mind that WFF is quite young and the renderer has bugs. It is unfortunately out of my control.

Feedback on the API and ideas are welcome.

Contributions can be considered, just let me know what you have in mind, or if it's just a small fix, if you ever find a mistake, you can send a PR directly.

State of the project

  • 100 % of the tags and attributes are implemented
  • Typed arithmetic expressions
  • Usable
  • Higher-level extensions
  • Publication on Maven Central & Gradle Plugins Portal
  • Starter project
  • Documentation
    • Getting started
    • Diverse examples
    • Usage doc
    • KDoc website
  • Developer experience
    • Stronger typing of string resources
    • Stronger typing of drawable/image resources
    • Generation of typed resources based on files in the directories
    • Android Studio / IntelliJ IDEA plugin
      • Colors in the gutter + picker
      • Automatic refresh of typed resources
      • New project wizard
    • Enforce occurrence limits and required child elements
    • Produce warnings (e.g. when Thumbnail is not used)
    • Higher level libraries (building blocks for effect X or Y)

Contributing

If you want to contribute to anything, feel free to reach out in the issues (existing or new one).

wffdsl's People

Contributors

louiscad avatar yopox avatar

Stargazers

Arsen Tagaev avatar seungwan avatar symmetricalboy avatar  avatar Anna Bernbaum avatar Lucian Boaca avatar Ariel avatar  avatar Daniele Bonaldo avatar amoledwatchfaces™ avatar Yuri Schimke avatar Benedikt Gilbert avatar Aditya Vaidyam avatar Chetan Gupta avatar

Watchers

 avatar Ariel avatar symmetricalboy avatar

wffdsl's Issues

Compilation Error on large watchface

I can refactor, but reporting this as it was confusing

exception: exception: java.lang.RuntimeException: Error generating class file xxx.class (compiled from [/Users/yschimke/StudioProjects/xxx]): Method too large: xxxx.xxx (Lsplitties/wff/WatchFaceDsl;)Ljava/lang/Object;
exception: 	at org.jetbrains.kotlin.codegen.ClassFileFactory$OutputClassFile.asByteArray(ClassFileFactory.java:310)
exception: 	at org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAll(outputUtils.kt:33)
exception: 	at org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAllTo(outputUtils.kt:47)
exception: 	at org.jetbrains.kotlin.cli.common.output.OutputUtilsKt.writeAll(outputUtils.kt:52)

No name on ComplicationSlot

From a generated watchface XML

        <ComplicationSlot
            name="AOD Complication_0"
            alpha="255"
            displayName="AOD Complication"
            height="49"
            isCustomizable="TRUE"

Feature Request: Layout Simplification

When converting from WatchFaceStudio generated XML, ways to simplify.

At it's simplest, warn on redundant default values, such as Height/Width matching parent, or default alpha.

But potentially also simpler layout APIs than width/height/x/y. Not sure what this is.

Check localisation params

Generated XML has

                    <PartText name="Minutes_dc23" alpha="255" height="203" pivotX="0.5" pivotY="0.5" width="189"
                        x="214" y="7">
                        <Localization calendar="GREGORIAN" />

but timeZone is required in WffDsl

                            partText(height = 203, width = 189, x = 214, y = 7) {
                                localization(calendar = "GREGORIAN", timeZone = "SYNC_TO_DEVICE")

gradle assembleDebug and installDebug fail

A problem was found with the configuration of task ':xxx:generateWatchFaceXmlDebug' (type 'WatchfaceAppPlugin.ResCreatorTask').
  - In plugin 'org.splitties.wff.watchface-app' type 'splitties.wff.WatchfaceAppPlugin.ResCreatorTask' property 'inputDirectory' specifies directory '/Users/yschimke/StudioProjects/xxx/build/splitties/wff-dsl/builder-output' which doesn't exist.

Support publishing to maven local after clean checkout

Fails with

> Cannot perform signing task ':plugins:gradle:watchface-app:signPluginMavenPublication' because it has no configured signatory

Workaround is

internal fun SigningExtension.trySignAll() {
    isRequired = false
...

Expressions with parenthesis are not parsed correctly

Hi!
Very good job for developing this. I like the operator overloading feature, but I found a problem where expressions have parenthesis. The following snippet

    expression(name = "my_expr") {
      (SourceType.Time.HOUR_1_24 `==` 1) `||` (SourceType.Time.HOUR_1_24 `==` 13)
    }

generates

<Expression name="my_expr">[HOUR_1_24] == 1 || [HOUR_1_24] == 13</Expression>

while it was expected to generate

<Expression name="my_expr">([HOUR_1_24] == 1) || ([HOUR_1_24] == 13)</Expression>

The first one, without parenthesis, is not evaluated correctly. This happens with all of the other operators. One solution would be to add parenthesis for all operator arguments. I don't know if it is possible to overload the () operator (not invoke).

Redesign to not depend on kotlinx.html

We can leverage context receivers and other Kotlin features to produce a cleaner API with clearer scoping, context awareness (more default parameter values for example), and also bring more checks.

nodes to implement

  • BitmapFonts
  • Metadata
  • Scene
  • WatchFace
  • clock
    • AnalogClock
    • DigitalClock
    • HourHand
    • MinuteHand
    • SecondHand
    • Sweep
    • Tick
    • TimeText
  • common
    • attributes
      • ArithmeticExpression
      • SourceType
    • transform
      • Animation
      • Gyro
      • Transform
    • variant
      • Variant
    • Condition
    • Launch
    • Localization
    • ScreenReader
  • complication
    • Bounding
    • Complication
    • ComplicationSlot
    • DefaultProviderPolicy
  • group
    • configuration
      • BooleanConfiguration
      • ListConfiguration
    • part
      • animatedImage
        • AnimatedImage
        • AnimatedImages
        • AnimationController
        • PartAnimatedImage
        • SequenceImage
        • Thumbnail
      • draw
        • gradient
          • LinearGradient
          • RadialGradient
          • SweepGradient
        • shape
          • Arc
          • Ellipse
          • Line
          • Rectangle
          • RoundRectangle
        • style
          • Fill
          • Stroke
        • PartDraw
      • image
        • imageFilter
          • HsbFilter
          • ImageFilters
        • Image
        • Images
        • PartImage
      • text
        • decoration
          • OutGlow
          • Outline
          • Shadow
          • StrikeThrough
          • Underline
        • formatter
          • InlineImage
          • Lower
          • Template
          • Upper
        • BitmapFont
        • Font
        • PartText
        • TextCircular
        • Text
    • Group
  • userConfiguration
    • BooleanConfiguration
    • ColorConfiguration
    • ListConfiguration
    • UserConfigurations

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.