Skip to content

Commit 4e63c5d

Browse files
Merge branch 'develop'
2 parents 74dbbb5 + 983d432 commit 4e63c5d

File tree

10 files changed

+50
-31
lines changed

10 files changed

+50
-31
lines changed

MaterialDesignControls.nuspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
33
<metadata minClientVersion="2.8.1">
44
<id>Plugin.MaterialDesignControls</id>
5-
<version>1.10.7</version>
5+
<version>1.10.8</version>
66
<title>MaterialDesignControls Plugin for Xamarin Forms</title>
77
<authors>Horus</authors>
88
<owners>AgustinBonillaHorus</owners>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.materialdesigncontrols.example.MaterialDesignControls">
3-
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
44
<application android:label="ExampleMaterialDesignControls.Android"></application>
55
</manifest>

example/ExampleMaterialDesignControls/Pages/MaterialEditorPage.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
Placeholder="Enter your description"
5050
LeadingIcon="email.png"
5151
TabIndex="4"
52+
Text="Testing description"
5253
IsEnabled="False" />
5354

5455
<material:MaterialEditor

example/ExampleMaterialDesignControls/Pages/MaterialEntryPage.xaml

+10-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
ReturnType="Done" ReturnCommand="{Binding TapCommand}" />
2727
<material:MaterialEntry Type="Filled" LabelText="Phone" Placeholder="Enter your phone" Keyboard="Telephone" TabIndex="5" ReturnType="Next"
2828
FocusedBorderColor="LightGreen" FocusedTextColor="Green" FocusedLabelTextColor="Green" HorizontalTextAlignment="Center" />
29-
<material:MaterialEntry Type="Filled" LabelText="Phone" Placeholder="Enter your phone" Keyboard="Telephone" TabIndex="5" ReturnType="Next" IsEnabled="False" />
29+
30+
<material:MaterialEntry
31+
Type="Filled"
32+
LabelText="Phone"
33+
Placeholder="Enter your phone"
34+
Keyboard="Telephone"
35+
TabIndex="5"
36+
ReturnType="Next"
37+
Text="+598099123456"
38+
IsEnabled="False" />
3039

3140
<material:MaterialEntry Type="Filled" LabelText="Phone (SVG trailing icon)" Placeholder="Enter your phone" Keyboard="Telephone" TabIndex="5"
3241
TrailingIconCommand="{Binding HelpCommand}" TrailingIconCommandParameter="Enter your phone"

example/ExampleMaterialDesignControls/Pages/MaterialEntryPage.xaml.cs

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Net.Mail;
4-
using System.Windows.Input;
5-
using ExampleMaterialDesignControls.ViewModels;
1+
using ExampleMaterialDesignControls.ViewModels;
62
using Xamarin.Forms;
73

84
namespace ExampleMaterialDesignControls.Pages
@@ -29,4 +25,4 @@ private void TxtName_Focused(object sender, FocusEventArgs e)
2925
txtName.LabelText = "Name* - Focused";
3026
}
3127
}
32-
}
28+
}

src/MaterialDesignControls.Android/MaterialDesignControls.Android.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<OutputType>Library</OutputType>
1111
<RootNamespace>Plugin.MaterialDesignControls.Android</RootNamespace>
1212
<AssemblyName>Plugin.MaterialDesignControls.Android</AssemblyName>
13-
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
1414
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
1515
<AndroidResgenClass>Resource</AndroidResgenClass>
1616
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>

src/MaterialDesignControls.Android/Renderers/MaterialEditorRenderer.cs

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Plugin.MaterialDesignControls.Implementations;
55
using Xamarin.Forms;
66
using Xamarin.Forms.Platform.Android;
7+
using Android.Views.InputMethods;
78

89
[assembly: ExportRenderer(typeof(CustomEditor), typeof(Plugin.MaterialDesignControls.Android.MaterialEditorRenderer))]
910

@@ -19,18 +20,20 @@ public MaterialEditorRenderer(Context context) : base(context)
1920
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
2021
{
2122
base.OnElementChanged(e);
22-
if (this.Control != null)
23+
24+
if (Control != null)
2325
{
24-
this.Control.Background = new ColorDrawable(AndroidGraphics.Color.Transparent);
25-
this.Control.SetPadding(4, 0, 0, 0);
26+
Control.Background = new ColorDrawable(AndroidGraphics.Color.Transparent);
27+
Control.SetPadding(4, 0, 0, 0);
28+
Control.ImeOptions = (ImeAction)ImeFlags.NoExtractUi;
2629
}
2730

2831
if (e.NewElement != null)
2932
{
3033
var element = e.NewElement as CustomEditor;
31-
this.Control.Hint = element.Placeholder;
32-
this.Control.SetHintTextColor(element.PlaceholderColor.ToAndroid());
34+
Control.Hint = element.Placeholder;
35+
Control.SetHintTextColor(element.PlaceholderColor.ToAndroid());
3336
}
3437
}
3538
}
36-
}
39+
}

