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 LayoutManager
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 public Size ItemSize{get;set;} = new Size();
75 /// Get/Set the orientation in the layout.
77 /// <since_tizen> 8 </since_tizen>
78 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
79 public Orientation LayoutOrientation{get;set;} = Orientation.Vertical;
82 /// How far can you reach the next item.
84 /// <since_tizen> 8 </since_tizen>
85 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
86 public float StepSize{
94 /// This is called to find out where items are lain out according to current scroll position.
96 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
97 /// <since_tizen> 8 </since_tizen>
98 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
99 public virtual void Layout(float scrollPosition)
105 /// This is called to find out which items should be recycled according to current scroll position.
107 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
108 /// <returns>List of RecycleItems which should be recycled.</returns>
109 /// <since_tizen> 8 </since_tizen>
110 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
111 public virtual List<RecycleItem> Recycle(float scrollPosition)
113 return new List<RecycleItem>();
117 /// Adjust scrolling position by own scrolling rules.
119 /// <param name="scrollPosition">Scroll position which is calculated by ScrollableBase</param>
120 /// <since_tizen> 8 </since_tizen>
121 /// This may be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API
122 public virtual float CalculateCandidateScrollPosition(float scrollPosition)
124 return scrollPosition;