From 337965a7f79149efd3d41e215ceb13f04149a66b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 8 Jun 2019 22:29:22 -0400 Subject: [PATCH] set colors for cipher view cell --- .../Renderers/CipherViewCellRenderer.cs | 31 +++++++++++++++++++ src/App/Styles/Base.xaml | 1 - 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/Android/Renderers/CipherViewCellRenderer.cs b/src/Android/Renderers/CipherViewCellRenderer.cs index 3e7775a99..7ed6f9f91 100644 --- a/src/Android/Renderers/CipherViewCellRenderer.cs +++ b/src/Android/Renderers/CipherViewCellRenderer.cs @@ -23,6 +23,9 @@ namespace Bit.Droid.Renderers { private static Typeface _faTypeface; private static Typeface _miTypeface; + private static Android.Graphics.Color _textColor; + private static Android.Graphics.Color _mutedColor; + private static Android.Graphics.Color _disabledIconColor; private AndroidCipherCell _cell; @@ -37,6 +40,22 @@ namespace Bit.Droid.Renderers { _miTypeface = Typeface.CreateFromAsset(context.Assets, "MaterialIcons_Regular.ttf"); } + if(_textColor == default(Android.Graphics.Color)) + { + _textColor = ((Xamarin.Forms.Color)Xamarin.Forms.Application.Current.Resources["TextColor"]) + .ToAndroid(); + } + if(_mutedColor == default(Android.Graphics.Color)) + { + _mutedColor = ((Xamarin.Forms.Color)Xamarin.Forms.Application.Current.Resources["MutedColor"]) + .ToAndroid(); + } + if(_disabledIconColor == default(Android.Graphics.Color)) + { + _disabledIconColor = + ((Xamarin.Forms.Color)Xamarin.Forms.Application.Current.Resources["DisabledIconColor"]) + .ToAndroid(); + } var cipherCell = item as CipherViewCell; _cell = convertView as AndroidCipherCell; @@ -50,6 +69,7 @@ namespace Bit.Droid.Renderers } cipherCell.PropertyChanged += CellPropertyChanged; _cell.UpdateCell(cipherCell); + _cell.UpdateColors(_textColor, _mutedColor, _disabledIconColor); return _cell; } @@ -156,6 +176,17 @@ namespace Bit.Droid.Renderers } } + public void UpdateColors(Android.Graphics.Color textColor, Android.Graphics.Color mutedColor, + Android.Graphics.Color iconDisabledColor) + { + Name.SetTextColor(textColor); + SubTitle.SetTextColor(mutedColor); + Icon.SetTextColor(mutedColor); + SharedIcon.SetTextColor(mutedColor); + AttachmentsIcon.SetTextColor(mutedColor); + MoreButton.SetTextColor(iconDisabledColor); + } + private void MoreButton_Click(object sender, EventArgs e) { if(CipherViewCell.ButtonCommand?.CanExecute(CipherViewCell.Cipher) ?? false) diff --git a/src/App/Styles/Base.xaml b/src/App/Styles/Base.xaml index 6d463ed63..3598c8f94 100644 --- a/src/App/Styles/Base.xaml +++ b/src/App/Styles/Base.xaml @@ -2,7 +2,6 @@