void SetTexts() { HeaderLabel.SetAttributedText(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); InitLabel(IntroLabel, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_INTRO, 16, 20); InitLabel(Header1Label, FontType.FontBold, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE, 16, 20); InitLabel(Paragraph1Label1, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT, 16, 20); InitLabel(Paragraph1Label2, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT2, 16, 20); InitLabel(Header2Label, FontType.FontBold, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE, 16, 20); InitLabel(Paragraph2Label1, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT, 16, 20); InitLabel(Paragraph2Label2, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT2, 16, 20); InitLabel(Paragraph2Label3, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT3, 16, 20); InitLabel(Paragraph2Label4, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT4, 16, 20); InitLabel(Header3Label, FontType.FontBold, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE, 16, 20); InitLabel(Paragraph3Label1, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT, 16, 20); InitLabel(Header4Label, FontType.FontBold, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_TITLE, 16, 20); InitLabel(Paragraph4Label1, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT, 16, 20); InitLabel(Paragraph4Label2, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT2, 16, 20); HeaderLabel.AccessibilityTraits = UIAccessibilityTrait.Header; Header1Label.AccessibilityTraits = UIAccessibilityTrait.Header; Header2Label.AccessibilityTraits = UIAccessibilityTrait.Header; Header3Label.AccessibilityTraits = UIAccessibilityTrait.Header; Header4Label.AccessibilityTraits = UIAccessibilityTrait.Header; NSMutableAttributedString text = new NSMutableAttributedString(); text.Append(ApplyStylingToText(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT3, FontType.FontRegular)); // Necessary to unify horizontal alignment with the rest of the text on the page Paragraph4Label3.TextContainerInset = UIEdgeInsets.Zero; Paragraph4Label3.TextContainer.LineFragmentPadding = 0; Paragraph4Label3.AccessibilityTraits = UIAccessibilityTrait.Link; Paragraph4Label3.WeakDelegate = new OpenTextViewUrlInWebviewDelegate(this); Paragraph4Label3.AttributedText = text; Paragraph4Label3.WeakLinkTextAttributes = new NSDictionary( UIStringAttributeKey.ForegroundColor, ColorHelper.LINK_COLOR, UIStringAttributeKey.UnderlineStyle, new NSNumber(1)); //Accessibility BackButton.AccessibilityLabel = SettingsViewModel.BACK_BUTTON_ACCESSIBILITY_TEXT; HeaderLabel.AccessibilityAttributedLabel = AccessibilityUtils.RemovePoorlySpokenSymbols(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); Header1Label.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE); Paragraph1Label1.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT); Paragraph1Label2.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT2); Header2Label.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE); Paragraph2Label1.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT); Paragraph2Label2.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT2); Paragraph2Label3.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT3); Paragraph2Label4.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT4); Header3Label.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE); Paragraph3Label1.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT); Header4Label.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_TITLE); Paragraph4Label1.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT); Paragraph4Label2.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT2); Paragraph4Label3.AccessibilityIdentifier = "contentTextIdentifier"; Paragraph4Label3.IsAccessibilityElement = true; }
public override void ViewDidLoad() { base.ViewDidLoad(); NSAttributedStringDocumentAttributes documentAttributes = new NSAttributedStringDocumentAttributes { DocumentType = NSDocumentType.HTML, StringEncoding = NSStringEncoding.UTF8 }; NSError error = null; NSAttributedString attributedString = new NSAttributedString(NSData.FromString(ForceUpdateViewModel.FORCE_UPDATE_MESSAGE, NSStringEncoding.UTF8), documentAttributes, ref error); if (error != null) { LogUtils.LogMessage(Enums.LogSeverity.ERROR, error.LocalizedDescription); } //Ensuring text is resiezed correctly when font size is increased StyleUtil.InitLabekWithSpacingAndHTMLFormatting( TextLabel, StyleUtil.FontType.FontBold, attributedString, 1.28, 24, 30, UITextAlignment.Center); TextLabel.TextColor = ColorHelper.TEXT_COLOR_ON_BACKGROUND; StyleUtil.InitButtonStyling(AppStoreLinkButton, ForceUpdateViewModel.FORCE_UPDATE_BUTTON_APPSTORE_IOS); AppStoreLinkButton.AccessibilityTraits = UIAccessibilityTrait.Link; FhiLogo.AccessibilityLabel = ForceUpdateViewModel.SMITTESPORING_FHI_LOGO_ACCESSIBILITY; TextLabel.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(ForceUpdateViewModel.FORCE_UPDATE_MESSAGE); }
void SetOnOffBtnState(bool isRunning) { if (isRunning) { string accessibilityText = InfectionStatusViewModel.INFECTION_STATUS_STOP_BUTTON_ACCESSIBILITY_TEXT; string buttonText = InfectionStatusViewModel.INFECTION_STATUS_STOP_BUTTON_TEXT; OnOffBtn.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(accessibilityText); OnOffBtn.BackgroundColor = UIColor.Clear; OnOffBtn.Layer.BorderColor = ColorHelper.PRIMARY_COLOR.CGColor; OnOffBtn.Layer.BorderWidth = 1; OnOffBtn.SetTitleColor(ColorHelper.PRIMARY_COLOR, UIControlState.Normal); OnOffBtn.SetTitle(buttonText, UIControlState.Normal); } else { string accessibilityText = InfectionStatusViewModel.INFECTION_STATUS_START_BUTTON_ACCESSIBILITY_TEXT; string buttonText = InfectionStatusViewModel.INFECTION_STATUS_START_BUTTON_TEXT; OnOffBtn.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(accessibilityText); OnOffBtn.BackgroundColor = ColorHelper.PRIMARY_COLOR; OnOffBtn.Layer.BorderColor = UIColor.Clear.CGColor; OnOffBtn.Layer.BorderWidth = 0; OnOffBtn.SetTitleColor(ColorHelper.TEXT_COLOR_ON_PRIMARY, UIControlState.Normal); OnOffBtn.SetTitle(buttonText, UIControlState.Normal); } }
void UpdateNewIndicatorView() { InvokeOnMainThread(() => { NewIndicatorView.Hidden = !_viewModel.ShowNewMessageIcon; MessageIcon.Image = _viewModel.ShowNewMessageIcon ? UIImage.FromBundle("notification_active") : UIImage.FromBundle("notification_inactive"); NewRegistrationLbl.Text = _viewModel.NewMessageSubheaderTxt; _messageViewBtn.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(_viewModel.NewMessageAccessibilityText); }); }
void SetAccessibility() { TitleLbl.AccessibilityTraits = UIAccessibilityTrait.Header; ListExplainLbl.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(QuestionnaireCountriesViewModel.COUNTRY_QUESTIONAIRE_FOOTER); CloseButton.AccessibilityLabel = QuestionnaireViewModel.REGISTER_QUESTIONAIRE_ACCESSIBILITY_CLOSE_BUTTON_TEXT; if (UIAccessibility.IsVoiceOverRunning) { this.SetAccessibilityElements(NSArray.FromNSObjects(ScrollView, NextBtn, CloseButton)); PostAccessibilityNotificationAndReenableElement(CloseButton, TitleLbl); } }
void SetTexts() { string intro = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_INTRO; string par1Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE; string par1Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT; string par2Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE; string par2Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT; string par3Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE; string par3Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT; string par4Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_TITLE; string par4Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT; string contentText = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_INTRO + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_CONTENT; HeaderLabel.SetAttributedText(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); ContentText.TextContainerInset = new UIEdgeInsets(0, 20, 20, 40); BackButton.AccessibilityLabel = SettingsViewModel.SETTINGS_CHILD_PAGE_ACCESSIBILITY_BACK_BUTTON; InitLabel(UrlLabel, FontType.FontRegular, SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_4_LINK_TEXT, 16, 28); NSMutableAttributedString text = new NSMutableAttributedString(); text.Append(ApplyStylingToText(intro, FontType.FontRegular, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par1Title, FontType.FontBold, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par1Content, FontType.FontRegular, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par2Title, FontType.FontBold, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par2Content, FontType.FontRegular, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par3Title, FontType.FontBold, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par3Content, FontType.FontRegular, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par4Title, FontType.FontBold, 1.28, 16, 22, false)); text.Append(ApplyStylingToText(par4Content, FontType.FontRegular, 1.28, 16, 22, false)); ContentText.AttributedText = text; //Accessibility HeaderLabel.AccessibilityAttributedLabel = AccessibilityUtils.RemovePoorlySpokenSymbols(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); ContentText.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(contentText); ContentText.AccessibilityIdentifier = "contentTextIdentifier"; ContentText.IsAccessibilityElement = true; }
void SetTexts() { string intro = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_INTRO; string par1Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE; string par1Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT; string par2Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE; string par2Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT; string par3Title = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE; string par3Content = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT; string contentText = SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_INTRO + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_1_CONTENT + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_2_CONTENT + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_TITLE + SettingsPage2ViewModel.SETTINGS_PAGE_2_CONTENT_TEXT_PARAGRAPH_3_CONTENT; HeaderLabel.SetAttributedText(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); ContentText.TextContainerInset = new UIEdgeInsets(0, 20, 20, 40); BackButton.AccessibilityLabel = SettingsViewModel.SETTINGS_CHILD_PAGE_ACCESSIBILITY_BACK_BUTTON; NSMutableAttributedString text = new NSMutableAttributedString(); text.Append(ApplyStylingToText(intro, FontType.FontRegular)); text.Append(ApplyStylingToText(par1Title, FontType.FontBold)); text.Append(ApplyStylingToText(par1Content, FontType.FontRegular)); text.Append(ApplyStylingToText(par2Title, FontType.FontBold)); text.Append(ApplyStylingToText(par2Content, FontType.FontRegular)); text.Append(ApplyStylingToText(par3Title, FontType.FontBold)); text.Append(ApplyStylingToText(par3Content, FontType.FontRegular)); ContentText.WeakDelegate = new OpenTextViewUrlInWebviewDelegate(this); ContentText.AttributedText = text; ContentText.WeakLinkTextAttributes = new NSDictionary( UIStringAttributeKey.ForegroundColor, ColorHelper.TEXT_COLOR_ON_BACKGROUND, UIStringAttributeKey.UnderlineStyle, new NSNumber(1)); //Accessibility HeaderLabel.AccessibilityAttributedLabel = AccessibilityUtils.RemovePoorlySpokenSymbols(SettingsPage2ViewModel.SETTINGS_PAGE_2_HEADER); ContentText.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(contentText); ContentText.AccessibilityIdentifier = "contentTextIdentifier"; ContentText.IsAccessibilityElement = true; }
private void SetAccessibilityText(UILabel label, string text) { label.IsAccessibilityElement = true; label.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(text); }
void SetAccessibility() { ListExplainLbl.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(QuestionnaireCountriesViewModel.COUNTRY_QUESTIONAIRE_FOOTER); CloseButton.AccessibilityLabel = QuestionnaireViewModel.REGISTER_QUESTIONAIRE_ACCESSIBILITY_CLOSE_BUTTON_TEXT; }
protected void SetAccessibilityText(UITextView textView, string text) { textView.IsAccessibilityElement = true; textView.AccessibilityLabel = AccessibilityUtils.RemovePoorlySpokenSymbolsString(text); }