mirror of
https://github.com/bitwarden/android.git
synced 2025-01-04 23:37:37 +03:00
1d4e742d66
* Forms update with CollectionView conversion * updates * removed unnecessary import
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using Android.Content;
|
|
using Bit.App.Controls;
|
|
using Bit.App.Utilities;
|
|
using Bit.Droid.Renderers;
|
|
using Xamarin.Forms;
|
|
using Xamarin.Forms.Platform.Android;
|
|
|
|
[assembly: ExportRenderer(typeof(ExtendedStackLayout), typeof(ExtendedStackLayoutRenderer))]
|
|
namespace Bit.Droid.Renderers
|
|
{
|
|
public class ExtendedStackLayoutRenderer : ViewRenderer
|
|
{
|
|
private static int? _bgResId;
|
|
|
|
public ExtendedStackLayoutRenderer(Context context) : base(context) { }
|
|
|
|
protected override void OnElementChanged(ElementChangedEventArgs<View> elementChangedEvent)
|
|
{
|
|
base.OnElementChanged(elementChangedEvent);
|
|
if (elementChangedEvent.NewElement != null)
|
|
{
|
|
SetBackgroundResource(GetBgResId());
|
|
}
|
|
}
|
|
|
|
private int GetBgResId()
|
|
{
|
|
if (_bgResId == null)
|
|
{
|
|
if (ThemeManager.GetTheme(true) == "nord")
|
|
{
|
|
_bgResId = Resource.Drawable.list_item_bg_nord;
|
|
}
|
|
else
|
|
{
|
|
_bgResId ??= ThemeManager.UsingLightTheme ? Resource.Drawable.list_item_bg :
|
|
Resource.Drawable.list_item_bg_dark;
|
|
}
|
|
}
|
|
return _bgResId.Value;
|
|
}
|
|
}
|
|
}
|