src/MaterialDesignControls.Android/Renderers/MaterialEntryRenderer.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using System;
2-
using Android.Content;
1+
using Android.Content;
32
using Android.Graphics.Drawables;
43
using AndroidGraphics = Android.Graphics;
54
using Plugin.MaterialDesignControls.Implementations;
65
using Xamarin.Forms;
76
using Xamarin.Forms.Platform.Android;
7+
using Android.Views.InputMethods;
88

99
[assembly: ExportRenderer(typeof(CustomEntry), typeof(Plugin.MaterialDesignControls.Android.MaterialEntryRenderer))]
1010

@@ -20,11 +20,13 @@ public MaterialEntryRenderer(Context context) : base(context)
2020
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
2121
{
2222
base.OnElementChanged(e);
23-
if (this.Control != null)
23+
24+
if (Control != null)
2425
{
25-
this.Control.Background = new ColorDrawable(AndroidGraphics.Color.Transparent);
26-
this.Control.SetPadding(4, 0, 0, 0);
26+
Control.Background = new ColorDrawable(AndroidGraphics.Color.Transparent);
27+
Control.SetPadding(4, 0, 0, 0);
28+
Control.ImeOptions = (ImeAction)ImeFlags.NoExtractUi;
2729
}
2830
}
2931
}
30-
}
32+
}

src/MaterialDesignControls/Controls/MaterialEditor.xaml.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Runtime.CompilerServices;
4-
using System.Text.RegularExpressions;
5-
using Plugin.MaterialDesignControls.Animations;
6-
using Plugin.MaterialDesignControls.Implementations;
73
using Xamarin.Forms;
84
using Xamarin.Forms.Xaml;
95

@@ -274,7 +270,13 @@ private void SetClearIconIsVisible()
274270

275271
protected override void SetIsEnabled()
276272
{
277-
txtEditor.IsEnabled = IsEnabled;
273+
if (Device.RuntimePlatform == Device.iOS)
274+
txtEditor.IsEnabled = IsEnabled;
275+
else
276+
{
277+
// Workaround to a disabled text color issue in Android
278+
txtEditor.IsReadOnly = !IsEnabled;
279+
}
278280
}
279281

280282
protected override void SetPadding()
@@ -354,4 +356,4 @@ private void TxtEntry_TextChanged(object sender, TextChangedEventArgs e)
354356

355357
#endregion Methods
356358
}
357-
}
359+
}

src/MaterialDesignControls/Controls/MaterialEntry.xaml.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,13 @@ private void SetClearIconIsVisible()
447447

448448
protected override void SetIsEnabled()
449449
{
450-
txtEntry.IsEnabled = IsEnabled;
450+
if (Device.RuntimePlatform == Device.iOS)
451+
txtEntry.IsEnabled = IsEnabled;
452+
else
453+
{
454+
// Workaround to a disabled text color issue in Android
455+
txtEntry.IsReadOnly = !IsEnabled;
456+
}
451457
}
452458

453459
protected override void SetPadding()
@@ -549,13 +555,13 @@ private void FocusNextElement(int currentTabIndex)
549555
var nextElement = this.FindNextElement(true, tabIndexes, ref currentTabIndex);
550556
if (nextElement != null)
551557
{
552-
if (nextElement is CustomEntry nextEntry && nextEntry.IsEnabled)
558+
if (nextElement is CustomEntry nextEntry && nextEntry.IsEnabled && !nextEntry.IsReadOnly)
553559
{
554560
nextEntry.Focus();
555561
string textInsideInput = nextEntry.Text;
556562
nextEntry.CursorPosition = string.IsNullOrEmpty(textInsideInput) ? 0 : textInsideInput.Length;
557563
}
558-
else if (nextElement is CustomEditor nextEditor && nextEditor.IsEnabled)
564+
else if (nextElement is CustomEditor nextEditor && nextEditor.IsEnabled && !nextEditor.IsReadOnly)
559565
{
560566
nextEditor.Focus();
561567
}

0 commit comments

Comments
 (0)