* limitations under the License.
*
*/
+
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
using System.Windows.Input;
+using Tizen.System;
namespace Tizen.NUI.Components
{
{
/// Internal used.
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(Control), null, propertyChanged: (bo, o, n) => ((Control)bo).OnCommandChanged());
+ public static readonly BindableProperty CommandProperty = BindableProperty.Create(nameof(Command), typeof(ICommand), typeof(Control), null, propertyChanged: (bo, o, n) => ((Control)bo).OnCommandChanged());
/// Internal used.
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(Button), null,
+ public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create(nameof(CommandParameter), typeof(object), typeof(Button), null,
propertyChanged: (bindable, oldvalue, newvalue) => ((Button)bindable).CommandCanExecuteChanged(bindable, EventArgs.Empty));
private bool onThemeChangedEventOverrideChecker;
+ private Feedback feedback = new Feedback();
+
private TapGestureDetector tapGestureDetector = new TapGestureDetector();
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
ThemeChangeSensitive = true;
}
+ /// <summary>
+ /// The flag of sound feedback when tap gesture detected.
+ /// </summary>
+ /// This will be public opened in tizen_6.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool IsTapGestureFeedback { get; set; } = false;
+
/// Internal used.
[EditorBrowsable(EditorBrowsableState.Never)]
public ICommand Command
{
tapGestureDetector.Detected -= OnTapGestureDetected;
tapGestureDetector.Detach(this);
+
+ if (feedback != null)
+ {
+ feedback.Stop();
+ feedback = null;
+ }
}
base.Dispose(type);
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- protected virtual void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e) { }
+ protected virtual void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
+ {
+ if (IsTapGestureFeedback && e?.TapGesture?.State == Gesture.StateType.Started)
+ {
+ if (feedback != null && feedback.IsSupportedPattern(FeedbackType.Sound, "Tap"))
+ {
+ feedback.Play(FeedbackType.Sound, "Tap");
+ }
+ }
+ }
/// <summary>
/// Update by style.
<ItemGroup>
<ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
<ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
+ <ProjectReference Include="..\Tizen.System.Feedback\Tizen.System.Feedback.csproj" />
<ProjectReference Include="..\Tizen.System.Information\Tizen.System.Information.csproj" />
</ItemGroup>
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Information", "..\Tizen.System.Information\Tizen.System.Information.csproj", "{11CACB07-AF47-480E-AB25-88E3C3297631}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.System.Feedback", "..\Tizen.System.Feedback\Tizen.System.Feedback.csproj", "{675DA71D-4314-4F10-8632-C804A9F720D4}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{11CACB07-AF47-480E-AB25-88E3C3297631}.Debug|Any CPU.Build.0 = Debug|Any CPU
{11CACB07-AF47-480E-AB25-88E3C3297631}.Release|Any CPU.ActiveCfg = Release|Any CPU
{11CACB07-AF47-480E-AB25-88E3C3297631}.Release|Any CPU.Build.0 = Release|Any CPU
+ {675DA71D-4314-4F10-8632-C804A9F720D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {675DA71D-4314-4F10-8632-C804A9F720D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {675DA71D-4314-4F10-8632-C804A9F720D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {675DA71D-4314-4F10-8632-C804A9F720D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
ScrollingDirection = Components.ScrollableBase.Direction.Vertical,
EnableOverShootingEffect = true,
};
- mScrollableBase.ScrollOutOfBound += OnScrollOutOfBound;
+ mScrollableBase.ScrollOutOfBoundWithDisplacement += OnScrollOutOfBound;
items = new TextLabel[5];
for (int i = 0; i < 5; i++)
root.Add(mScrollableBase);
}
- private void OnScrollOutOfBound(object sender, Components.ScrollOutOfBoundEventArgs e)
+ private void OnScrollOutOfBound(object sender, Components.ScrollOutOfBoundWithDisplacementEventArgs e)
{
if (e.Displacement > 100)
{
- if (e.PanDirection == Components.ScrollOutOfBoundEventArgs.Direction.Down)
+ if (e.PanDirection == Components.ScrollOutOfBoundWithDisplacementEventArgs.Direction.Down)
{
items[0].Text = $"Reached at the top, panned displacement is {e.Displacement}.";
}
}
else if (0 - e.Displacement > 100)
{
- if (e.PanDirection == Components.ScrollOutOfBoundEventArgs.Direction.Up)
+ if (e.PanDirection == Components.ScrollOutOfBoundWithDisplacementEventArgs.Direction.Up)
{
items[4].Text = $"Reached at the bottom, panned displacement is {e.Displacement}.";
}
utilitySwitch[i].ApplyStyle(utilitySt);
utilitySwitch[i].Size = new Size(96, 60);
utilitySwitch[i].Margin = new Extents(100, 0, 20, 0);
+ utilitySwitch[i].IsTapGestureFeedback = true;
parentView[2].Add(utilitySwitch[i]);
}
for (i = 0; i < 4; i++)
familySwitch[i] = new Switch();
familySwitch[i].ApplyStyle(familySt);
familySwitch[i].Size = new Size(96, 60);
+ familySwitch[i].IsTapGestureFeedback = true;
parentView[2].Add(familySwitch[i]);
}
for (i = 0; i < 4; i++)
foodSwitch[i] = new Switch();
foodSwitch[i].ApplyStyle(foodSt);
foodSwitch[i].Size = new Size(96, 60);
+ foodSwitch[i].IsTapGestureFeedback = true;
parentView[2].Add(foodSwitch[i]);
}
for (i = 0; i < 4; i++)
kitchenSwitch[i] = new Switch();
kitchenSwitch[i].ApplyStyle(kitchenSt);
kitchenSwitch[i].Size = new Size(96, 60);
+ kitchenSwitch[i].IsTapGestureFeedback = true;
parentView[2].Add(kitchenSwitch[i]);
}
utilitySwitch2[i] = new Switch();
utilitySwitch2[i].ApplyStyle(utilitySt);
utilitySwitch2[i].Size = new Size(96, 60);
+ utilitySwitch2[i].IsTapGestureFeedback = true;
parentView[2].Add(utilitySwitch2[i]);
}
for (i = 0; i < 4; i++)
familySwitch2[i] = new Switch();
familySwitch2[i].ApplyStyle(familySt);
familySwitch2[i].Size = new Size(96, 60);
+ familySwitch2[i].IsTapGestureFeedback = true;
parentView[2].Add(familySwitch2[i]);
}
for (i = 0; i < 4; i++)
foodSwitch2[i] = new Switch();
foodSwitch2[i].ApplyStyle(foodSt);
foodSwitch2[i].Size = new Size(96, 60);
+ foodSwitch2[i].IsTapGestureFeedback = true;
parentView[2].Add(foodSwitch2[i]);
}
for (i = 0; i < 4; i++)
kitchenSwitch2[i] = new Switch();
kitchenSwitch2[i].ApplyStyle(kitchenSt);
kitchenSwitch2[i].Size = new Size(96, 60);
+ kitchenSwitch2[i].IsTapGestureFeedback = true;
parentView[2].Add(kitchenSwitch2[i]);
}