From cd60c3da2aef1667182e934d868f65e71b82620e Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 12 Jun 2019 09:13:13 -0400 Subject: [PATCH] fixed size icons --- src/Android/Android.csproj | 1 + src/Android/Effects/FixedSizeEffect.cs | 26 +++++++++++++++++++ .../Renderers/CipherViewCellRenderer.cs | 2 +- .../CipherViewCell/CipherViewCell.xaml | 2 +- src/App/Effects/FixedSizeEffect.cs | 11 ++++++++ .../Vault/GroupingsPage/GroupingsPage.xaml | 13 +++++++--- src/App/Styles/Android.xaml | 6 +++++ src/App/Styles/Base.xaml | 2 -- 8 files changed, 55 insertions(+), 8 deletions(-) create mode 100644 src/Android/Effects/FixedSizeEffect.cs create mode 100644 src/App/Effects/FixedSizeEffect.cs diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj index a514138f6..29f1d56e5 100644 --- a/src/Android/Android.csproj +++ b/src/Android/Android.csproj @@ -110,6 +110,7 @@ + diff --git a/src/Android/Effects/FixedSizeEffect.cs b/src/Android/Effects/FixedSizeEffect.cs new file mode 100644 index 000000000..8d31aac8a --- /dev/null +++ b/src/Android/Effects/FixedSizeEffect.cs @@ -0,0 +1,26 @@ +using Android.Support.Design.BottomNavigation; +using Android.Support.Design.Widget; +using Android.Views; +using Android.Widget; +using Bit.Droid.Effects; +using Xamarin.Forms; +using Xamarin.Forms.Platform.Android; + +[assembly: ExportEffect(typeof(FixedSizeEffect), "FixedSizeEffect")] +namespace Bit.Droid.Effects +{ + public class FixedSizeEffect : PlatformEffect + { + protected override void OnAttached() + { + if(Element is Label label && Control is TextView textView) + { + textView.SetTextSize(Android.Util.ComplexUnitType.Pt, (float)label.FontSize); + } + } + + protected override void OnDetached() + { + } + } +} \ No newline at end of file diff --git a/src/Android/Renderers/CipherViewCellRenderer.cs b/src/Android/Renderers/CipherViewCellRenderer.cs index d93e12172..774fd40dc 100644 --- a/src/Android/Renderers/CipherViewCellRenderer.cs +++ b/src/Android/Renderers/CipherViewCellRenderer.cs @@ -118,7 +118,7 @@ namespace Bit.Droid.Renderers MoreButton.Typeface = _miTypeface; var small = (float)Device.GetNamedSize(NamedSize.Small, typeof(Label)); - Icon.SetTextSize(ComplexUnitType.Sp, 22.0952380952381F); + Icon.SetTextSize(ComplexUnitType.Pt, 10); Name.SetTextSize(ComplexUnitType.Sp, (float)Device.GetNamedSize(NamedSize.Medium, typeof(Label))); SubTitle.SetTextSize(ComplexUnitType.Sp, small); SharedIcon.SetTextSize(ComplexUnitType.Sp, small); diff --git a/src/App/Controls/CipherViewCell/CipherViewCell.xaml b/src/App/Controls/CipherViewCell/CipherViewCell.xaml index 44991a3d1..696223100 100644 --- a/src/App/Controls/CipherViewCell/CipherViewCell.xaml +++ b/src/App/Controls/CipherViewCell/CipherViewCell.xaml @@ -32,7 +32,7 @@ Grid.RowSpan="2" HorizontalOptions="Center" VerticalOptions="Center" - StyleClass="list-icon" /> + StyleClass="list-icon, list-icon-platform" /> - + + StyleClass="list-icon, list-icon-platform"> + + + +