From: neostom432 <31119276+neostom432@users.noreply.github.com>
Date: Mon, 13 Jul 2020 01:32:04 +0000 (+0900)
Subject: [NUI] Open ScrollalbleBase APIs (#1783)
X-Git-Tag: accepted/tizen/unified/20210219.040944~579
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=972381f7842035dd59a636836cc9b2e2fe1ed738;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
[NUI] Open ScrollalbleBase APIs (#1783)
---
diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs
index d0a008d..19e6d9d 100755
--- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs
+++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs
@@ -25,27 +25,25 @@ namespace Tizen.NUI.Components
///
/// ScrollEventArgs is a class to record scroll event arguments which will sent to user.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public class ScrollEventArgs : EventArgs
{
- Position position;
+ private Position position;
///
/// Default constructor.
///
/// Current scroll position
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
+ /// 8
public ScrollEventArgs(Position position)
{
this.position = position;
}
///
- /// [Draft] Current scroll position.
+ /// Current position of ContentContainer.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public Position Position
{
get
@@ -56,10 +54,9 @@ namespace Tizen.NUI.Components
}
///
- /// [Draft] This class provides a View that can scroll a single View with a layout. This View can be a nest of Views.
+ /// This class provides a View that can scroll a single View with a layout. This View can be a nest of Views.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public class ScrollableBase : Control
{
static bool LayoutDebugScrollableBase = false; // Debug flag
@@ -174,30 +171,27 @@ namespace Tizen.NUI.Components
///
/// The direction axis to scroll.
///
- /// 6
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public enum Direction
{
///
/// Horizontal axis.
///
- /// 6
+ /// 8
Horizontal,
///
/// Vertical axis.
///
- /// 6
+ /// 8
Vertical
}
///
- /// [Draft] Scrolling direction mode.
+ /// Scrolling direction mode.
/// Default is Vertical scrolling.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public Direction ScrollingDirection
{
get
@@ -223,10 +217,9 @@ namespace Tizen.NUI.Components
}
///
- /// [Draft] Enable or disable scrolling.
+ /// Enable or disable scrolling.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public bool ScrollEnabled
{
get
@@ -251,78 +244,69 @@ namespace Tizen.NUI.Components
}
///
- /// [Draft] Pages mode, enables moving to the next or return to current page depending on pan displacement.
+ /// Pages mode, enables moving to the next or return to current page depending on pan displacement.
/// Default is false.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public bool SnapToPage { set; get; } = false;
///
- /// [Draft] Get current page.
- /// Working propery with SnapToPage property.
+ /// Get current page.
+ /// Working property with SnapToPage property.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public int CurrentPage { get; private set; } = 0;
///
- /// [Draft] Duration of scroll animation.
+ /// Duration of scroll animation.
+ /// Default value is 125ms.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
-
+ /// 8
public int ScrollDuration { set; get; } = 125;
+
///
- /// [Draft] Scroll Available area.
+ /// Scroll Available area.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public Vector2 ScrollAvailableArea { set; get; }
///
/// An event emitted when user starts dragging ScrollableBase, user can subscribe or unsubscribe to this event handler.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public event EventHandler ScrollDragStarted;
///
/// An event emitted when user stops dragging ScrollableBase, user can subscribe or unsubscribe to this event handler.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public event EventHandler ScrollDragEnded;
///
/// An event emitted when the scrolling slide animation starts, user can subscribe or unsubscribe to this event handler.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public event EventHandler ScrollAnimationStarted;
///
/// An event emitted when the scrolling slide animation ends, user can subscribe or unsubscribe to this event handler.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public event EventHandler ScrollAnimationEnded;
///
/// An event emitted when scrolling, user can subscribe or unsubscribe to this event handler.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public event EventHandler Scrolling;
///
- /// Scrollbar for ScrollableBase.
+ /// Scrollbar for ScrollableBase.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public ScrollbarBase Scrollbar
{
get
@@ -354,11 +338,10 @@ namespace Tizen.NUI.Components
}
///
- /// [Draft] Always hide Scrollbar.
+ /// Always hide Scrollbar.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
- public bool HideScrollBar
+ /// 8
+ public bool HideScrollbar
{
get
{
@@ -385,13 +368,13 @@ namespace Tizen.NUI.Components
///
/// Container which has content of ScrollableBase.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public View ContentContainer { get; private set; }
///
/// Set the layout on this View. Replaces any existing Layout.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public new LayoutItem Layout
{
get
@@ -411,7 +394,7 @@ namespace Tizen.NUI.Components
///
/// List of children of Container.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public new List Children
{
get
@@ -422,9 +405,10 @@ namespace Tizen.NUI.Components
///
/// Deceleration rate of scrolling by finger.
- /// Rate should be 0 ï¼ rate ï¼ 1.
+ /// Rate should be bigger than 0 and smaller than 1.
+ /// Default value is 0.998f;
///
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public float DecelerationRate
{
get
@@ -446,8 +430,9 @@ namespace Tizen.NUI.Components
///
/// Page will be changed when velocity of panning is over threshold.
+ /// The unit of threshold is pixel per milisec.
///
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public float PageFlickThreshold { get; set; } = 0.4f;
///
@@ -469,10 +454,14 @@ namespace Tizen.NUI.Components
private PropertyNotification propertyNotification;
private float noticeAnimationEndBeforePosition = 0.0f;
private bool readyToNotice = false;
+
+ ///
+ /// Notice before animation is finished.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
// Let's consider more whether this needs to be set as protected.
public float NoticeAnimationEndBeforePosition { get => noticeAnimationEndBeforePosition; set => noticeAnimationEndBeforePosition = value; }
-
// Let's consider more whether this needs to be set as protected.
private float finalTargetPosition;
@@ -488,10 +477,9 @@ namespace Tizen.NUI.Components
private float decelerationRate = 0.0f;
///
- /// [Draft] Constructor
+ /// Default Constructor
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public ScrollableBase() : base()
{
DecelerationRate = 0.998f;
@@ -547,8 +535,7 @@ namespace Tizen.NUI.Components
/// Called after a child has been added to the owning view.
///
/// The child which has been added.
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public override void Add(View view)
{
ContentContainer.Add(view);
@@ -558,8 +545,7 @@ namespace Tizen.NUI.Components
/// Called after a child has been removed from the owning view.
///
/// The child which has been removed.
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public override void Remove(View view)
{
if (SnapToPage && CurrentPage == Children.IndexOf(view) && CurrentPage == Children.Count - 1)
@@ -591,7 +577,7 @@ namespace Tizen.NUI.Components
/// The composition of a Scrollbar can vary depending on how you use ScrollableBase.
/// Set the composition that will go into the ScrollableBase according to your ScrollableBase.
///
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
+ /// 8
[EditorBrowsable(EditorBrowsableState.Never)]
protected virtual void SetScrollbar()
{
@@ -609,8 +595,7 @@ namespace Tizen.NUI.Components
/// Scrolls to the item at the specified index.
///
/// Index of item.
- /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public void ScrollToIndex(int index)
{
if (ContentContainer.ChildCount - 1 < index || index < 0)
@@ -731,7 +716,7 @@ namespace Tizen.NUI.Components
///
/// Destination.
/// Scroll with or without animation
- [EditorBrowsable(EditorBrowsableState.Never)]
+ /// 8
public void ScrollTo(float position, bool animate)
{
float currentPositionX = ContentContainer.CurrentPosition.X != 0 ? ContentContainer.CurrentPosition.X : ContentContainer.Position.X;
@@ -943,7 +928,7 @@ namespace Tizen.NUI.Components
}
else
{
- Decelerating((ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y);
+ Decelerating((ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y, scrollAnimation);
}
totalDisplacementForPan = 0;
@@ -971,7 +956,13 @@ namespace Tizen.NUI.Components
}
}
- private void Decelerating(float velocity)
+ ///
+ /// you can override it to custom your decelerating
+ ///
+ /// Velocity of current pan.
+ /// Scroll animation.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected virtual void Decelerating(float velocity, Animation animation)
{
// Decelerating using deceleration equation ===========
//
@@ -1054,16 +1045,11 @@ namespace Tizen.NUI.Components
finalTargetPosition = destination;
customScrollAlphaFunction = new UserAlphaFunctionDelegate(CustomScrollAlphaFunction);
- scrollAnimation.DefaultAlphaFunction = new AlphaFunction(customScrollAlphaFunction);
+ animation.DefaultAlphaFunction = new AlphaFunction(customScrollAlphaFunction);
GC.KeepAlive(customScrollAlphaFunction);
- scrollAnimation.Duration = (int)panAnimationDuration;
- scrollAnimation.AnimateTo(ContentContainer, (ScrollingDirection == Direction.Horizontal) ? "PositionX" : "PositionY", destination);
- scrollAnimation.Play();
- }
-
- protected void OnTapGestureDetected(object source, TapGestureDetector.DetectedEventArgs e)
- {
-
+ animation.Duration = (int)panAnimationDuration;
+ animation.AnimateTo(ContentContainer, (ScrollingDirection == Direction.Horizontal) ? "PositionX" : "PositionY", destination);
+ animation.Play();
}
private void ScrollAnimationFinished(object sender, EventArgs e)