[Tizen] Fix the DisplayActionSheet (#12188)
* [Tizen] Fix button style issue in DisplayActionSheet * [Tizen] Add null check for avoiding null reference exceptions
This commit is contained in:
Родитель
1b495da2c5
Коммит
7200e07dc7
|
@ -142,10 +142,12 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
var destruction = new Native.Button(alert)
|
||||
{
|
||||
Text = arguments.Destruction,
|
||||
Style = ButtonStyle.Text,
|
||||
TextColor = EColor.Red,
|
||||
AlignmentX = -1
|
||||
};
|
||||
destruction.SetWatchTextStyle();
|
||||
//TextColor should be set after applying style
|
||||
destruction.TextColor = EColor.Red;
|
||||
|
||||
destruction.Clicked += (s, evt) =>
|
||||
{
|
||||
arguments.SetResult(arguments.Destruction);
|
||||
|
@ -160,9 +162,10 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
var button = new Native.Button(alert)
|
||||
{
|
||||
Text = buttonName,
|
||||
Style = ButtonStyle.Text,
|
||||
AlignmentX = -1
|
||||
};
|
||||
button.SetWatchTextStyle();
|
||||
|
||||
button.Clicked += (s, evt) =>
|
||||
{
|
||||
arguments.SetResult(buttonName);
|
||||
|
|
|
@ -114,7 +114,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
void UpdateText()
|
||||
{
|
||||
Control.Text = Element.Text;
|
||||
Control.Text = Element.Text ?? "";
|
||||
if (!Control.IsFocused)
|
||||
{
|
||||
Control.MoveCursorEnd();
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
void UpdateText()
|
||||
{
|
||||
Control.Text = Element.Text;
|
||||
Control.Text = Element.Text ?? "";
|
||||
if (!Control.IsFocused)
|
||||
{
|
||||
Control.MoveCursorEnd();
|
||||
|
@ -259,7 +259,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
int GetSelectionStart()
|
||||
{
|
||||
int start = Element.Text.Length;
|
||||
int start = Element.Text?.Length ?? 0;
|
||||
int cursorPosition = Element.CursorPosition;
|
||||
|
||||
if (Element.IsSet(Entry.CursorPositionProperty))
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
void UpdateText()
|
||||
{
|
||||
Control.Text = Element.Text;
|
||||
Control.Text = Element.Text ?? "";
|
||||
}
|
||||
|
||||
void UpdateTextColor()
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
|
||||
void UpdateText(bool isInitialized)
|
||||
{
|
||||
_span.Text = Element.ContentAsString();
|
||||
_span.Text = Element.ContentAsString() ?? "";
|
||||
if (!isInitialized)
|
||||
ApplyTextAndStyle();
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
/// </summary>
|
||||
void TextPropertyHandler()
|
||||
{
|
||||
Control.Text = Element.Text;
|
||||
Control.Text = Element.Text ?? "";
|
||||
}
|
||||
|
||||
void UpdateKeyboard(bool initialize)
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
{
|
||||
public const string PopupLeft = "popup/circle/left_delete";
|
||||
public const string PopupRight = "popup/circle/right_check";
|
||||
public const string Text = "textbutton";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -235,6 +235,17 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
return button;
|
||||
}
|
||||
|
||||
public static EButton SetWatchTextStyle(this EButton button)
|
||||
{
|
||||
if (Device.Idiom != TargetIdiom.Watch)
|
||||
{
|
||||
Log.Error($"ToWatchPopupRightStyleButton is only supported on TargetIdiom.Watch : {0}", Device.Idiom);
|
||||
return button;
|
||||
}
|
||||
button.Style = ThemeConstants.Button.Styles.Watch.Text;
|
||||
return button;
|
||||
}
|
||||
|
||||
public static bool SetIconPart(this EButton button, EvasObject content, bool preserveOldContent = false)
|
||||
{
|
||||
return button.SetPartContent(ThemeConstants.Button.Parts.Icon, content, preserveOldContent);
|
||||
|
@ -273,6 +284,7 @@ namespace Xamarin.Forms.Platform.Tizen
|
|||
button.SetPartColor(ThemeConstants.Button.ColorClass.Effect, color);
|
||||
button.SetPartColor(ThemeConstants.Button.ColorClass.EffectPressed, color);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Popup
|
||||
|
|
Загрузка…
Ссылка в новой задаче