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

[TIMOB-24308] Android: Child-view's percent width incorrect of horizo… #8766

Merged
merged 2 commits into from Jan 27, 2017

Conversation

gimdongwoo
Copy link
Contributor

@gimdongwoo gimdongwoo commented Jan 20, 2017

JIRA: https://jira.appcelerator.org/browse/TIMOB-24308

Android : child view's percent width incorrect of horizontal layout parent view

Optional Description:

This error occurred at Ti.SDK 6.1.0.v20170103224205, 6.1.0.v20170111010012, 6.1.0.v20170112013001, etc.
But, not occurred at Ti.SDK 6.1.0.v20161222061413
Of course, there is no problem with the GA version.

This code has problem.
#8720
( https://jira.appcelerator.org/browse/TIMOB-24243 )

[Incorrect]
2017-01-20 6 43 24

[Correct]
2017-01-20 6 41 26

[Test Code]

var win = Ti.UI.createWindow({
  backgroundColor: '#fff',
  layout: "vertical"
});

// first row
var view = Ti.UI.createView({
  height: Ti.UI.SIZE,
  width: Ti.UI.FILL,
  layout: "horizontal",
  backgroundColor: "gray"
});

var view1 = Ti.UI.createView({
  width: "25%",
  height: 100,
  backgroundColor: "red"
});

var view2 = Ti.UI.createView({
  width: "25%",
  height: 100,
  backgroundColor: "green"
});

var view3 = Ti.UI.createView({
  width: "25%",
  height: 100,
  backgroundColor: "blue"
});

var view4 = Ti.UI.createView({
  width: "25%",
  height: 100,
  backgroundColor: "yellow"
});

view.add(view1);
view.add(view2);
view.add(view3);
view.add(view4);

// second row
var v = Ti.UI.createView({
  backgroundColor: 'red',
  width: Ti.UI.FILL,
  height: Ti.UI.SIZE,
  layout: 'horizontal'
});
var n = Ti.UI.createLabel({
  top: 0,
  text: '1.',
  backgroundColor: 'purple'
});
var t = Ti.UI.createLabel({
  text: 'Replenish the Uranium rod with dry ice every 6 hours.',
  width:  Ti.UI.FILL,
  backgroundColor: 'orange'
});

v.add([n, t]);

// third row
var third = Ti.UI.createView({
  backgroundColor: 'grey',
  left: 20, right: 20,
  width: Ti.UI.FILL,
  height: Ti.UI.SIZE,
  layout: 'horizontal'
});

function createItem(_text) {
  var wrap = Ti.UI.createView({
    backgroundColor:"#ffffff",
    width:Ti.UI.SIZE, height:31,
    left:3, right:3, top:4, bottom: 4,
    borderColor: "#ff5757", borderRadius: 15.5, borderWidth: 1
  });

  var labelWrap = Ti.UI.createView({
    width:Ti.UI.SIZE, height: Ti.UI.SIZE,
    left: 14, right: 14
  });

  var label = Ti.UI.createLabel({
    height : 18,
    width: Ti.UI.SIZE,
    wordWrap:false,
    color:"#ff5757", font: { fontSize: 14, fontWeight: 'regular' },
    textAlign: Ti.UI.TEXT_ALIGNMENT_CENTER, verticalAlign: Ti.UI.TEXT_VERTICAL_ALIGNMENT_CENTER,
    text: _text
  });

  labelWrap.add(label);
  wrap.add(labelWrap);

  return wrap;
}

third.add( createItem('#한자급수') );
third.add( createItem('#자유학기제') );
third.add( createItem('#기반학습') );
third.add( createItem('#많은수업시간') );
third.add( createItem('#레벨시스템') );
third.add( createItem('#담임제도') );

// add to win
win.add(view);
win.add(v);
win.add(third);

win.open();

@hansemannn
Copy link
Collaborator

Hey @gimdongwoo, is there a reason you closed the other PR?

@gimdongwoo
Copy link
Contributor Author

@hansemannn The two PRs are the same code as a result.
The more test cases I did, the more problems I found.
So I need to cleaned up the code, I had a lot of commits unnecessarily.

@garymathews garymathews self-assigned this Jan 20, 2017
@garymathews
Copy link
Contributor

@gimdongwoo Awesome, nice catch! Thanks for the contribution!

@gimdongwoo
Copy link
Contributor Author

@garymathews Thank you!

@lokeshchdhry
Copy link
Contributor

FR passed.
Child's views percentage width now renders correctly with layout is horizontal.
Ran the code from the ticket & this PR.

  1. Checked with portrait & landscape orientation.
  2. Checked if layout: vertical is affected.
  3. Checked by changing the width's of the views in the above code to check for any abnormalities.
  4. Checked on emulator.

Appc Studio : 4.8.1.201612050850
SDK Version : Local 6.1.0 & 6.0.2
Mac OS Version : 10.12.2
Xcode Version : Xcode 8.2.1 Build version 8C1002
Appc CLI AND Appc NPM : {"NPM":"4.2.9-1","CLI":"6.1.0"}
Ti CLI : 5.0.11
Alloy : 1.9.5
Node : v4.6.0
Device: 7.1.1Nexus 6P, 6.0.1 Nexus 6
Emulator: Android 5.1.1

@lokeshchdhry lokeshchdhry merged commit 341e09c into tidev:master Jan 27, 2017
@gimdongwoo gimdongwoo deleted the TIMOB-24308 branch January 31, 2017 05:33
@hansemannn hansemannn added this to the 6.1.0 milestone May 12, 2017
@gimdongwoo gimdongwoo restored the TIMOB-24308 branch May 22, 2017 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants