Skip to content

Commit

Permalink
Merge pull request #2111 from billdawson/timob-8653
Browse files Browse the repository at this point in the history
TIMOB-8653 Tooling separation: remove support/
  • Loading branch information
marshall committed May 2, 2012
2 parents 4e04378 + 1db5d52 commit 49f39d2
Show file tree
Hide file tree
Showing 372 changed files with 1,187 additions and 23,566 deletions.
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ from SCons.Script import *
# this is used by other python scripts too
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
sys.path.append(path.join(cwd,"build"))
sys.path.append(path.join(cwd,"support","android"))
sys.path.append(path.join(cwd,"android","scripts"))
import titanium_version, ant
from androidsdk import AndroidSDK
version = titanium_version.version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,6 @@ private int getContentProperty(String property)
return AUTO;
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
int wFromSpec = MeasureSpec.getSize(widthMeasureSpec);
int hFromSpec = MeasureSpec.getSize(heightMeasureSpec);

// Use the measured dimensions from a previous measure pass if they are greater than the value we get from
// getMeasuredWidth() and getMeasuredHeight(). TIMOB-8891
int measuredHeight = Math.max(getMeasuredHeight(hFromSpec, 0), getMeasuredHeight());
int measuredWidth = Math.max(getMeasuredWidth(wFromSpec, 0), getMeasuredWidth());

// If the measured dimensions are greater than the parent dimensions, use the measured dimensions instead to
// ensure the child views get measured correctly
if (wFromSpec == parentWidth && measuredWidth > wFromSpec) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY);
}
if (hFromSpec == parentHeight && measuredHeight > hFromSpec) {
heightMeasureSpec = MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY);
}

super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

@Override
protected int getWidthMeasureSpec(View child)
{
Expand Down Expand Up @@ -228,6 +205,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
lp.width);
height -= getPaddingTop();
height -= getPaddingBottom();

// If we measure the child height to be greater than the parent height, use it in subsequent
// calculations to make sure the children are measured correctly the second time around.
height = Math.max(child.getMeasuredHeight(), height);
int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);

Expand Down Expand Up @@ -302,6 +283,10 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
lp.height);
width -= getPaddingLeft();
width -= getPaddingRight();

// If we measure the child width to be greater than the parent width, use it in subsequent
// calculations to make sure the children are measured correctly the second time around.
width = Math.max(child.getMeasuredWidth(), width);
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY);

child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
Expand Down
25 changes: 11 additions & 14 deletions android/runtime/v8/tools/genBootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,31 @@
# Generates javascript bootstrapping code for Titanium Mobile
#

import os, re, sys
import os, re, sys, optparse

thisDir = os.path.abspath(os.path.dirname(__file__))
genDir = os.path.join(os.path.dirname(thisDir), "generated")
androidDir = os.path.abspath(os.path.join(thisDir, "..", "..", ".."))
sdkRootDir = os.path.dirname(androidDir)

# For bootstrap.py
sys.path.append(os.path.join(sdkRootDir, "module", "android"))
import bootstrap

# We package simplejson in the support/common directory.
commonSupportDir = os.path.abspath(os.path.join(androidDir, "..", "support", "common"))
sys.path.append(commonSupportDir)
# Third-party python modules.
thirdPartyDir = os.path.abspath(os.path.join(androidDir, "..", "thirdparty"))
sys.path.append(thirdPartyDir)

try:
import json
except:
import simplejson as json

import optparse

thisDir = os.path.abspath(os.path.dirname(__file__))
genDir = os.path.join(os.path.dirname(thisDir), "generated")
jsonDir = os.path.abspath(os.path.join(androidDir, "..", "dist", "android", "json"))

if not os.path.exists(genDir):
os.makedirs(genDir)

androidModuleDir = os.path.abspath(os.path.join(androidDir, "..", "support", "module", "android"))
jsonDir = os.path.abspath(os.path.join(androidDir, "..", "dist", "android", "json"))

sys.path.append(androidModuleDir)
import bootstrap

