Skip to content

Commit

Permalink
changes before CR
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoo-msft committed Jun 5, 2018
1 parent c90ef84 commit 794fe54
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 20 deletions.
Expand Up @@ -218,16 +218,16 @@ - (void)update:(NSString *) jsonStr
[self.curView removeFromSuperview];

self.curView = ad;
//if(_enableCustomRenderer){
[_scrView addSubview:self.curView];
UIView *view = self.curView;
view.translatesAutoresizingMaskIntoConstraints = NO;

[_scrView addSubview:self.curView];
UIView *view = self.curView;
view.translatesAutoresizingMaskIntoConstraints = NO;

[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0].active = YES;
//}
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeLeading multiplier:1.0 constant:0].active = YES;
[NSLayoutConstraint constraintWithItem:view attribute:NSLayoutAttributeTrailing relatedBy:NSLayoutRelationEqual toItem:_scrView attribute:NSLayoutAttributeTrailing multiplier:1.0 constant:0].active = YES;

}
}

Expand Down
Expand Up @@ -36,7 +36,7 @@ + (UIButton* )rootView:(ACRView *)rootView
// Generate key for ImageViewMap
NSString *key = [NSString stringWithCString:action->GetId().c_str() encoding:[NSString defaultCStringEncoding]];
// Syncronize access to imageViewMap
dispatch_async([rootView getSerialQueue], ^{
dispatch_sync([rootView getSerialQueue], ^{
// if imageView is available, get it, otherwise cache UIButton, so it can be used once images are ready
if(actionsViewMap[key] && [actionsViewMap[key] isKindOfClass:[UIImageView class]])
{
Expand Down
Expand Up @@ -41,14 +41,6 @@ - (UIView *)render:(UIView<ACRIContentHoldingView> *)viewGroup
std::shared_ptr<TextBlock> txtBlck = std::dynamic_pointer_cast<TextBlock>(elem);
ACRUILabel *lab = [[ACRUILabel alloc] init];
lab.style = [viewGroup style];
TextConfig textConfig =
{
.weight = txtBlck->GetTextWeight(),
.size = txtBlck->GetTextSize(),
.color = txtBlck->GetTextColor(),
.isSubtle = txtBlck->GetIsSubtle(),
.wrap = txtBlck->GetWrap()
};
NSMutableAttributedString *content = nil;
if(rootView){
NSMutableDictionary *textMap = [rootView getTextMap];
Expand All @@ -65,15 +57,15 @@ - (UIView *)render:(UIView<ACRIContentHoldingView> *)viewGroup

// Set paragraph style such as line break mode and alignment
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineBreakMode = textConfig.wrap ? NSLineBreakByWordWrapping:NSLineBreakByTruncatingTail;
paragraphStyle.lineBreakMode = txtBlck->GetWrap() ? NSLineBreakByWordWrapping:NSLineBreakByTruncatingTail;
paragraphStyle.alignment = [ACOHostConfig getTextBlockAlignment:txtBlck->GetHorizontalAlignment()];

// Obtain text color to apply to the attributed string
ACRContainerStyle style = lab.style;
ColorsConfig &colorConfig = (style == ACREmphasis)? config->containerStyles.emphasisPalette.foregroundColors:
config->containerStyles.defaultPalette.foregroundColors;
// Add paragraph style, text color, text weight as attributes to a NSMutableAttributedString, content.
[content addAttributes:@{NSParagraphStyleAttributeName:paragraphStyle, NSForegroundColorAttributeName:[ACOHostConfig getTextBlockColor:textConfig.color colorsConfig:colorConfig subtleOption:textConfig.isSubtle],} range:NSMakeRange(0, content.length)];
[content addAttributes:@{NSParagraphStyleAttributeName:paragraphStyle, NSForegroundColorAttributeName:[ACOHostConfig getTextBlockColor:txtBlck->GetTextColor() colorsConfig:colorConfig subtleOption:txtBlck->GetIsSubtle()],} range:NSMakeRange(0, content.length)];
lab.attributedText = content;
}

Expand Down

0 comments on commit 794fe54

Please sign in to comment.