Update Activity Indicator accessibility label and value
The generated files were created with generate_string_tables.py
internally, then exported manually to the external
material-components-ios repo
MODIFY
components/ActivityIndicator/src/MDCActivityIndicator.m
components/ActivityIndicator/src/MDCActivityIndicator.m
@@ -974,19 +974,29 @@ static const CGFloat kSingleCycleRotation =
}
- (NSString *)accessibilityLabel {
+ MaterialActivityIndicatorStringId keyIndex = kStr_MaterialActivityIndicatorAccessibilityLabel;
+ NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
+ return NSLocalizedStringFromTableInBundle(key,
+ kMaterialActivityIndicatorStringsTableName,
+ [[self class] bundle],
+ @"Activity Indicator");
+}
+- (NSString *)accessibilityValue {
if (self.isAnimating) {
if (self.indicatorMode == MDCActivityIndicatorModeIndeterminate) {
- NSString *key =
- kMaterialActivityIndicatorStringTable[kStr_MaterialActivityIndicatorInProgressAccessibilityLabel];
+ MaterialActivityIndicatorStringId keyIndex =
+ kStr_MaterialActivityIndicatorInProgressAccessibilityValue;
+ NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
return NSLocalizedStringFromTableInBundle(key,
kMaterialActivityIndicatorStringsTableName,
[[self class] bundle],
@"In Progress");
} else {
NSUInteger percentage = (int)(self.progress * 100);
- NSString *key =
- kMaterialActivityIndicatorStringTable[kStr_MaterialActivityIndicatorProgressCompletedAccessibilityLabel];
+ MaterialActivityIndicatorStringId keyIndex =
+ kStr_MaterialActivityIndicatorProgressCompletedAccessibilityValue;
+ NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
NSString *localizedString = NSLocalizedStringFromTableInBundle(key,
kMaterialActivityIndicatorStringsTableName,
[[self class] bundle],
@@ -994,8 +1004,9 @@ static const CGFloat kSingleCycleRotation =
return [NSString localizedStringWithFormat:localizedString, percentage];
}
} else {
- NSString *key =
- kMaterialActivityIndicatorStringTable[kStr_MaterialActivityIndicatorProgressHaltedAccessibilityLabel];
+ MaterialActivityIndicatorStringId keyIndex =
+ kStr_MaterialActivityIndicatorProgressHaltedAccessibilityValue;
+ NSString *key = kMaterialActivityIndicatorStringTable[keyIndex];
return NSLocalizedStringFromTableInBundle(key,
kMaterialActivityIndicatorStringsTableName,
[[self class] bundle],
@@ -1007,14 +1018,6 @@ static const CGFloat kSingleCycleRotation =
return UIAccessibilityTraitUpdatesFrequently;
}
-- (NSString *)accessibilityValue {
- if (self.isAnimating) {
- return [NSNumberFormatter localizedStringFromNumber:@1 numberStyle:NSNumberFormatterNoStyle];
- } else {
- return [NSNumberFormatter localizedStringFromNumber:@0 numberStyle:NSNumberFormatterNoStyle];
- }
-}
-
@end
@implementation MDCActivityIndicatorTransition

MODIFY
components/ActivityIndicator/src/MaterialActivityIndicator.bundle/Resources/en.lproj/MaterialActivityIndicator.strings
components/ActivityIndicator/src/MaterialActivityIndicator.bundle/Resources/en.lproj/MaterialActivityIndicator.strings
-/* Accessibility label for indeterminate activity indicator in progress */
-"MaterialActivityIndicatorInProgressAccessibilityLabel" = "In Progress";
+/* Accessibility label for activity indicator. */
+"MaterialActivityIndicatorAccessibilityLabel" = "Activity Indicator";
-/* Accessibility label for indeterminate activity indicator in progress */
-"MaterialActivityIndicatorProgressCompletedAccessibilityLabel" = "%ld Percent Complete";
+/* Accessibility value for indeterminate activity indicator in progress. */
+"MaterialActivityIndicatorInProgressAccessibilityValue" = "In Progress";
-/* Accessibility label for activity indicator progress halted */
-"MaterialActivityIndicatorProgressHaltedAccessibilityLabel" = "Progress Halted";
+/* Accessibility value for determinate activity indicator in progress. */
+"MaterialActivityIndicatorProgressCompletedAccessibilityValue" = "%ld Percent Complete";
+
+/* Accessibility value for activity indicator progress halted. */
+"MaterialActivityIndicatorProgressHaltedAccessibilityValue" = "Progress Halted";

MODIFY
components/ActivityIndicator/src/private/MaterialActivityIndicatorStrings.h
components/ActivityIndicator/src/private/MaterialActivityIndicatorStrings.h
// GENERATED BY: generate_string_tables.py
typedef enum {
- kStr_MaterialActivityIndicatorInProgressAccessibilityLabel = 0,
- kStr_MaterialActivityIndicatorProgressHaltedAccessibilityLabel = 1,
- kStr_MaterialActivityIndicatorProgressCompletedAccessibilityLabel = 2,
+ kStr_MaterialActivityIndicatorInProgressAccessibilityValue = 0,
+ kStr_MaterialActivityIndicatorAccessibilityLabel = 1,
+ kStr_MaterialActivityIndicatorProgressHaltedAccessibilityValue = 2,
+ kStr_MaterialActivityIndicatorProgressCompletedAccessibilityValue = 3,
} MaterialActivityIndicatorStringId;

MODIFY
components/ActivityIndicator/src/private/MaterialActivityIndicatorStrings_table.h
components/ActivityIndicator/src/private/MaterialActivityIndicatorStrings_table.h
// This table is to be indexed using the generated enum.
static NSString *const kMaterialActivityIndicatorStringTable[] = {
- @"MaterialActivityIndicatorInProgressAccessibilityLabel", // In Progress
- @"MaterialActivityIndicatorProgressHaltedAccessibilityLabel", // Progress Halted
- @"MaterialActivityIndicatorProgressCompletedAccessibilityLabel", // %ld Percent Complete
+ @"MaterialActivityIndicatorInProgressAccessibilityValue", // In Progress
+ @"MaterialActivityIndicatorAccessibilityLabel", // Activity Indicator
+ @"MaterialActivityIndicatorProgressHaltedAccessibilityValue", // Progress Halted
+ @"MaterialActivityIndicatorProgressCompletedAccessibilityValue", // %ld Percent Complete
};
-#define kNumMaterialActivityIndicatorStrings 3
+#define kNumMaterialActivityIndicatorStrings 4
#define kMaterialActivityIndicatorStringsOffset 0
#define kMaterialActivityIndicatorStringsEnd 10000
static NSString *const kMaterialActivityIndicatorStringsTableName = @"MaterialActivityIndicator";

Update Activity Indicator accessibility label and value (#3261)

The generated files were created with generate_string_tables.py
internally, then exported manually to the external
material-components-ios repo