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 System.Collections.Generic;
18 using System.ComponentModel;
20 namespace Tizen.NUI.Components
23 /// [Draft] Defalt layout manager for RecyclerView.
24 /// Lay out RecycleItem and recycle RecycleItem.
26 /// <since_tizen> 8 </since_tizen>
27 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
28 [EditorBrowsable(EditorBrowsableState.Never)]
29 public class RecycleLayoutManager
32 /// Enumeration for the direction in which the content is laid out
34 /// <since_tizen> 8 </since_tizen>
35 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
36 [EditorBrowsable(EditorBrowsableState.Never)]
37 public enum Orientation
42 /// <since_tizen> 8 </since_tizen>
43 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
44 [EditorBrowsable(EditorBrowsableState.Never)]
49 /// <since_tizen> 8 </since_tizen>
50 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
51 [EditorBrowsable(EditorBrowsableState.Never)]
56 /// Container which contains RecycleItems.
58 /// <since_tizen> 8 </since_tizen>
59 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
60 [EditorBrowsable(EditorBrowsableState.Never)]
61 public View Container{get;set;}
64 /// Size of RecycleItem.
66 /// <since_tizen> 8 </since_tizen>
67 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
68 [EditorBrowsable(EditorBrowsableState.Never)]
69 public Size ItemSize{get;set;} = new Size();
72 /// Get/Set the orientation in the layout.
74 /// <since_tizen> 8 </since_tizen>
75 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
76 [EditorBrowsable(EditorBrowsableState.Never)]
77 public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
80 /// How far can you reach the next item.
82 /// <since_tizen> 8 </since_tizen>
83 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
84 [EditorBrowsable(EditorBrowsableState.Never)]
85 public float StepSize { get; protected set; }
88 /// How far can you reach the next item.
90 /// <since_tizen> 8 </since_tizen>
91 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
92 [EditorBrowsable(EditorBrowsableState.Never)]
93 public int DataCount{get; set;}
96 /// The last scrolled position which is calculated by ScrollableBase. The value should be updated in the Recycle() method.
98 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
99 [EditorBrowsable(EditorBrowsableState.Never)]
100 protected float PrevScrollPosition { get; set; }
103 /// This is called to find out where items are lain out according to current scroll position.
105 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
106 /// <since_tizen> 8 </since_tizen>
107 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
108 [EditorBrowsable(EditorBrowsableState.Never)]
109 public virtual void Layout(float scrollPosition)
115 /// This is called to find out how much container size can be.
117 /// <since_tizen> 8 </since_tizen>
118 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
119 [EditorBrowsable(EditorBrowsableState.Never)]
120 public virtual float CalculateLayoutOrientationSize()
126 /// This is called to find out which items should be recycled according to current scroll position.
128 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
129 /// <returns>List of RecycleItems which should be recycled.</returns>
130 /// <since_tizen> 8 </since_tizen>
131 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
132 [EditorBrowsable(EditorBrowsableState.Never)]
133 public virtual List<RecycleItem> Recycle(float scrollPosition)
135 return new List<RecycleItem>();
139 /// Adjust scrolling position by own scrolling rules.
141 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
142 /// <since_tizen> 8 </since_tizen>
143 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
144 [EditorBrowsable(EditorBrowsableState.Never)]
145 public virtual float CalculateCandidateScrollPosition(float scrollPosition)
147 return scrollPosition;