def loadBindings():
bindingPaths = []
bindings = { "proxies": {}, "modules": {} }
Expand Down
1 change: 1 addition & 0 deletions android/scripts/README
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Scripts shared by titanium_mobile_sdk build system and tooling.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ protected void onLayout(boolean changed, int l, int t, int r, int b)
} else {
computePosition(this, params.optionLeft, params.optionCenterX, params.optionRight, childMeasuredWidth, left, right, horizontal);
if (isVerticalArrangement()) {
computeVerticalLayoutPosition(currentHeight, params.optionTop, params.optionBottom, childMeasuredHeight, top, bottom, vertical, b);
computeVerticalLayoutPosition(currentHeight, params.optionTop, params.optionBottom, childMeasuredHeight, top, bottom, vertical, bottom);
} else {
computePosition(this, params.optionTop, params.optionCenterY, params.optionBottom, childMeasuredHeight, top, bottom, vertical);
}
Expand Down
11 changes: 5 additions & 6 deletions apidoc/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

this_dir = os.path.dirname(os.path.abspath(__file__))

# We package markdown and mako in support/common.
common_support_dir = os.path.abspath(os.path.join(this_dir, "..", "support", "common"))
sys.path.append(common_support_dir)
# Third-party modules markdown and mako.
thirdparty_dir = os.path.abspath(os.path.join(this_dir, "..", "thirdparty"))
sys.path.append(thirdparty_dir)
import markdown
from mako.template import Template

# TiLogger is in support/android
android_support_dir = os.path.abspath(os.path.join(this_dir, "..", "support", "android"))
sys.path.append(android_support_dir)
android_scripts_dir = os.path.abspath(os.path.join(this_dir, "..", "android", "scripts"))
sys.path.append(android_scripts_dir)
from tilogger import *
log = TiLogger(None)

Expand Down
12 changes: 6 additions & 6 deletions apidoc/generators/html_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@

from common import dict_has_non_empty_member, strip_tags, not_real_titanium_types

# We package simplejson, markdown and mako in support/common.
common_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "common"))
sys.path.append(common_support_dir)
# Third-party modules.
thirdparty_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "thirdparty"))
sys.path.append(thirdparty_dir)
import markdown
from mako.template import Template
from mako.lookup import TemplateLookup

# TiLogger is in support/android
android_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "android"))
sys.path.append(android_support_dir)
# TiLogger is in android/scripts.
android_scripts_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "android", "scripts"))
sys.path.append(android_scripts_dir)
from tilogger import *
log = None

Expand Down
10 changes: 5 additions & 5 deletions apidoc/generators/jsca_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

from common import dict_has_non_empty_member, strip_tags, not_real_titanium_types, to_ordered_dict

android_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "android"))
sys.path.append(android_support_dir)
android_scripts_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "android", "scripts"))
sys.path.append(android_scripts_dir)

# We package markdown and simplejson in support/common.
common_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "common"))
sys.path.append(common_support_dir)
# Third-party modules.
thirdparty_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "thirdparty"))
sys.path.append(thirdparty_dir)
from markdown import markdown

from tilogger import *
Expand Down
4 changes: 2 additions & 2 deletions apidoc/generators/json_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from common import dict_has_non_empty_member

# Contains TiLogger:
android_support_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "support", "android"))
sys.path.append(android_support_dir)
android_scripts_dir = os.path.abspath(os.path.join(this_dir, "..", "..", "android", "scripts"))
sys.path.append(android_scripts_dir)
from tilogger import *


Expand Down
7 changes: 3 additions & 4 deletions apidoc/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import os, sys, re
apiDocDir = os.path.abspath(os.path.dirname(__file__))

# We package markdown in support/common.
commonSupportDir = os.path.abspath(os.path.join(apiDocDir, '..', 'support', 'common'))
if os.path.exists(commonSupportDir):
sys.path.append(commonSupportDir)
thirdPartyDir = os.path.abspath(os.path.join(apiDocDir, '..', 'thirdparty'))
if os.path.exists(thirdPartyDir):
sys.path.append(thirdPartyDir)

