Skip to content

Commit

Permalink
Merge pull request #5069 from pingwang2011/timob-15905
Browse files Browse the repository at this point in the history
timob-15905: Android: Views using Ti.UI.FILL don't layout correctly when containing Window has implicit height/width
  • Loading branch information
hieupham007 committed Dec 6, 2013
2 parents adfa63d + b71fc8c commit dbc6dfc
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,10 @@ public void windowCreated(TiBaseActivity activity) {
Object height = getProperty(TiC.PROPERTY_HEIGHT);
View decorView = win.getDecorView();
if (decorView != null) {
int w = width == null ? LayoutParams.MATCH_PARENT : TiConvert.toTiDimension(width, TiDimension.TYPE_WIDTH).getAsPixels(decorView);
int h = height == null ? LayoutParams.MATCH_PARENT : TiConvert.toTiDimension(height, TiDimension.TYPE_HEIGHT).getAsPixels(decorView);
int w = (width == null || width.equals(TiC.LAYOUT_FILL)) ? LayoutParams.MATCH_PARENT : TiConvert
.toTiDimension(width, TiDimension.TYPE_WIDTH).getAsPixels(decorView);
int h = (height == null || height.equals(TiC.LAYOUT_FILL)) ? LayoutParams.MATCH_PARENT : TiConvert
.toTiDimension(height, TiDimension.TYPE_HEIGHT).getAsPixels(decorView);
win.setLayout(w, h);
}
}
Expand Down Expand Up @@ -435,8 +437,10 @@ private void setWindowWidthHeight(Object width, Object height)
if (win != null) {
View decorView = win.getDecorView();
if (decorView != null) {
int w = width == null ? LayoutParams.MATCH_PARENT : TiConvert.toTiDimension(width, TiDimension.TYPE_WIDTH).getAsPixels(decorView);
int h = height == null ? LayoutParams.MATCH_PARENT : TiConvert.toTiDimension(height, TiDimension.TYPE_HEIGHT).getAsPixels(decorView);
int w = (width == null || width.equals(TiC.LAYOUT_FILL)) ? LayoutParams.MATCH_PARENT : TiConvert
.toTiDimension(width, TiDimension.TYPE_WIDTH).getAsPixels(decorView);
int h = (height == null || height.equals(TiC.LAYOUT_FILL)) ? LayoutParams.MATCH_PARENT : TiConvert
.toTiDimension(height, TiDimension.TYPE_HEIGHT).getAsPixels(decorView);
win.setLayout(w, h);
}
}
Expand Down

0 comments on commit dbc6dfc

Please sign in to comment.