Merge branch 'develop' into feature/kevin

This commit is contained in:
Christiano, Kevin 2019-05-03 14:20:43 -04:00
commit fa10cb8e58
6 changed files with 57 additions and 21 deletions

View File

@ -68,7 +68,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
NSString *checkedColorHex = [json string:@"checkedColor"]; NSString *checkedColorHex = [json string:@"checkedColor"];
NSString *unCheckedColorHex = [json string:@"unCheckedColor"]; NSString *unCheckedColorHex = [json string:@"unCheckedColor"];
UIColor *checkedColor = checkedColorHex ? [UIColor mfGetColorForHex:checkedColorHex]: [UIColor blackColor]; UIColor *checkedColor = checkedColorHex ? [UIColor mfGetColorForHex:checkedColorHex]: [UIColor clearColor];
UIColor *unCheckedColor = unCheckedColorHex ? [UIColor mfGetColorForHex:unCheckedColorHex]: [UIColor clearColor]; UIColor *unCheckedColor = unCheckedColorHex ? [UIColor mfGetColorForHex:unCheckedColorHex]: [UIColor clearColor];
[self setupWithCheckedColor:checkedColor [self setupWithCheckedColor:checkedColor
@ -183,6 +183,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
- (instancetype)initWithCoder:(NSCoder *)coder { - (instancetype)initWithCoder:(NSCoder *)coder {
self = [super initWithCoder:coder]; self = [super initWithCoder:coder];
if (self) { if (self) {
[self setupView];
[self setupWithCheckedColor:[UIColor whiteColor] unCheckColor:[UIColor whiteColor] text:nil]; [self setupWithCheckedColor:[UIColor whiteColor] unCheckColor:[UIColor whiteColor] text:nil];
[self addAccessibleProperties]; [self addAccessibleProperties];
} }
@ -192,6 +193,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
[self setupView];
[self setupWithCheckedColor:[UIColor whiteColor] unCheckColor:[UIColor whiteColor] text:nil]; [self setupWithCheckedColor:[UIColor whiteColor] unCheckColor:[UIColor whiteColor] text:nil];
[self addAccessibleProperties]; [self addAccessibleProperties];
} }
@ -241,9 +243,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
[self.checkMark.widthAnchor constraintEqualToAnchor:self.checkedSquare.widthAnchor multiplier:.4].active = YES; [self.checkMark.widthAnchor constraintEqualToAnchor:self.checkedSquare.widthAnchor multiplier:.4].active = YES;
[self.checkMark.heightAnchor constraintEqualToAnchor:self.checkedSquare.heightAnchor multiplier:.4].active = YES; [self.checkMark.heightAnchor constraintEqualToAnchor:self.checkedSquare.heightAnchor multiplier:.4].active = YES;
[self.checkMark.centerXAnchor constraintEqualToAnchor:self.checkedSquare.centerXAnchor].active = YES; [self.checkMark.centerXAnchor constraintEqualToAnchor:self.checkedSquare.centerXAnchor].active = YES;
[self.checkMark.centerYAnchor constraintEqualToAnchor:self.checkedSquare.centerYAnchor].active = YES; [self.checkMark.centerYAnchor constraintEqualToAnchor:self.checkedSquare.centerYAnchor].active = YES;
} else {
[self.checkedSquare addSubview:self.checkMark];
} }
//label //label

View File

