diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index 4b42db250..c5f838ff8 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -159,6 +159,7 @@ + diff --git a/src/Android/Renderers/CustomLabelRenderer.cs b/src/Android/Renderers/CustomLabelRenderer.cs new file mode 100644 index 000000000..62287087d --- /dev/null +++ b/src/Android/Renderers/CustomLabelRenderer.cs @@ -0,0 +1,31 @@ +using System; +using Bit.App.Controls; +using System.ComponentModel; +using Xamarin.Forms.Platform.Android; +using Android.Content; +using Xamarin.Forms; +using Bit.Droid.Renderers; + +[assembly: ExportRenderer(typeof(CustomLabel), typeof(CustomLabelRenderer))] +namespace Bit.Droid.Renderers +{ + public class CustomLabelRenderer : LabelRenderer + { + public CustomLabelRenderer(Context context) + : base(context) + { } + + protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e) + { + var label = sender as CustomLabel; + switch (e.PropertyName) + { + case nameof(CustomLabel.AutomationId): + Control.ContentDescription = label.AutomationId; + break; + } + base.OnElementPropertyChanged(sender, e); + } + } +} + diff --git a/src/App/App.csproj b/src/App/App.csproj index 83e1ee879..54d589ef7 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -145,6 +145,7 @@ + @@ -440,5 +441,6 @@ + diff --git a/src/App/Controls/CustomLabel.cs b/src/App/Controls/CustomLabel.cs new file mode 100644 index 000000000..e822d3304 --- /dev/null +++ b/src/App/Controls/CustomLabel.cs @@ -0,0 +1,13 @@ +using System; +using Xamarin.Forms; + +namespace Bit.App.Controls +{ + public class CustomLabel : Label + { + public CustomLabel() + { + } + } +} + diff --git a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml index 03400d693..4976573af 100644 --- a/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml +++ b/src/App/Pages/Settings/SettingsPage/SettingsPage.xaml @@ -20,8 +20,7 @@ x:Key="regularTemplate" x:DataType="pages:SettingsPageListItem"> + StyleClass="list-row, list-row-platform"> - SubLabelTextEnabled ? ThemeManager.GetResourceColor("SuccessColor") : ThemeManager.GetResourceColor("MutedColor"); - public string AutomationId + + public string AutomationIdSettingName { get { - if (!UseFrame) + return AutomationIdsHelper.AddSuffixFor( + UseFrame ? "EnabledPolicy" + : AutomationIdsHelper.ToEnglishTitleCase(Name) + , SuffixType.Cell); + } + } + + public string AutomationIdSettingStatus + { + get + { + if (UseFrame) { - var idText = new CultureInfo("en-US", false) - .TextInfo - .ToTitleCase(Name) - .Replace(" ", String.Empty) - .Replace("-", String.Empty); - return $"{idText}Cell"; - } - else - { - return "EnabledPolicyCell"; + return null; } + + return AutomationIdsHelper.AddSuffixFor(AutomationIdsHelper.ToEnglishTitleCase(Name), SuffixType.SettingValue); } } } diff --git a/src/App/Pages/Vault/CipherDetailsPage.xaml b/src/App/Pages/Vault/CipherDetailsPage.xaml index 1f82eef19..dc1d6bdf0 100644 --- a/src/App/Pages/Vault/CipherDetailsPage.xaml +++ b/src/App/Pages/Vault/CipherDetailsPage.xaml @@ -72,8 +72,7 @@ + StyleClass="list-row, list-row-platform" + AutomationId="{Binding AutomationId}"> + StyleClass="list-title" + AutomationId="ItemNameLabel" /> @@ -96,7 +99,8 @@ Spacing="0" Padding="0" VerticalOptions="FillAndExpand" - StyleClass="list-row-header-container, list-row-header-container-platform"> + StyleClass="list-row-header-container, list-row-header-container-platform" + AutomationId="{Binding AutomationId}"> @@ -105,7 +109,8 @@ StyleClass="list-header, list-header-platform" /> @@ -148,7 +153,8 @@ IsVisible="{Binding ShowNoData}"> + HorizontalTextAlignment="Center" + AutomationId="NoDataDisplayed">