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
31 protected float mPrevScrollPosition = 0.0f;
32 protected int mPrevFirstDataIndex = 0;
33 protected float mStepSize = 0.0f;
36 /// Enumeration for the direction in which the content is laid out
38 /// <since_tizen> 8 </since_tizen>
39 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
40 [EditorBrowsable(EditorBrowsableState.Never)]
41 public enum Orientation
46 /// <since_tizen> 8 </since_tizen>
47 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
48 [EditorBrowsable(EditorBrowsableState.Never)]
53 /// <since_tizen> 8 </since_tizen>
54 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
55 [EditorBrowsable(EditorBrowsableState.Never)]
60 /// Container which contains RecycleItems.
62 /// <since_tizen> 8 </since_tizen>
63 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
64 [EditorBrowsable(EditorBrowsableState.Never)]
65 public View Container{get;set;}
68 /// Size of RecycleItem.
70 /// <since_tizen> 8 </since_tizen>
71 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
72 [EditorBrowsable(EditorBrowsableState.Never)]
73 public Size ItemSize{get;set;} = new Size();
76 /// Get/Set the orientation in the layout.
78 /// <since_tizen> 8 </since_tizen>
79 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
80 [EditorBrowsable(EditorBrowsableState.Never)]
81 public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
84 /// How far can you reach the next item.
86 /// <since_tizen> 8 </since_tizen>
87 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
88 [EditorBrowsable(EditorBrowsableState.Never)]
89 public float StepSize{
97 /// How far can you reach the next item.
99 /// <since_tizen> 8 </since_tizen>
100 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
101 [EditorBrowsable(EditorBrowsableState.Never)]
102 public int DataCount{get; set;}
105 /// This is called to find out where items are lain out according to current scroll position.
107 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
108 /// <since_tizen> 8 </since_tizen>
109 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
110 [EditorBrowsable(EditorBrowsableState.Never)]
111 public virtual void Layout(float scrollPosition)
117 /// This is called to find out how much container size can be.
119 /// <since_tizen> 8 </since_tizen>
120 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
121 [EditorBrowsable(EditorBrowsableState.Never)]
122 public virtual float CalculateLayoutOrientationSize()
128 /// This is called to find out which items should be recycled according to current scroll position.
130 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
131 /// <returns>List of RecycleItems which should be recycled.</returns>
132 /// <since_tizen> 8 </since_tizen>
133 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
134 [EditorBrowsable(EditorBrowsableState.Never)]
135 public virtual List<RecycleItem> Recycle(float scrollPosition)
137 return new List<RecycleItem>();
141 /// Adjust scrolling position by own scrolling rules.
143 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
144 /// <since_tizen> 8 </since_tizen>
145 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
146 [EditorBrowsable(EditorBrowsableState.Never)]
147 public virtual float CalculateCandidateScrollPosition(float scrollPosition)
149 return scrollPosition;