@ -193,13 +193,7 @@ static NSString * const COLLECTION_CELL_ID = @"cell";
[label layoutIfNeeded]; [label layoutIfNeeded];
label.baselineAdjustment = UIBaselineAdjustmentAlignCenters; label.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
//set up cell acceessibility label [self setCellAccessibility:cell title:label.text isSelected:NO indexPath:indexPath];
cell.isAccessibilityElement = NO;
cell.contentView.isAccessibilityElement = YES;
NSString *accLabel = [title stringByAppendingString:[MVMCoreUIUtility hardcodedStringWithKey:@"AccTab"]];
cell.contentView.accessibilityLabel = accLabel;
[cell.contentView setAccessibilityHint:[MVMCoreUIUtility hardcodedStringWithKey:@"AccTabHint"]];
if (indexPath.row == self.selectedIndex) { if (indexPath.row == self.selectedIndex) {
label.textColor = [UIColor mfTomatoRed]; label.textColor = [UIColor mfTomatoRed];
@ -404,20 +398,27 @@ static NSString * const COLLECTION_CELL_ID = @"cell";
[cell layoutIfNeeded]; [cell layoutIfNeeded];
} }
//setup selected tab accessibility
NSString *string = label.text;
NSString *accLabel = [string stringByAppendingString:[MVMCoreUIUtility hardcodedStringWithKey:@"toptabbar_tab_selected"]];
cell.contentView.accessibilityLabel = accLabel;
[cell.contentView setAccessibilityHint:nil];
self.selectedIndex = indexPath.row; self.selectedIndex = indexPath.row;
if ([self.delegate respondsToSelector:@selector(topTabbar:titleForItemAtIndex:)]){ if ([self.delegate respondsToSelector:@selector(topTabbar:titleForItemAtIndex:)]){
[self.delegate topTabbar:self didSelectItemAtIndex:indexPath.row]; [self.delegate topTabbar:self didSelectItemAtIndex:indexPath.row];
} }
[self setCellAccessibility:cell title:label.text isSelected:YES indexPath:indexPath];
} }
- (void)reloadData { - (void)reloadData {
[self.collectionView reloadData]; [self.collectionView reloadData];
} }
- (void)setCellAccessibility:(UICollectionViewCell *)cell title:(NSString *)title isSelected:(BOOL)isSelected indexPath:(NSIndexPath *)indexPath {
cell.isAccessibilityElement = NO;
cell.contentView.isAccessibilityElement = YES;
NSString *accKey = isSelected ? @"toptabbar_tab_selected" : @"AccTab";
NSString *accLabel = [title stringByAppendingString:[MVMCoreUIUtility hardcodedStringWithKey:accKey]];
NSString *accString = [accLabel stringByAppendingString:[NSString stringWithFormat:[MVMCoreUIUtility hardcodedStringWithKey:@"AccTabIndex"], indexPath.row + 1, [self.datasource numberOfTopTabbarItems:self]]];
cell.contentView.accessibilityLabel = accString;
NSString *accHint = isSelected ? nil : [MVMCoreUIUtility hardcodedStringWithKey:@"AccTabHint"];
[cell.contentView setAccessibilityHint:accHint];
}
@end @end

View File

@ -13,6 +13,7 @@
#import "NSLayoutConstraint+MFConvenience.h" #import "NSLayoutConstraint+MFConvenience.h"
#import "MVMCoreUISplitViewController.h" #import "MVMCoreUISplitViewController.h"
@import MVMCore.MVMCoreDispatchUtility; @import MVMCore.MVMCoreDispatchUtility;
#import <MVMCoreUI/MVMCoreUIUtility.h>
CGFloat const PaddingDefault = 24; CGFloat const PaddingDefault = 24;
CGFloat const PaddingDefaultHorizontalSpacing = 32; CGFloat const PaddingDefaultHorizontalSpacing = 32;
@ -947,7 +948,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
if ([times containsObject:@"DD"]) { if ([times containsObject:@"DD"]) {
[timeString appendString:[NSString stringWithFormat:@"%02ld",days]]; [timeString appendString:[NSString stringWithFormat:@"%02ld",days]];
if (timeUnit == MFTimeFormatNormal) { if (timeUnit == MFTimeFormatNormal) {
NSString *dayUnit = (days <= 1) ? @" day": @" days"; NSString *dayKey = (days <= 1) ? @"CountDownDay": @"CountDownDays";
NSString *dayUnit = [MVMCoreUIUtility hardcodedStringWithKey:dayKey];
[timeString appendString:dayUnit]; [timeString appendString:dayUnit];
} else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"DD"]) { } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"DD"]) {
[timeString appendString:@" : "]; [timeString appendString:@" : "];
@ -962,7 +964,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
} }
[timeString appendString:[NSString stringWithFormat:@"%02d",hours]]; [timeString appendString:[NSString stringWithFormat:@"%02d",hours]];
if (timeUnit == MFTimeFormatNormal) { if (timeUnit == MFTimeFormatNormal) {
NSString *hourUnit = (hours <= 1) ? @" hour": @" hours"; NSString *hourKey = (hours <= 1) ? @"CountDownHour": @"CountDownHours";
NSString *hourUnit = [MVMCoreUIUtility hardcodedStringWithKey:hourKey];
[timeString appendString:hourUnit]; [timeString appendString:hourUnit];
} else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"HH"]) { } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"HH"]) {
[timeString appendString:@" : "]; [timeString appendString:@" : "];
@ -981,7 +984,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
} }
[timeString appendString:[NSString stringWithFormat:@"%02d",minutes]]; [timeString appendString:[NSString stringWithFormat:@"%02d",minutes]];
if (timeUnit == MFTimeFormatNormal) { if (timeUnit == MFTimeFormatNormal) {
NSString *minuteUnit = (minutes <= 1) ? @" min": @" mins"; NSString *minKey = (minutes <= 1) ? @"CountDownMin": @"CountDownMins";
NSString *minuteUnit = [MVMCoreUIUtility hardcodedStringWithKey:minKey];
[timeString appendString:minuteUnit]; [timeString appendString:minuteUnit];
} else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"MM"]) { } else if (timeUnit == MFTimeFormatColon && ![[times lastObject] isEqualToString:@"MM"]) {
[timeString appendString:@" : "]; [timeString appendString:@" : "];
@ -1005,7 +1009,8 @@ CGFloat const LabelWithInternalButtonLineSpace = 2;
} }
[timeString appendString:[NSString stringWithFormat:@"%02d",seconds]]; [timeString appendString:[NSString stringWithFormat:@"%02d",seconds]];
if (timeUnit == MFTimeFormatNormal) { if (timeUnit == MFTimeFormatNormal) {
NSString *secondUnit = (seconds <= 1) ? @" sec": @" secs"; NSString *secondKey = (seconds <= 1) ? @"CountDownSec": @"CountDownSecs";
NSString *secondUnit = [MVMCoreUIUtility hardcodedStringWithKey:secondKey];
[timeString appendString:secondUnit]; [timeString appendString:secondUnit];
} }
} }