import codecs, optparse, platform
import markdown
Expand Down
34 changes: 34 additions & 0 deletions drillbit/tests/ui.layout/ui.layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,40 @@ describe("Ti.UI Layout tests", {
win.add(scrollView);
win.open();
}),
//TIMOB-8362
scrollViewWithSIZE: asyncTest(function() {
var win = Ti.UI.createWindow({
backgroundColor : '#7B6700',
layout : 'vertical',
});
var NavBarView = Ti.UI.createView({
height : '25',
top : 0,
backgroundColor : 'green',
width : '100%'
});
var scrollView = Ti.UI.createScrollView({
height : Ti.UI.SIZE,
width: Ti.UI.SIZE,
scrollType : 'vertical',
layout : 'vertical',
backgroundColor : 'red',

});
var button = Ti.UI.createButton({
title : 'Click',
width : '100',
height : '50'
});
scrollView.add(button);
win.add(NavBarView);
win.add(scrollView);
win.addEventListener("open", this.async(function(e) {
valueOf(scrollView.size.height).shouldBe(50);
valueOf(scrollView.size.width).shouldBe(100);
}));
win.open();
}),
//TIMOB-8891
scrollViewWithLargeVerticalLayoutChild: asyncTest(function() {
var win = Ti.UI.createWindow();
Expand Down
2 changes: 2 additions & 0 deletions iphone/Classes/TiApp.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ TI_INLINE void waitForMemoryPanicCleared() //WARNING: This must never be run o

-(BOOL)windowIsKeyWindow;

-(UIView *) topMostView;

-(void)attachXHRBridgeIfRequired;

/**
Expand Down
5 changes: 5 additions & 0 deletions iphone/Classes/TiApp.mm
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ -(BOOL)windowIsKeyWindow
return [window isKeyWindow];
}

-(UIView *) topMostView
{
UIWindow *currentKeyWindow_ = [[UIApplication sharedApplication] keyWindow];
return [[currentKeyWindow_ subviews] lastObject];
}
-(void)attachXHRBridgeIfRequired
{
#ifdef USE_TI_UIWEBVIEW
Expand Down
2 changes: 1 addition & 1 deletion iphone/Classes/TiUIOptionDialogProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ -(void)show:(id)args
[self updateOptionDialogNow];
return;
}
[actionSheet showInView:[[TiApp controller] view]];
[actionSheet showInView:[[TiApp app] topMostView]];
}

-(void)completeWithButton:(int)buttonIndex
Expand Down
13 changes: 13 additions & 0 deletions iphone/Classes/TiUIWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Please see the LICENSE included with this distribution for details.
*/
#import "TiUIWindow.h"
#import "TiUIWindowProxy.h"

@implementation TiUIWindow

Expand All @@ -27,5 +28,17 @@ -(UIView *)gradientWrapperView
return gradientWrapperView;
}

-(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
[super frameSizeChanged:frame bounds:bounds];
//If we have a titleControl it needs to be resized for new navbar bounds
id titleControlProxy = [[self proxy] valueForKey:@"titleControl"];
if ([titleControlProxy isKindOfClass:[TiViewProxy class]]) {
//Need the delay so that we get the right navbar bounds
[(TiUIWindowProxy*)[self proxy] performSelector:@selector(_updateTitleView) withObject:nil afterDelay:[[UIApplication sharedApplication] statusBarOrientationAnimationDuration] ];
}
}


@end

1 change: 1 addition & 0 deletions iphone/Classes/TiUIWindowProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
}

-(void)_refreshBackButton;
-(void)_updateTitleView;
-(void)boot:(BOOL)timeout args:(id)args;

@end
Expand Down
53 changes: 38 additions & 15 deletions iphone/Classes/TiUIWindowProxy.m
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,15 @@ -(void)setBackButtonTitleImage:(id)proxy
}
}

-(void)_updateTitleView
{
//Called from the view when the screen rotates.
//Resize titleControl based on navbar bounds
TiThreadPerformOnMainThread(^{
[self updateTitleView];
}, NO);
}

-(void)updateTitleView
{
UIView * newTitleView = nil;
Expand All @@ -529,24 +538,38 @@ -(void)updateTitleView
return; // No need to update the title if not in a nav controller
}

UINavigationItem * ourNavItem = [controller navigationItem];

TiViewProxy * titleControl = [self valueForKey:@"titleControl"];

UIView * oldView = [ourNavItem titleView];
if ([oldView isKindOfClass:[TiUIView class]])
{
TiViewProxy * oldProxy = (TiViewProxy *)[(TiUIView *)oldView proxy];
if (oldProxy == titleControl)
{
return; //No need to update?
}
[oldProxy removeBarButtonView];
}
UINavigationItem * ourNavItem = [controller navigationItem];
UINavigationBar * ourNB = [[controller navigationController] navigationBar];
CGRect barFrame = [ourNB bounds];
CGSize availableTitleSize = CGSizeZero;
availableTitleSize.width = barFrame.size.width - (2*TI_NAVBAR_BUTTON_WIDTH);
availableTitleSize.height = barFrame.size.height;

TiViewProxy * titleControl = [self valueForKey:@"titleControl"];

UIView * oldView = [ourNavItem titleView];
if ([oldView isKindOfClass:[TiUIView class]]) {
TiViewProxy * oldProxy = (TiViewProxy *)[(TiUIView *)oldView proxy];
if (oldProxy == titleControl) {
//relayout titleControl
CGRect barBounds;
barBounds.origin = CGPointZero;
barBounds.size = SizeConstraintViewWithSizeAddingResizing(titleControl.layoutProperties, titleControl, availableTitleSize, NULL);

[TiUtils setView:oldView positionRect:barBounds];
[oldView setAutoresizingMask:UIViewAutoresizingNone];

//layout the titleControl children
[titleControl layoutChildren:NO];

return;
}
[oldProxy removeBarButtonView];
}

if ([titleControl isKindOfClass:[TiViewProxy class]])
{
newTitleView = [titleControl barButtonViewForSize:[TiUtils navBarTitleViewSize]];
newTitleView = [titleControl barButtonViewForSize:availableTitleSize];
}
else
{
Expand Down

0 comments on commit 49f39d2

Please sign in to comment.