lucasr / dspec Goto Github PK
View Code? Open in Web Editor NEW[DEPRECATED] Define and render UI specs on top of your Android UI
License: Apache License 2.0
[DEPRECATED] Define and render UI specs on top of your Android UI
License: Apache License 2.0
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"
}
]
}
So that dspec users can implement their spec input format whenever necessary.
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"
},
}
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.
My android studio cannot find dspec dependency, the aar file didn't help me. Is there a solution for this?
It could be great if we have the possibility to assign a specific color to each keyline and spacing.
Thanks!
Hugo
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 calls specifying DesignSpec.From.RIGHT
do not render for some reason. To replicate, try addSpacing(0, 16, DesignSpec.From.RIGHT)
.
Can you explain why does it require ics?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.