Merge pull request #20 from kmagiera/updates
Minor fixes in improvements in Java code.
This commit is contained in:
@@ -98,6 +98,15 @@ public class CSSNode {
|
|||||||
private CSSNode mParent;
|
private CSSNode mParent;
|
||||||
private MeasureFunction mMeasureFunction = null;
|
private MeasureFunction mMeasureFunction = null;
|
||||||
private LayoutState mLayoutState = LayoutState.DIRTY;
|
private LayoutState mLayoutState = LayoutState.DIRTY;
|
||||||
|
private int mTag;
|
||||||
|
|
||||||
|
public int getTag() {
|
||||||
|
return mTag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTag(int tag) {
|
||||||
|
mTag = tag;
|
||||||
|
}
|
||||||
|
|
||||||
public int getChildCount() {
|
public int getChildCount() {
|
||||||
return mChildren.size();
|
return mChildren.size();
|
||||||
@@ -151,7 +160,7 @@ public class CSSNode {
|
|||||||
* Performs the actual layout and saves the results in {@link #layout}
|
* Performs the actual layout and saves the results in {@link #layout}
|
||||||
*/
|
*/
|
||||||
public void calculateLayout() {
|
public void calculateLayout() {
|
||||||
resetLayoutResultRecursive();
|
layout.resetResult();
|
||||||
LayoutEngine.layoutNode(this, CSSConstants.UNDEFINED);
|
LayoutEngine.layoutNode(this, CSSConstants.UNDEFINED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,32 +209,33 @@ public class CSSNode {
|
|||||||
mLayoutState = LayoutState.UP_TO_DATE;
|
mLayoutState = LayoutState.UP_TO_DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void toStringWithIndentation(StringBuilder result, int level) {
|
||||||
public String toString() {
|
// Spaces and tabs are dropped by IntelliJ logcat integration, so rely on __ instead.
|
||||||
String layoutString = layout.toString();
|
StringBuilder indentation = new StringBuilder();
|
||||||
|
for (int i = 0; i < level; ++i) {
|
||||||
|
indentation.append("__");
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(indentation.toString());
|
||||||
|
result.append(layout.toString());
|
||||||
|
|
||||||
if (getChildCount() == 0) {
|
if (getChildCount() == 0) {
|
||||||
return layoutString;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutString += ", children: [\n";
|
result.append(", children: [\n");
|
||||||
|
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
for (int i = 0; i < getChildCount(); i++) {
|
||||||
String childString = getChildAt(i).toString();
|
getChildAt(i).toStringWithIndentation(result, level + 1);
|
||||||
childString = childString.replaceAll("\n", "\n\t");
|
result.append("\n");
|
||||||
layoutString += "\t" + childString + "\n";
|
|
||||||
}
|
}
|
||||||
|
result.append(indentation + "]");
|
||||||
layoutString += "]";
|
|
||||||
|
|
||||||
return layoutString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetLayoutResultRecursive() {
|
@Override
|
||||||
layout.resetResult();
|
public String toString() {
|
||||||
for (int i = 0; i < getChildCount(); i++) {
|
StringBuilder sb = new StringBuilder();
|
||||||
getChildAt(i).resetLayoutResultRecursive();
|
this.toStringWithIndentation(sb, 0);
|
||||||
}
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean valuesEqual(float f1, float f2) {
|
protected boolean valuesEqual(float f1, float f2) {
|
||||||
|
@@ -273,6 +273,10 @@ public class LayoutEngine {
|
|||||||
|
|
||||||
private static void layoutNodeImpl(CSSNode node, float parentMaxWidth) {
|
private static void layoutNodeImpl(CSSNode node, float parentMaxWidth) {
|
||||||
|
|
||||||
|
for (int i = 0; i < node.getChildCount(); i++) {
|
||||||
|
node.getChildAt(i).layout.resetResult();
|
||||||
|
}
|
||||||
|
|
||||||
/** START_GENERATED **/
|
/** START_GENERATED **/
|
||||||
|
|
||||||
CSSFlexDirection mainAxis = getFlexDirection(node);
|
CSSFlexDirection mainAxis = getFlexDirection(node);
|
||||||
|
Reference in New Issue
Block a user