View File

@ -11,6 +11,7 @@
// Tab // Tab
"AccTab" = ", tab"; "AccTab" = ", tab";
"AccTabHint" = "Double tap to select."; "AccTabHint" = "Double tap to select.";
"AccTabIndex" = ", %ld of %ld";
// top alert // top alert
"toptabbar_tab_selected" = ", tab, Selected"; "toptabbar_tab_selected" = ", tab, Selected";
"AccTopAlertClosed" = "Top alert notification is closed."; "AccTopAlertClosed" = "Top alert notification is closed.";
@ -39,3 +40,12 @@
"AccOn" = "on"; "AccOn" = "on";
"AccOff" = "off"; "AccOff" = "off";
"AccToggleHint" = "double tap to toggle"; "AccToggleHint" = "double tap to toggle";
//Styler
"CountDownDay" = " day";
"CountDownHour" = " hour";
"CountDownMin" = " min";
"CountDownSec" = " sec";
"CountDownDays" = " days";
"CountDownHours" = " hours";
"CountDownMins" = " mins";
"CountDownSecs" = " secs";

View File

@ -10,6 +10,7 @@
// Tab // Tab
"AccTab" = ", pestaña"; "AccTab" = ", pestaña";
"AccTabHint" = "Toca dos veces para seleccionar."; "AccTabHint" = "Toca dos veces para seleccionar.";
"AccTabIndex" = ", %ld de %ld";
// top alert // top alert
"toptabbar_tab_selected" = ", pestaña, Seleccionado"; "toptabbar_tab_selected" = ", pestaña, Seleccionado";
"AccTopAlertClosed" = "La notificación de alerta máxima está desactivada."; "AccTopAlertClosed" = "La notificación de alerta máxima está desactivada.";
@ -38,3 +39,12 @@
"AccOn" = "encendido"; "AccOn" = "encendido";
"AccOff" = "apagado"; "AccOff" = "apagado";
"AccToggleHint" = "toca dos veces para alternar"; "AccToggleHint" = "toca dos veces para alternar";
//Styler
"CountDownDay" = " día";
"CountDownHour" = " hora";
"CountDownMin" = " min";
"CountDownSec" = " seg";
"CountDownDays" = " días";
"CountDownHours" = " horas";
"CountDownMins" = " min";
"CountDownSecs" = " seg";

View File

@ -10,6 +10,7 @@
// Tab // Tab
"AccTab" = ", pestaña"; "AccTab" = ", pestaña";
"AccTabHint" = "Toca dos veces para seleccionar."; "AccTabHint" = "Toca dos veces para seleccionar.";
"AccTabIndex" = ", %ld de %ld";
// top alert // top alert
"toptabbar_tab_selected" = ", pestaña, Seleccionado"; "toptabbar_tab_selected" = ", pestaña, Seleccionado";
"AccTopAlertClosed" = "La notificación de alerta máxima está desactivada."; "AccTopAlertClosed" = "La notificación de alerta máxima está desactivada.";
@ -38,3 +39,12 @@
"AccOn" = "encendido"; "AccOn" = "encendido";
"AccOff" = "apagado"; "AccOff" = "apagado";
"AccToggleHint" = "toca dos veces para alternar"; "AccToggleHint" = "toca dos veces para alternar";
//Styler
"CountDownDay" = " día";
"CountDownHour" = " hora";
"CountDownMin" = " min";
"CountDownSec" = " seg";
"CountDownDays" = " días";
"CountDownHours" = " horas";
"CountDownMins" = " min";
"CountDownSecs" = " seg";