1
0
mirror of https://github.com/bitwarden/mobile synced 2025-12-26 13:13:28 +00:00

Android font size adjustments

This commit is contained in:
Kyle Spearrin
2016-08-22 18:59:15 -04:00
parent aa880264e3
commit 610789fd6d
20 changed files with 76 additions and 28 deletions

View File

@@ -0,0 +1,26 @@
using System;
using System.ComponentModel;
using Bit.Android.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(Button), typeof(CustomButtonRenderer))]
namespace Bit.Android.Controls
{
public class CustomButtonRenderer : ButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{
base.OnElementChanged(e);
if(Control.TextSize == (float)Device.GetNamedSize(NamedSize.Default, typeof(Button)))
{
Control.TextSize = (float)Device.GetNamedSize(NamedSize.Medium, typeof(Button));
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
}
}
}

View File

@@ -8,7 +8,7 @@ using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(ExtendedButton), typeof(ExtendedButtonRenderer))]
namespace Bit.Android.Controls
{
public class ExtendedButtonRenderer : ButtonRenderer
public class ExtendedButtonRenderer : CustomButtonRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Button> e)
{

View File

@@ -16,7 +16,7 @@ namespace Bit.Android.Controls
var view = (ExtendedPicker)Element;
Control.TextSize = (float)Device.GetNamedSize(NamedSize.Small, typeof(Picker));
Control.TextSize = (float)Device.GetNamedSize(NamedSize.Medium, typeof(Picker));
SetBorder(view);
}

View File

@@ -6,6 +6,7 @@ using Bit.App.Controls;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using AView = Android.Views.View;
using Android.Widget;
[assembly: ExportRenderer(typeof(ExtendedSwitchCell), typeof(ExtendedSwitchCellRenderer))]
namespace Bit.Android.Controls
@@ -30,6 +31,19 @@ namespace Bit.Android.Controls
{
View.SetMainTextColor(Color.FromHex("777777"));
}
if(View.ChildCount > 1)
{
var layout = View.GetChildAt(1) as LinearLayout;
if(layout != null && layout.ChildCount > 0)
{
var textView = layout.GetChildAt(0) as TextView;
if(textView != null)
{
textView.TextSize = (float)Device.GetNamedSize(NamedSize.Medium, typeof(Label));
}
}
}
}
return View;

View File

@@ -38,6 +38,19 @@ namespace Bit.Android.Controls
image.SetPadding(10, 10, 30, 10);
View.SetAccessoryView(image);
}
if(View.ChildCount > 1)
{
var layout = View.GetChildAt(1) as LinearLayout;
if(layout != null && layout.ChildCount > 0)
{
var textView = layout.GetChildAt(0) as TextView;
if(textView != null)
{
textView.TextSize = (float)Device.GetNamedSize(NamedSize.Medium, typeof(Label));
}
}
}
}
return View;