Updated to newer gradle / SDK 21 - the demo app 2nd image wrapping above
Opened this issue · 2 comments
RoundSparrow commented
Hello. I updated everything to SDK 21. Sorry I stripped out some of the maven upload stuff in name of getting it to compile. There has been rework of the syntax/etc that I didn't have time to learn. Fork here: https://github.com/RoundSparrow/FlowTextView
The problem I see: your screen shot shows text above the right image, the second image. However, my build is not dong this - it is leaving the space above the right image as blank.
Any ideas on changes in the SDK or such that we might be able to adjust for?
RoundSparrow commented
FlowTextView.java line 251 looks like trouble to me. Is there a stray plus sign on that line?
RoundSparrow commented
I came up with this:
public boolean useTopMarginWorkaround = true;
/*
Additions / tweaking author: Stephen A. Gutknecht
*/
private int findBoxesAndReturnLowestObstacleYCoord() {
int lowestYCoord = 0;
int childCount = this.getChildCount();
LayoutParams layoutParams;
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child.getVisibility() != View.GONE) {
layoutParams = (LayoutParams) child.getLayoutParams();
Obstacle obstacle = new Obstacle();
obstacle.topLeftx = child.getLeft() - layoutParams.leftMargin;
if (useTopMarginWorkaround)
obstacle.topLefty = child.getTop();
else
obstacle.topLefty = child.getTop() - layoutParams.topMargin;
obstacle.bottomRightx = obstacle.topLeftx + layoutParams.leftMargin + child.getWidth() + layoutParams.rightMargin; // padding should probably be included as well
if (useTopMarginWorkaround)
obstacle.bottomRighty = child.getBottom(); // padding should probably be included as well
else
obstacle.bottomRighty = obstacle.topLefty + layoutParams.topMargin + child.getHeight() + layoutParams.bottomMargin; // padding should probably be included as well
android.util.Log.d("FTV2", "Create Obstacle " + i + "/" + (childCount - 1) + " " + obstacle.toString() + " !! CT " + child.getTop() + " CTM " + layoutParams.topMargin);
obstacles.add(obstacle);
if (obstacle.bottomRighty > lowestYCoord) lowestYCoord = obstacle.bottomRighty;
}
}
return lowestYCoord;
}
Can someone help confirm they see the difference if you flip useTopMarginWorkaround?