2017-09-28 14:52:27 +03:00
|
|
|
|
using Xamarin.Forms.Internals;
|
|
|
|
|
|
|
|
|
|
namespace Xamarin.Forms.Platform.GTK
|
|
|
|
|
{
|
2018-09-20 22:11:20 +03:00
|
|
|
|
internal class ResourcesProvider : ISystemResourcesProvider
|
|
|
|
|
{
|
|
|
|
|
private const string TitleStyleKey = "HeaderLabelStyle";
|
|
|
|
|
private const string SubtitleStyleKey = "SubheaderLabelStyle";
|
|
|
|
|
private const string BodyStyleKey = "BodyLabelStyle";
|
|
|
|
|
private const string CaptionStyleKey = "CaptionLabelStyle";
|
|
|
|
|
private const string ListItemDetailTextStyleKey = "BodyLabelStyle";
|
|
|
|
|
private const string ListItemTextStyleKey = "BaseLabelStyle";
|
2017-09-28 14:52:27 +03:00
|
|
|
|
|
2018-09-20 22:11:20 +03:00
|
|
|
|
public IResourceDictionary GetSystemResources()
|
|
|
|
|
{
|
|
|
|
|
return new ResourceDictionary
|
|
|
|
|
{
|
|
|
|
|
[Device.Styles.TitleStyleKey] = GetStyle(TitleStyleKey),
|
|
|
|
|
[Device.Styles.SubtitleStyleKey] = GetStyle(SubtitleStyleKey),
|
|
|
|
|
[Device.Styles.BodyStyleKey] = GetStyle(BodyStyleKey),
|
|
|
|
|
[Device.Styles.CaptionStyleKey] = GetStyle(CaptionStyleKey),
|
|
|
|
|
[Device.Styles.ListItemDetailTextStyleKey] = GetStyle(ListItemDetailTextStyleKey),
|
|
|
|
|
[Device.Styles.ListItemTextStyleKey] = GetStyle(ListItemTextStyleKey)
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-09-28 14:52:27 +03:00
|
|
|
|
|
2018-09-20 22:11:20 +03:00
|
|
|
|
private Style GetStyle(string nativeKey)
|
|
|
|
|
{
|
|
|
|
|
var result = new Style(typeof(Label));
|
2017-09-28 14:52:27 +03:00
|
|
|
|
|
2018-09-20 22:11:20 +03:00
|
|
|
|
switch(nativeKey)
|
|
|
|
|
{
|
|
|
|
|
case TitleStyleKey:
|
|
|
|
|
result.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = 24 });
|
|
|
|
|
break;
|
|
|
|
|
case SubtitleStyleKey:
|
|
|
|
|
result.Setters.Add(new Setter { Property = Label.FontSizeProperty, Value = 20 });
|
|
|
|
|
break;
|
|
|
|
|
case BodyStyleKey:
|
|
|
|
|
result.Setters.Add(new Setter { Property = Label.TextColorProperty, Value = Color.Blue });
|
|
|
|
|
break;
|
|
|
|
|
case CaptionStyleKey:
|
|
|
|
|
break;
|
|
|
|
|
case ListItemTextStyleKey:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2017-09-28 14:52:27 +03:00
|
|
|
|
|
2018-09-20 22:11:20 +03:00
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|