1 /* Copyright (c) 2020 Samsung Electronics Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 using Tizen.NUI.BaseComponents;
17 using Tizen.NUI.Components;
18 using System.Collections.Generic;
19 using System.ComponentModel;
21 namespace Tizen.NUI.Wearable
24 /// [Draft] Defalt layout manager for RecyclerView.
25 /// Lay out RecycleItem and recycle RecycleItem.
27 /// <since_tizen> 8 </since_tizen>
28 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
29 [EditorBrowsable(EditorBrowsableState.Never)]
30 public class RecycleLayoutManager
33 /// Enumeration for the direction in which the content is laid out
35 /// <since_tizen> 8 </since_tizen>
36 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
37 [EditorBrowsable(EditorBrowsableState.Never)]
38 public enum Orientation
43 /// <since_tizen> 8 </since_tizen>
44 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
45 [EditorBrowsable(EditorBrowsableState.Never)]
50 /// <since_tizen> 8 </since_tizen>
51 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
52 [EditorBrowsable(EditorBrowsableState.Never)]
57 /// Container which contains RecycleItems.
59 /// <since_tizen> 8 </since_tizen>
60 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
61 [EditorBrowsable(EditorBrowsableState.Never)]
62 public View Container { get; set; }
65 /// Size of RecycleItem.
67 /// <since_tizen> 8 </since_tizen>
68 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
69 [EditorBrowsable(EditorBrowsableState.Never)]
70 public Size ItemSize { get; set; } = new Size();
73 /// Get/Set the orientation in the layout.
75 /// <since_tizen> 8 </since_tizen>
76 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
77 [EditorBrowsable(EditorBrowsableState.Never)]
78 public Orientation LayoutOrientation { get; set; } = Orientation.Vertical;
81 /// How far can you reach the next item.
83 /// <since_tizen> 8 </since_tizen>
84 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 public float StepSize { get; protected set; }
89 /// How far can you reach the next item.
91 /// <since_tizen> 8 </since_tizen>
92 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
93 [EditorBrowsable(EditorBrowsableState.Never)]
94 public int DataCount { get; set; }
97 /// The last scrolled position which is calculated by ScrollableBase. The value should be updated in the Recycle() method.
99 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
100 [EditorBrowsable(EditorBrowsableState.Never)]
101 protected float PrevScrollPosition { get; set; }
104 /// This is called to find out where items are lain out according to current scroll position.
106 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
107 /// <since_tizen> 8 </since_tizen>
108 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
109 [EditorBrowsable(EditorBrowsableState.Never)]
110 public virtual void Layout(float scrollPosition)
116 /// This is called to find out how much container size can be.
118 /// <since_tizen> 8 </since_tizen>
119 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
120 [EditorBrowsable(EditorBrowsableState.Never)]
121 public virtual float CalculateLayoutOrientationSize()
127 /// This is called to find out which items should be recycled according to current scroll position.
129 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
130 /// <returns>List of RecycleItems which should be recycled.</returns>
131 /// <since_tizen> 8 </since_tizen>
132 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
133 [EditorBrowsable(EditorBrowsableState.Never)]
134 public virtual List<RecycleItem> Recycle(float scrollPosition)
136 return new List<RecycleItem>();
140 /// Adjust scrolling position by own scrolling rules.
142 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
143 /// <since_tizen> 8 </since_tizen>
144 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
145 [EditorBrowsable(EditorBrowsableState.Never)]
146 public virtual float CalculateCandidateScrollPosition(float scrollPosition)
148 return scrollPosition;
152 /// Gets the next keyboard focusable view in this control towards the given direction.<br />
153 /// A control needs to override this function in order to support two dimensional keyboard navigation.<br />
155 /// <param name="currentFocusedView">The current focused view.</param>
156 /// <param name="direction">The direction to move the focus towards.</param>
157 /// <param name="loopEnabled">Whether the focus movement should be looped within the control.</param>
158 /// <returns>The next keyboard focusable view in this control or an empty handle if no view can be focused.</returns>
159 [EditorBrowsable(EditorBrowsableState.Never)]
160 public virtual View RequestNextFocusableView(View currentFocusedView, View.FocusDirection direction, bool loopEnabled)