protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context) { if (_faTypeface == null) { _faTypeface = Typeface.CreateFromAsset(context.Assets, "FontAwesome.ttf"); } if (_miTypeface == null) { _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; if (_cell == null) { _cell = new AndroidCipherCell(context, cipherCell, _faTypeface, _miTypeface); } else { _cell.CipherViewCell.PropertyChanged -= CellPropertyChanged; } cipherCell.PropertyChanged += CellPropertyChanged; _cell.UpdateCell(cipherCell); _cell.UpdateColors(_textColor, _mutedColor, _disabledIconColor); return(_cell); }
protected override Android.Views.View GetCellCore(Cell item, Android.Views.View convertView, ViewGroup parent, Context context) { // TODO expand beyond light/dark detection once we support custom theme switching without app restart var themeChanged = _usingLightTheme != ThemeManager.UsingLightTheme; if (_faTypeface == null) { _faTypeface = Typeface.CreateFromAsset(context.Assets, "FontAwesome.ttf"); } if (_miTypeface == null) { _miTypeface = Typeface.CreateFromAsset(context.Assets, "MaterialIcons_Regular.ttf"); } if (_textColor == default(Android.Graphics.Color) || themeChanged) { _textColor = ThemeManager.GetResourceColor("TextColor").ToAndroid(); } if (_mutedColor == default(Android.Graphics.Color) || themeChanged) { _mutedColor = ThemeManager.GetResourceColor("MutedColor").ToAndroid(); } if (_disabledIconColor == default(Android.Graphics.Color) || themeChanged) { _disabledIconColor = ThemeManager.GetResourceColor("DisabledIconColor").ToAndroid(); } _usingLightTheme = ThemeManager.UsingLightTheme; var cipherCell = item as CipherViewCell; _cell = convertView as AndroidCipherCell; if (_cell == null) { _cell = new AndroidCipherCell(context, cipherCell, _faTypeface, _miTypeface); } else { _cell.CipherViewCell.PropertyChanged -= CellPropertyChanged; } cipherCell.PropertyChanged += CellPropertyChanged; _cell.UpdateCell(cipherCell); _cell.UpdateColors(_textColor, _mutedColor, _disabledIconColor); return(_cell); }