Skip to content
This repository has been archived by the owner on Nov 12, 2020. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaseFlorell committed Dec 12, 2017
2 parents 4c804c4 + 951ae71 commit b24ba6c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 59 deletions.
107 changes: 57 additions & 50 deletions example/Xfx.Controls.Example/Features/Controls/ControlsPage.xaml
Expand Up @@ -17,65 +17,72 @@
</ResourceDictionary>
</ContentPage.Resources>
<ScrollView Padding="8">

<Grid RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />

<Grid RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>

<Label Grid.Row="0" Grid.Column="0" Text="ComboBox" />
<xfx:XfxComboBox Grid.Row="0"
Grid.Column="1"
Placeholder="Enter your email address"
ActivePlaceholderColor="BlueViolet"
ItemSelected="Email_ItemSelected"
Focused="Email_OnFocused"
Unfocused="Email_OnUnfocused"
SelectedItem="{Binding SelectedItem}"
Text="{Binding EmailAddress}"
ItemsSource="{Binding EmailSuggestions}"
SortingAlgorithm="{Binding SortingAlgorithm}" />

<Label Grid.Row="0" Grid.Column="0" Text="ComboBox" />
<xfx:XfxComboBox Grid.Row="0"
Grid.Column="1"
Placeholder="Enter your email address"
ActivePlaceholderColor="BlueViolet"
ItemSelected="Email_ItemSelected"
Focused="Email_OnFocused"
Unfocused="Email_OnUnfocused"
SelectedItem="{Binding SelectedItem}"
Text="{Binding EmailAddress}"
ItemsSource="{Binding EmailSuggestions}"
SortingAlgorithm="{Binding SortingAlgorithm}" />
<Label Grid.Row="1" Grid.Column="0" Text="Material Entry" />
<xfx:XfxEntry Grid.Row="1"
Grid.Column="1"
Placeholder="Enter your name"
Text="{Binding Name}"
ErrorText="{Binding NameErrorText}" />

<Label Grid.Row="1" Grid.Column="0" Text="Material Entry" />
<xfx:XfxEntry Grid.Row="1"
Grid.Column="1"
Placeholder="Enter your name"
Text="{Binding Name}"
ErrorText="{Binding NameErrorText}" />
<Label Grid.Row="2" Grid.Column="0" Text="No Error Message" />
<xfx:XfxEntry Grid.Row="2"
Grid.Column="1"
Placeholder="Enter your name (error message won't show)"
ErrorDisplay="None"
Text="{Binding Name}"
ErrorText="{Binding NameErrorText}" />

<Label Grid.Row="2" Grid.Column="0" Text="No Error Message" />
<xfx:XfxEntry Grid.Row="2"
Grid.Column="1"
Placeholder="Enter your name (error message won't show)"
ErrorDisplay="None"
Text="{Binding Name}"
ErrorText="{Binding NameErrorText}" />
<Label Grid.Row="3" Grid.Column="0" Text="No Floating Label" />
<xfx:XfxEntry Grid.Row="3"
Grid.Column="1"
Placeholder="This hint won't float, and it's a password entry"
Text="{Binding Foo}"
ErrorText="{Binding FooErrorText}"
IsPassword="True"
FloatingHintEnabled="False" />

<Label Grid.Row="3" Grid.Column="0" Text="No Floating Label" />
<xfx:XfxEntry Grid.Row="3"
Grid.Column="1"
Placeholder="This hint won't float, and it's a password entry"
Text="{Binding Foo}"
ErrorText="{Binding FooErrorText}"
IsPassword="True"
FloatingHintEnabled="False" />
<Label Grid.Row="4" Grid.Column="0" Text="Change Colors" />
<xfx:XfxEntry Grid.Row="4"
Grid.Column="1"
Placeholder="Change Colors"
PlaceholderColor="DodgerBlue"
ActivePlaceholderColor="BlueViolet"
TextColor="Crimson"
Text="{Binding Foo}" />

<Label Grid.Row="4" Grid.Column="0" Text="Change Colors" />
<xfx:XfxEntry Grid.Row="4"
Grid.Column="1"
Placeholder="Change Colors"
PlaceholderColor="DodgerBlue"
ActivePlaceholderColor="BlueViolet"
TextColor="Crimson"
Text="{Binding Foo}" />
<Label Grid.Row="5" Grid.Column="0" Text="Font Sizes" />
<xfx:XfxEntry Grid.Row="5"
Grid.Column="1"
FontSize="10"
Placeholder="Enter something "/>
</Grid>
</ScrollView>
</ContentPage>
16 changes: 7 additions & 9 deletions src/Xfx.Controls.Droid/Renderers/XfxEntryRendererDroid.cs
Expand Up @@ -2,7 +2,6 @@
using Android.Content;
using Android.Content.Res;
using Android.Support.Design.Widget;
using Android.Support.V4.Graphics.Drawable;
using Android.Support.V4.View;
using Android.Support.V7.Widget;
using Android.Text;
Expand Down Expand Up @@ -32,7 +31,6 @@ public class XfxEntryRendererDroid : FormsAppCompat.ViewRenderer<XfxEntry, TextI
TextView.IOnEditorActionListener
{
private bool _hasFocus;
private ColorStateList _efaultTextColor;
private ColorStateList _defaultTextColor;

public XfxEntryRendererDroid(Context context) : base(context)
Expand Down Expand Up @@ -74,6 +72,7 @@ protected override TextInputLayout CreateNativeControl()
{
SupportBackgroundTintList = ColorStateList.ValueOf(GetPlaceholderColor())
};
editText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
textInputLayout.AddView(editText);
return textInputLayout;
}
Expand Down Expand Up @@ -108,15 +107,15 @@ protected override void OnElementChanged(ElementChangedEventArgs<XfxEntry> e)
EditText.ImeOptions = ImeAction.Done;

SetText();
SetInputType();
SetHintText();
SetErrorText();
SetFontAttributesSizeAndFamily();
SetInputType();
SetTextColor();
SetHorizontalTextAlignment();
SetErrorText();
SetFloatingHintEnabled();
SetIsEnabled();
SetErrorDisplay();
SetFont();
SetLabelAndUnderlineColor();
}
}
Expand All @@ -143,7 +142,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE
else if ((e.PropertyName == Entry.FontAttributesProperty.PropertyName) ||
(e.PropertyName == Entry.FontFamilyProperty.PropertyName) ||
(e.PropertyName == Entry.FontSizeProperty.PropertyName))
SetFont();
SetFontAttributesSizeAndFamily();
else if (e.PropertyName == XfxEntry.ActivePlaceholderColorProperty.PropertyName ||
e.PropertyName == Entry.PlaceholderColorProperty.PropertyName)
SetLabelAndUnderlineColor();
Expand Down Expand Up @@ -272,10 +271,9 @@ protected void HideKeyboard()
manager.HideSoftInputFromWindow(EditText.WindowToken, 0);
}

private void SetFont()
private void SetFontAttributesSizeAndFamily()
{
var tf = Element.ToTypeface();
EditText.Typeface = Control.Typeface = tf;
EditText.Typeface = Control.Typeface = Element.ToTypeface();
EditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
}

Expand Down

0 comments on commit b24ba6c

Please sign in to comment.