Skip to content

Commit

Permalink
iOS7 list fix and progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Mackowiak committed Oct 15, 2013
1 parent 1f975af commit 93d174a
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 18 deletions.
Binary file modified Binaries/NativeDialogs.ane
Binary file not shown.
Binary file modified Binaries/iOS/libNativeDialogs.a
Binary file not shown.
4 changes: 2 additions & 2 deletions IOS/NativeDialogs/NativeDialogControler.m
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ -(void)showProgressPopup: (NSString *)title
if (alert) {
[alert addSubview:activityWheel];
}else{
[tsalertView addSubview:activityWheel];
[tsalertView setCustomSubview:activityWheel];
}
[activityWheel startAnimating];
[activityWheel release];
Expand All @@ -615,7 +615,7 @@ -(void)showProgressPopup: (NSString *)title
if (alert) {
[alert addSubview:progressView];
}else{
[tsalertView addSubview:progressView];
[tsalertView setCustomSubview:progressView];
}
[progressView setProgressViewStyle: UIProgressViewStyleBar];
progressView.progress=[progress floatValue];
Expand Down
Empty file modified IOS/NativeDialogs/external/SBTableAlert/SBTableAlert.h
100755 → 100644
Empty file.
9 changes: 3 additions & 6 deletions IOS/NativeDialogs/external/SBTableAlert/SBTableAlert.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,12 @@ - (void)layout {
}
}

CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat maxHeight = _alertView.maxHeight;
CGFloat avgRowHeight = height / rows;
CGFloat resultHeigh;

if(height > screenRect.size.height) {
if(UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation))
resultHeigh = screenRect.size.height - _alertView.frame.size.height - 65.;
else
resultHeigh = screenRect.size.width - _alertView.frame.size.height - 65.;
if(height > maxHeight) {
resultHeigh = maxHeight - _alertView.frame.size.height - 65.;
}
else if (_maximumVisibleRows == -1 || rows <= _maximumVisibleRows)
resultHeigh = _tableView.contentSize.height;
Expand Down
Empty file modified IOS/NativeDialogs/external/TSAlertView/TSAlertView.h
100755 → 100644
Empty file.
41 changes: 32 additions & 9 deletions IOS/NativeDialogs/external/TSAlertView/TSAlertView.m
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ - (CGSize) recalcSizeAndLayout: (BOOL) layout
totalHeight -= messageViewSize.height;
//$$what if it's still too tall?
messageViewSize.height = self.maxHeight - totalHeight;
if (self.customSubview) {
messageViewSize.height = 120;
}

totalHeight = self.maxHeight;

Expand Down Expand Up @@ -728,12 +731,28 @@ - (CGSize) recalcSizeAndLayout: (BOOL) layout

if( self.customSubview )
{
self.customSubview.frame = CGRectMake( kTSAlertView_LeftMargin, y, customSubviewSize.width, customSubviewSize.height );

CGFloat maxCustomSubiewHeight = totalHeight - (kTSAlertView_TopMargin + titleLabelSize.height + kTSAlertView_RowMargin + messageViewSize.height + kTSAlertView_RowMargin + inputRowHeight + kTSAlertView_RowMargin + buttonsAreaSize.height + kTSAlertView_BottomMargin);

CGFloat maxWidth = self.width - (kTSAlertView_LeftMargin * 2);
CGFloat customViewX = kTSAlertView_LeftMargin;
if (customSubviewSize.width > maxWidth) {
customSubviewSize.width = maxWidth;
}else if(customSubviewSize.width < self.width - kTSAlertView_LeftMargin * 2){
//center custom view
customViewX = self.width *.5f - customSubviewSize.width *.5;
}

if (customSubviewSize.height > maxCustomSubiewHeight) {
customSubviewSize.height = maxCustomSubiewHeight;
}

self.customSubview.frame = CGRectMake( customViewX, y, customSubviewSize.width, customSubviewSize.height );
y += customSubviewSize.height + kTSAlertView_RowMargin;
}

if (self.buttons.count>0) {
// buttons
// buttons
if (self.buttons.count>0) {
CGFloat buttonHeight = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero].height;
if ( stacked )
{
Expand All @@ -755,6 +774,7 @@ - (CGSize) recalcSizeAndLayout: (BOOL) layout
}
}
}

}

return CGSizeMake( self.width, totalHeight );
Expand Down Expand Up @@ -795,10 +815,12 @@ - (CGSize) inputTextFieldSize
- (CGSize) buttonsAreaSize_SideBySide
{
CGFloat maxWidth = self.width - (kTSAlertView_LeftMargin * 2);
if (self.buttons.count<=0) {
return CGSizeZero;

CGSize bs = CGSizeZero;

if (self.buttons.count>0) {
bs = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero];
}
CGSize bs = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero];

bs.width = maxWidth;

Expand All @@ -809,10 +831,11 @@ - (CGSize) buttonsAreaSize_Stacked
{
CGFloat maxWidth = self.width - (kTSAlertView_LeftMargin * 2);
int buttonCount = [self.buttons count];
if (!buttonCount) {
return CGSizeZero;

CGSize bs = CGSizeZero;
if (self.buttons.count>0) {
bs = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero];
}
CGSize bs = [[self.buttons objectAtIndex:0] sizeThatFits: CGSizeZero];

bs.width = maxWidth;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion TestApp/src/NativeDialogsTest.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
m.buttons = Vector.<String> (["OK","Cancle"]);
m.title = "Title";
m.message = "Message";
m.dataProvider = Vector.<Object>(["one","two","three"]);
m.dataProvider = Vector.<Object>(["one","two","three","one","two","three","one","two","three","one","two","three","one","two","three","one","two","three","one","two","three"]);
m.displayMode = NativeListDialog.DISPLAY_MODE_MULTIPLE;
m.show();
}
Expand Down

0 comments on commit 93d174a

Please sign in to comment.