Merge change 22308 into eclair
* changes: Replace fullHeight support by fullSize (height and width)
This commit is contained in:
@@ -70,9 +70,8 @@ public interface ILayoutBridge {
|
|||||||
* @param projectKey An Object identifying the project. This is used for the cache mechanism.
|
* @param projectKey An Object identifying the project. This is used for the cache mechanism.
|
||||||
* @param screenWidth the screen width
|
* @param screenWidth the screen width
|
||||||
* @param screenHeight the screen height
|
* @param screenHeight the screen height
|
||||||
* @param renderFullHeight if true, the rendering will render the full height needed by the
|
* @param renderFullSize if true, the rendering will render the full size needed by the
|
||||||
* layout. If the layout needs less than <var>screenHeight</var> then the rendering will
|
* layout. This size is never smaller than <var>screenWidth</var> x <var>screenHeight</var>.
|
||||||
* use <var>screenHeight</var> as the height.
|
|
||||||
* @param density the density factor for the screen.
|
* @param density the density factor for the screen.
|
||||||
* @param xdpi the screen actual dpi in X
|
* @param xdpi the screen actual dpi in X
|
||||||
* @param ydpi the screen actual dpi in Y
|
* @param ydpi the screen actual dpi in Y
|
||||||
@@ -94,7 +93,7 @@ public interface ILayoutBridge {
|
|||||||
*/
|
*/
|
||||||
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
|
ILayoutResult computeLayout(IXmlPullParser layoutDescription,
|
||||||
Object projectKey,
|
Object projectKey,
|
||||||
int screenWidth, int screenHeight, boolean renderFullHeight,
|
int screenWidth, int screenHeight, boolean renderFullSize,
|
||||||
int density, float xdpi, float ydpi,
|
int density, float xdpi, float ydpi,
|
||||||
String themeName, boolean isProjectTheme,
|
String themeName, boolean isProjectTheme,
|
||||||
Map<String, Map<String, IResourceValue>> projectResources,
|
Map<String, Map<String, IResourceValue>> projectResources,
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ public final class Bridge implements ILayoutBridge {
|
|||||||
Map<String, Map<String, IResourceValue>> frameworkResources,
|
Map<String, Map<String, IResourceValue>> frameworkResources,
|
||||||
IProjectCallback customViewLoader, ILayoutLog logger) {
|
IProjectCallback customViewLoader, ILayoutLog logger) {
|
||||||
return computeLayout(layoutDescription, projectKey,
|
return computeLayout(layoutDescription, projectKey,
|
||||||
screenWidth, screenHeight, false /* renderFullHeight */,
|
screenWidth, screenHeight, false /* renderFullSize */,
|
||||||
density, xdpi, ydpi, themeName, isProjectTheme,
|
density, xdpi, ydpi, themeName, isProjectTheme,
|
||||||
projectResources, frameworkResources, customViewLoader, logger);
|
projectResources, frameworkResources, customViewLoader, logger);
|
||||||
}
|
}
|
||||||
@@ -333,7 +333,7 @@ public final class Bridge implements ILayoutBridge {
|
|||||||
* @see com.android.layoutlib.api.ILayoutBridge#computeLayout(com.android.layoutlib.api.IXmlPullParser, java.lang.Object, int, int, boolean, int, float, float, java.lang.String, boolean, java.util.Map, java.util.Map, com.android.layoutlib.api.IProjectCallback, com.android.layoutlib.api.ILayoutLog)
|
* @see com.android.layoutlib.api.ILayoutBridge#computeLayout(com.android.layoutlib.api.IXmlPullParser, java.lang.Object, int, int, boolean, int, float, float, java.lang.String, boolean, java.util.Map, java.util.Map, com.android.layoutlib.api.IProjectCallback, com.android.layoutlib.api.ILayoutLog)
|
||||||
*/
|
*/
|
||||||
public ILayoutResult computeLayout(IXmlPullParser layoutDescription, Object projectKey,
|
public ILayoutResult computeLayout(IXmlPullParser layoutDescription, Object projectKey,
|
||||||
int screenWidth, int screenHeight, boolean renderFullHeight,
|
int screenWidth, int screenHeight, boolean renderFullSize,
|
||||||
int density, float xdpi, float ydpi,
|
int density, float xdpi, float ydpi,
|
||||||
String themeName, boolean isProjectTheme,
|
String themeName, boolean isProjectTheme,
|
||||||
Map<String, Map<String, IResourceValue>> projectResources,
|
Map<String, Map<String, IResourceValue>> projectResources,
|
||||||
@@ -412,17 +412,22 @@ public final class Bridge implements ILayoutBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// measure the views
|
// measure the views
|
||||||
int w_spec = MeasureSpec.makeMeasureSpec(screenWidth, MeasureSpec.EXACTLY);
|
int w_spec, h_spec;
|
||||||
int h_spec;
|
|
||||||
|
|
||||||
if (renderFullHeight) {
|
if (renderFullSize) {
|
||||||
// measure the full height needed by the layout.
|
// measure the full size needed by the layout.
|
||||||
|
w_spec = MeasureSpec.makeMeasureSpec(screenWidth,
|
||||||
|
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
|
||||||
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
|
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
|
||||||
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
|
MeasureSpec.UNSPECIFIED); // this lets us know the actual needed size
|
||||||
view.measure(w_spec, h_spec);
|
view.measure(w_spec, h_spec);
|
||||||
|
|
||||||
int neededHeight = root.getChildAt(0).getMeasuredHeight();
|
int neededWidth = root.getChildAt(0).getMeasuredWidth();
|
||||||
|
if (neededWidth > screenWidth) {
|
||||||
|
screenWidth = neededWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
int neededHeight = root.getChildAt(0).getMeasuredHeight();
|
||||||
if (neededHeight > screenHeight - screenOffset) {
|
if (neededHeight > screenHeight - screenOffset) {
|
||||||
screenHeight = neededHeight + screenOffset;
|
screenHeight = neededHeight + screenOffset;
|
||||||
}
|
}
|
||||||
@@ -430,6 +435,7 @@ public final class Bridge implements ILayoutBridge {
|
|||||||
|
|
||||||
// remeasure with only the size we need
|
// remeasure with only the size we need
|
||||||
// This must always be done before the call to layout
|
// This must always be done before the call to layout
|
||||||
|
w_spec = MeasureSpec.makeMeasureSpec(screenWidth, MeasureSpec.EXACTLY);
|
||||||
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
|
h_spec = MeasureSpec.makeMeasureSpec(screenHeight - screenOffset,
|
||||||
MeasureSpec.EXACTLY);
|
MeasureSpec.EXACTLY);
|
||||||
view.measure(w_spec, h_spec);
|
view.measure(w_spec, h_spec);
|
||||||
|
|||||||
Reference in New Issue
Block a user