Skip to content

Commit

Permalink
[NUI] Add DisableBindableProperty and VoiceInteractionName as hidden …
Browse files Browse the repository at this point in the history
…APIs
  • Loading branch information
dongsug-song committed Mar 12, 2024
1 parent be56587 commit 8c71994
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 117 deletions.
11 changes: 11 additions & 0 deletions src/Tizen.NUI/src/public/Application/NUIApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,17 @@ static public void Preload()
IsPreload = true;
}

/// <summary>
/// Set to true if BindableProperty is not used.
/// This must be called immediately after the NUIApplication constructor is called.
/// The default value is false.
/// </summary>
/// <remarks>
/// This must be called immediately after the NUIApplication constructor is called.
/// </remarks>
[EditorBrowsable(EditorBrowsableState.Never)]
static public bool DisableBindableProperty { get; set; } = false;

/// <summary>
/// Check if it is loaded as dotnet-loader-nui.
/// </summary>
Expand Down
129 changes: 96 additions & 33 deletions src/Tizen.NUI/src/public/BaseComponents/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,23 @@ public partial class View : Container, IResourcesProvider

static View()
{
RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);
if (NUIApplication.DisableBindableProperty == false)
{
RegisterPropertyGroup(PositionProperty, positionPropertyGroup);
RegisterPropertyGroup(Position2DProperty, positionPropertyGroup);
RegisterPropertyGroup(PositionXProperty, positionPropertyGroup);
RegisterPropertyGroup(PositionYProperty, positionPropertyGroup);

RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);
RegisterPropertyGroup(SizeProperty, sizePropertyGroup);
RegisterPropertyGroup(Size2DProperty, sizePropertyGroup);
RegisterPropertyGroup(SizeWidthProperty, sizePropertyGroup);
RegisterPropertyGroup(SizeHeightProperty, sizePropertyGroup);

RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleXProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleYProperty, scalePropertyGroup);
RegisterPropertyGroup(ScaleZProperty, scalePropertyGroup);
}

RegisterAccessibilityDelegate();
}
Expand Down Expand Up @@ -145,14 +148,14 @@ private static IntPtr NewWithAccessibilityMode(ViewAccessibilityMode accessibili
switch (accessibilityMode)
{
case ViewAccessibilityMode.Custom:
{
return Interop.View.NewCustom();
}
{
return Interop.View.NewCustom();
}
case ViewAccessibilityMode.Default:
default:
{
return Interop.View.New();
}
{
return Interop.View.New();
}
}
}

Expand Down Expand Up @@ -412,7 +415,7 @@ protected set
}

if (child.ControlState != newControlState)
child.ControlState = newControlState;
child.ControlState = newControlState;
}
}
}
Expand Down Expand Up @@ -523,11 +526,25 @@ public Color BackgroundColor
{
get
{
return (Color)GetValue(BackgroundColorProperty);
if (NUIApplication.DisableBindableProperty)
{
return (Color)GetInternalBackgroundColorProperty(this);
}
else
{
return (Color)GetValue(BackgroundColorProperty);
}
}
set
{
SetValue(BackgroundColorProperty, value);
if (NUIApplication.DisableBindableProperty)
{
SetInternalBackgroundColorProperty(this, null, value);
}
else
{
SetValue(BackgroundColorProperty, value);
}
NotifyPropertyChanged();
}
}
Expand Down Expand Up @@ -1284,20 +1301,37 @@ public Size2D Size2D
{
get
{
var temp = (Size2D)GetValue(Size2DProperty);

if (this.Layout == null)
if (NUIApplication.DisableBindableProperty)
{
if (temp.Width < 0) { temp.Width = 0; }
if (temp.Height < 0) { temp.Height = 0; }
var temp = (Size2D)GetInternalSize2DProperty(this);
if (this.Layout == null)
{
if (temp.Width < 0) { temp.Width = 0; }
if (temp.Height < 0) { temp.Height = 0; }
}
return temp;
}
else
{
var temp = (Size2D)GetValue(Size2DProperty);
if (this.Layout == null)
{
if (temp.Width < 0) { temp.Width = 0; }
if (temp.Height < 0) { temp.Height = 0; }
}
return temp;
}

return temp;
}
set
{
SetValue(Size2DProperty, value);

if (NUIApplication.DisableBindableProperty)
{
SetInternalSize2DProperty(this, null, value);
}
else
{
SetValue(Size2DProperty, value);
}
NotifyPropertyChanged();
}
}
Expand Down Expand Up @@ -1370,11 +1404,25 @@ public Position2D Position2D
{
get
{
return (Position2D)GetValue(Position2DProperty);
if (NUIApplication.DisableBindableProperty)
{
return (Position2D)GetInternalPosition2DProperty(this);
}
else
{
return (Position2D)GetValue(Position2DProperty);
}
}
set
{
SetValue(Position2DProperty, value);
if (NUIApplication.DisableBindableProperty)
{
SetInternalPosition2DProperty(this, null, value);
}
else
{
SetValue(Position2DProperty, value);
}
NotifyPropertyChanged();
}
}
Expand Down Expand Up @@ -3512,5 +3560,20 @@ protected virtual bool HitTest(Touch touch)
[EditorBrowsable(EditorBrowsableState.Never)]
public static int AliveCount => aliveCount;

/// <summary>
/// Voice interaction name for voice touch.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public string VoiceInteractionName
{
set
{
AutomationId = value;
}
get
{
return AutomationId;
}
}
}
}
}
Loading

0 comments on commit 8c71994

Please sign in to comment.