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

Fixed layout measurements - added "dp" as default #20

Merged
merged 2 commits into from Feb 2, 2013

Conversation

pec1985
Copy link
Contributor

@pec1985 pec1985 commented Feb 1, 2013

Test code:

var win = Ti.UI.createWindow();
var btn = Titanium.UI.createButton({
    color:'#fff',
    top: 100,
    backgroundColor:'red',
    width: '200dp',
    height: '60dp'
});
win.add(btw);
win.open();

if ((value.find("mm") != std::string::npos) || (value.find("cm") != std::string::npos) ||
(value.find("em") != std::string::npos) || (value.find("pt") != std::string::npos) ||
(value.find("in") != std::string::npos) || (value.find("px") != std::string::npos) ||
(value.find("dp") != std::string::npos) || (value.find("dip") != std::string::npos)) {
units = value.substr (value.size() - 2 , 2);
parsedValue = atof(value.substr(0, value.size() - 2).c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will parse correctly if the unit is "dip". It's 3 characters not 2 so you'll just get "di".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! ok, oops.

@joshthecoder
Copy link
Contributor

Reviewed code and tested. Accepted.

joshthecoder added a commit that referenced this pull request Feb 2, 2013
Fixed layout measurements - added "dp" as default
@joshthecoder joshthecoder merged commit 5af47ec into appcelerator-archive:master Feb 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants