Giter Site home page Giter Site logo

dspec's People

Contributors

devunwired avatar lucasr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dspec's Issues

Support for mathematical calculations

Adding support for basic calculations in the size and offset fields would improve readablilty:

{
    "keylines": [
        {
            "offset": 56,
            "from": "TOP"
        }, {
            "offset": 56 + 24,
            "from": "TOP"
        }, {
            "offset": 56 + (2 * 24),
            "from": "TOP"
        }
    ]
}

Support for percentage widths

It's be great to have percentage values supported in the offset and size fields.

For example:

{
"keylines": [
    {
        "offset": 50%,
        "from": "LEFT"
    }, {
        "offset": 50%,
        "from": "TOP"
    },
}

DesignSpec as Drawable.

What about Drawable adapter to design spec?
I see following use case for it.

public class DesignSpecDrawable extends Drawable {
    private final DesignSpec mDesignSpec;

    public DesignSpecDrawable(DesignSpec designSpec) {
        mDesignSpec = designSpec;
    }

    @Override
    public void draw(Canvas canvas) {
        if (mDesignSpec != null) {
            mDesignSpec.draw(canvas);
        }
    }

    /* ... */
}
setContentView(R.layout.main_activity);
/* Resolve views here */

View decorView = getWindow().getDecorView();
mDesignSpec = DesignSpec.fromResource(decorView, R.raw.main_activity_spec);
DesignSpecDrawable drawable = new DesignSpecDrawable(mDesignSpec);
decorView.getOverlay().add(drawable); 

The main advantage that is dspec now controlled from the code. It means we can now easily make it conditional, like:

if (BuildConfig.USE_DSPEC) {
  // ...
}

So it can be stripped from production builds with ease.

However, there is one problem ViewOverlays are only available since API 18 (JB 4.3). Although, we can still use it below this API level by setting it as background, or ImageView or so on, which is not so convient.

Cannot find dspec dependecy

My android studio cannot find dspec dependency, the aar file didn't help me. Is there a solution for this?

Set different colors

It could be great if we have the possibility to assign a specific color to each keyline and spacing.

Thanks!

Hugo

Unable to include using Gradle

compile 'org.lucasr.dspec:dspec:0.1.1'

Including dspec in a project using Gradle doesn't seem to work. Am I doing anything wrong?

addSpacing bug

addSpacing calls specifying DesignSpec.From.RIGHT do not render for some reason. To replicate, try addSpacing(0, 16, DesignSpec.From.RIGHT).

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.