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-8362: scrollview layout fix. #2015

Merged
merged 4 commits into from Apr 19, 2012
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -24,7 +24,6 @@
import android.graphics.Canvas;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.MeasureSpec;
import android.widget.FrameLayout;
import android.widget.HorizontalScrollView;
import android.widget.ScrollView;
Expand Down Expand Up @@ -127,17 +126,22 @@ protected int getHeightMeasureSpec(View child)
return super.getHeightMeasureSpec(child);
}
}

@Override
protected int getMeasuredWidth(int maxWidth, int widthSpec)
{
int contentWidth = getContentProperty(TiC.PROPERTY_CONTENT_WIDTH);
if (contentWidth == AUTO) {
contentWidth = maxWidth; // measuredWidth;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we remove the extra space here? =)


// Force the minimum width of the content view to be the size of its parent (scroll view)
return Math.max(contentWidth, parentWidth);
if (contentWidth > parentWidth) {
return Math.max(contentWidth, parentWidth);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can probably just return contentWidth here instead of using max since you already check for it in the if statement.

} else {
return resolveSize(maxWidth, widthSpec);
}
}

@Override
Expand All @@ -149,8 +153,12 @@ protected int getMeasuredHeight(int maxHeight, int heightSpec)
}

// Force the minimum height of the content view to be the size of its parent (scroll view)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the logic here changed, we should also update the comments as well.

return Math.max(contentHeight, parentHeight);
}
if (contentHeight > parentHeight) {
return Math.max(contentHeight, parentHeight);
} else {
return resolveSize(maxHeight, heightSpec);
}
}
}

// same code, different super-classes
Expand Down